diff --git a/Backgrounds/MapBackgrounds/SulphurBG.png b/Backgrounds/MapBackgrounds/SulphurBG.png new file mode 100644 index 0000000000..139bcb19d0 Binary files /dev/null and b/Backgrounds/MapBackgrounds/SulphurBG.png differ diff --git a/Buffs/AbyssalDivingSuitBuff.cs b/Buffs/AbyssalDivingSuitBuff.cs index daf73fa798..2a7518a4d2 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--; - } - } - } +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 diff --git a/Buffs/AbyssalDivingSuitPlates.cs b/Buffs/AbyssalDivingSuitPlates.cs index fa97db5450..0301f72902 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 25% 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; - } - } +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 25% 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 diff --git a/Buffs/AbyssalDivingSuitPlatesBroken.cs b/Buffs/AbyssalDivingSuitPlatesBroken.cs index b4bc9a82ab..f7a2493001 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; - } - } +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 diff --git a/Buffs/AbyssalFlames.cs b/Buffs/AbyssalFlames.cs index 0a3e7847bb..fcc8fd5e61 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 = true; - 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; - } - } +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 = true; + 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 diff --git a/Buffs/AbyssalWeapon.cs b/Buffs/AbyssalWeapon.cs index a2921cb83b..8383c90e7e 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; - } - } +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 diff --git a/Buffs/AdrenalineMode.cs b/Buffs/AdrenalineMode.cs index 4d0324b8fb..43f0b2a94c 100644 --- a/Buffs/AdrenalineMode.cs +++ b/Buffs/AdrenalineMode.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 AdrenalineMode : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Adrenaline Mode"); - Description.SetDefault("250% (1000% in Death Mode) increased damage."); - 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).adrenalineMode = true; - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AdrenalineMode : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Adrenaline Mode"); + Description.SetDefault("250% (1000% in Death Mode) increased damage."); + 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).adrenalineMode = true; + } + } } \ No newline at end of file diff --git a/Buffs/Afflicted.cs b/Buffs/Afflicted.cs index 64cb580df4..1589e06420 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("Rage is power"); - 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).afflictedBuff = true; - } - } +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("Rage is power"); + 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).afflictedBuff = true; + } + } } \ No newline at end of file diff --git a/Buffs/AnechoicCoating.cs b/Buffs/AnechoicCoating.cs index c3b08c7075..f6b61b2d56 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; - } - } +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 diff --git a/Buffs/AngryChicken.cs b/Buffs/AngryChicken.cs index dc4a05b9d3..43a8f1e0b8 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; - } - } - } +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 diff --git a/Buffs/AquaticStar.cs b/Buffs/AquaticStar.cs index ad6ebaa424..4346e72e35 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; - } - } - } +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 diff --git a/Buffs/ArmorCrunch.cs b/Buffs/ArmorCrunch.cs index d1f6895cb8..fd5572027e 100644 --- a/Buffs/ArmorCrunch.cs +++ b/Buffs/ArmorCrunch.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 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 = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).aCrunch = true; - } - } +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 = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).aCrunch = true; + } + } } \ No newline at end of file diff --git a/Buffs/Backfire.cs b/Buffs/Backfire.cs index 2d886cb1cc..57c0257c10 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 -= 30; - player.endurance -= 0.3f; - 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 -= 30; + player.endurance -= 0.3f; + player.wingTimeMax /= 2; + } + } +} diff --git a/Buffs/BloodClot.cs b/Buffs/BloodClot.cs index 69a120e473..d1528f6e95 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; - } - } - } +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 diff --git a/Buffs/BrimlingBuff.cs b/Buffs/BrimlingBuff.cs index e45090c1f4..3689755901 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); - } - } - } +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 diff --git a/Buffs/BrimstoneFlames.cs b/Buffs/BrimstoneFlames.cs index e5dbddc411..d7809de3e9 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/BrimstoneMount.cs b/Buffs/BrimstoneMount.cs index ed53322f2d..497f4b3dba 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 b3c406e545..730eb5e944 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 Waifu"); - 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; - } - } - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BrimstoneWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimstone Waifu"); + 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 diff --git a/Buffs/BrittleStar.cs b/Buffs/BrittleStar.cs index d0e6a94902..03077e2683 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; - } - } - } +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 diff --git a/Buffs/BurningBlood.cs b/Buffs/BurningBlood.cs index ce0b3cc2da..ae9bd5c2fb 100644 --- a/Buffs/BurningBlood.cs +++ b/Buffs/BurningBlood.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 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 = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).bBlood = true; - } - } +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 = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bBlood = true; + } + } } \ No newline at end of file diff --git a/Buffs/Cadence.cs b/Buffs/Cadence.cs index 40d15ab78e..49416acb72 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; - } - } +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 diff --git a/Buffs/Calamari.cs b/Buffs/Calamari.cs index 1b4ab29727..fb94ae58df 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; - } - } - } +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 diff --git a/Buffs/CalamitasEyes.cs b/Buffs/CalamitasEyes.cs index 1fe74eff39..612c8c140f 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; - } - } - } +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 diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 4970f22556..87c02d23fb 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,25 +1,29 @@ -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; - -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; - } - } - } -} +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; + +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; + } + if (type == BuffID.IceBarrier) + { + player.endurance -= 0.1f; + } + } + } +} diff --git a/Buffs/ChaosSpirit.cs b/Buffs/ChaosSpirit.cs index 5299e7f19f..e3083e207c 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; - } - } - } +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 diff --git a/Buffs/ChibiiBuff.cs b/Buffs/ChibiiBuff.cs index 4b66869eb8..5e3f247ef9 100644 --- a/Buffs/ChibiiBuff.cs +++ b/Buffs/ChibiiBuff.cs @@ -1,38 +1,38 @@ -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); - } - - //immunizes player to red devil buff - int devilbuff = mod.BuffType("RedDevil"); - player.buffImmune[devilbuff] = true; - - //makes game think red devil minion is always active so it doesnt spawn one - int devilprojectile = mod.ProjectileType("RedDevil"); - player.ownedProjectileCounts[devilprojectile] = 1; - } - } -} +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); + } + + //immunizes player to red devil buff + int devilbuff = mod.BuffType("RedDevil"); + player.buffImmune[devilbuff] = true; + + //makes game think red devil minion is always active so it doesnt spawn one + int devilprojectile = mod.ProjectileType("RedDevil"); + player.ownedProjectileCounts[devilprojectile] = 1; + } + } +} diff --git a/Buffs/CloudyWaifu.cs b/Buffs/CloudyWaifu.cs index d6708a5d01..7ca0c59ea0 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("Cloudy Waifu"); - 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; - } - } - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CloudyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cloudy Waifu"); + 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 diff --git a/Buffs/Corroslime.cs b/Buffs/Corroslime.cs index 8c98873566..4fbb162b47 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; - } - } - } +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 diff --git a/Buffs/CosmicEnergy.cs b/Buffs/CosmicEnergy.cs index 76994abfeb..e6ca6a4fb5 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; - } - } - } +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 diff --git a/Buffs/CosmicFreeze.cs b/Buffs/CosmicFreeze.cs index 5bc40ae006..d3f9a13447 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; - } - } +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 diff --git a/Buffs/Cosmilamp.cs b/Buffs/Cosmilamp.cs index 03ce467f96..49f4b7eb2a 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; - } - } - } +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 diff --git a/Buffs/Crimslime.cs b/Buffs/Crimslime.cs index b67d9d7da3..59e06d7ef5 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; - } - } - } +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 diff --git a/Buffs/CrushDepth.cs b/Buffs/CrushDepth.cs index e06f1b9f5e..b89a6b5df1 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/CrushDepth.png b/Buffs/CrushDepth.png index e08b25c84a..8a03a35601 100644 Binary files a/Buffs/CrushDepth.png and b/Buffs/CrushDepth.png differ diff --git a/Buffs/DaedalusCrystal.cs b/Buffs/DaedalusCrystal.cs index f142e6a518..9cc54e35a7 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; - } - } - } +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 diff --git a/Buffs/DankCreeper.cs b/Buffs/DankCreeper.cs index 697fb850be..ee8ae2bc74 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; - } - } - } +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 diff --git a/Buffs/DemonFlames.cs b/Buffs/DemonFlames.cs index 40272b2ee9..7f62a95dc1 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; - } - } +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 diff --git a/Buffs/DrewsSandyWaifu.cs b/Buffs/DrewsSandyWaifu.cs index 5da03bef6e..20c06a78e7 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("Sandy Waifu"); - 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("DrewsSandyWaifu")] > 0) - { - modPlayer.dWaifu = true; - } - if (!modPlayer.dWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DrewsSandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sandy Waifu"); + 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("DrewsSandyWaifu")] > 0) + { + modPlayer.dWaifu = true; + } + if (!modPlayer.dWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } } \ No newline at end of file diff --git a/Buffs/ElementalAxe.cs b/Buffs/ElementalAxe.cs index f57bd81956..e34c33d37d 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; - } - } - } +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 diff --git a/Buffs/Enraged.cs b/Buffs/Enraged.cs index 5dcf53f4b8..864f2df6d7 100644 --- a/Buffs/Enraged.cs +++ b/Buffs/Enraged.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 Enraged : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Enraged"); - Description.SetDefault("Enemies are enraged and do 1.5 times damage"); - 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).enraged = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).enraged = true; - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Enraged : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Enraged"); + Description.SetDefault("Enemies are enraged and do 1.5 times damage"); + 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).enraged = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).enraged = true; + } + } } \ No newline at end of file diff --git a/Buffs/ExoFreeze.cs b/Buffs/ExoFreeze.cs index 03199822a3..2e1371387c 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; - } - } +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 diff --git a/Buffs/ExtremeGrav.cs b/Buffs/ExtremeGrav.cs index dff7890e7a..8bdbd9406b 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 = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).eGrav = true; - } - } +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 = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).eGrav = true; + } + } } \ No newline at end of file diff --git a/Buffs/ExtremeGrav.png b/Buffs/ExtremeGrav.png index 3e542d09b3..fdd727f1c5 100644 Binary files a/Buffs/ExtremeGrav.png and b/Buffs/ExtremeGrav.png differ diff --git a/Buffs/ExtremeGravity.cs b/Buffs/ExtremeGravity.cs index 5cf32585fc..28434d38d2 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 = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).eGravity = true; - } - } +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 = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).eGravity = true; + } + } } \ No newline at end of file diff --git a/Buffs/Fab.cs b/Buffs/Fab.cs index 2fe3003dae..f6e0b8e306 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 new file mode 100644 index 0000000000..e3d608134a --- /dev/null +++ b/Buffs/Fabsol/BloodyMary.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/BloodyMary.png b/Buffs/Fabsol/BloodyMary.png new file mode 100644 index 0000000000..bee4c0d4f1 Binary files /dev/null and b/Buffs/Fabsol/BloodyMary.png differ diff --git a/Buffs/Fabsol/CaribbeanRum.cs b/Buffs/Fabsol/CaribbeanRum.cs new file mode 100644 index 0000000000..3ec5ff0803 --- /dev/null +++ b/Buffs/Fabsol/CaribbeanRum.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/CaribbeanRum.png b/Buffs/Fabsol/CaribbeanRum.png new file mode 100644 index 0000000000..b6bd9fb903 Binary files /dev/null and b/Buffs/Fabsol/CaribbeanRum.png differ diff --git a/Buffs/Fabsol/CinnamonRoll.cs b/Buffs/Fabsol/CinnamonRoll.cs new file mode 100644 index 0000000000..692918d3d5 --- /dev/null +++ b/Buffs/Fabsol/CinnamonRoll.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/CinnamonRoll.png b/Buffs/Fabsol/CinnamonRoll.png new file mode 100644 index 0000000000..2d2e710cd4 Binary files /dev/null and b/Buffs/Fabsol/CinnamonRoll.png differ diff --git a/Buffs/Fabsol/Everclear.cs b/Buffs/Fabsol/Everclear.cs new file mode 100644 index 0000000000..e1a49db512 --- /dev/null +++ b/Buffs/Fabsol/Everclear.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Everclear : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Everclear"); + Description.SetDefault("Damage and critical strike chance 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).everclear = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Fabsol/Everclear.png b/Buffs/Fabsol/Everclear.png new file mode 100644 index 0000000000..a6f5af5315 Binary files /dev/null and b/Buffs/Fabsol/Everclear.png differ diff --git a/Buffs/Fabsol/EvergreenGin.cs b/Buffs/Fabsol/EvergreenGin.cs new file mode 100644 index 0000000000..de2c6d61a4 --- /dev/null +++ b/Buffs/Fabsol/EvergreenGin.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/EvergreenGin.png b/Buffs/Fabsol/EvergreenGin.png new file mode 100644 index 0000000000..c7d719d065 Binary files /dev/null and b/Buffs/Fabsol/EvergreenGin.png differ diff --git a/Buffs/Fabsol/FabsolVodka.cs b/Buffs/Fabsol/FabsolVodka.cs new file mode 100644 index 0000000000..1c4607810e --- /dev/null +++ b/Buffs/Fabsol/FabsolVodka.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/FabsolVodka.png b/Buffs/Fabsol/FabsolVodka.png new file mode 100644 index 0000000000..1c9a31dd3c Binary files /dev/null and b/Buffs/Fabsol/FabsolVodka.png differ diff --git a/Buffs/Fabsol/Fireball.cs b/Buffs/Fabsol/Fireball.cs new file mode 100644 index 0000000000..769199532c --- /dev/null +++ b/Buffs/Fabsol/Fireball.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Fireball.png b/Buffs/Fabsol/Fireball.png new file mode 100644 index 0000000000..31c326dcfc Binary files /dev/null and b/Buffs/Fabsol/Fireball.png differ diff --git a/Buffs/Fabsol/GrapeBeer.cs b/Buffs/Fabsol/GrapeBeer.cs new file mode 100644 index 0000000000..aa648de605 --- /dev/null +++ b/Buffs/Fabsol/GrapeBeer.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class GrapeBeer : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Grape Beer"); + Description.SetDefault("Life regen, defense, and movement speed 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).grapeBeer = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Fabsol/GrapeBeer.png b/Buffs/Fabsol/GrapeBeer.png new file mode 100644 index 0000000000..37b192bf52 Binary files /dev/null and b/Buffs/Fabsol/GrapeBeer.png differ diff --git a/Buffs/Fabsol/Margarita.cs b/Buffs/Fabsol/Margarita.cs new file mode 100644 index 0000000000..542f4b9660 --- /dev/null +++ b/Buffs/Fabsol/Margarita.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Margarita.png b/Buffs/Fabsol/Margarita.png new file mode 100644 index 0000000000..28c9daaea9 Binary files /dev/null and b/Buffs/Fabsol/Margarita.png differ diff --git a/Buffs/Fabsol/Moonshine.cs b/Buffs/Fabsol/Moonshine.cs new file mode 100644 index 0000000000..48a70dec5a --- /dev/null +++ b/Buffs/Fabsol/Moonshine.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Moonshine.png b/Buffs/Fabsol/Moonshine.png new file mode 100644 index 0000000000..1655cd8ea4 Binary files /dev/null and b/Buffs/Fabsol/Moonshine.png differ diff --git a/Buffs/Fabsol/MoscowMule.cs b/Buffs/Fabsol/MoscowMule.cs new file mode 100644 index 0000000000..5b1cbdaa4b --- /dev/null +++ b/Buffs/Fabsol/MoscowMule.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/MoscowMule.png b/Buffs/Fabsol/MoscowMule.png new file mode 100644 index 0000000000..3339894ff2 Binary files /dev/null and b/Buffs/Fabsol/MoscowMule.png differ diff --git a/Buffs/Fabsol/RedWine.cs b/Buffs/Fabsol/RedWine.cs new file mode 100644 index 0000000000..8c5831ee7a --- /dev/null +++ b/Buffs/Fabsol/RedWine.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/RedWine.png b/Buffs/Fabsol/RedWine.png new file mode 100644 index 0000000000..ed3caab2bf Binary files /dev/null and b/Buffs/Fabsol/RedWine.png differ diff --git a/Buffs/Fabsol/Rum.cs b/Buffs/Fabsol/Rum.cs new file mode 100644 index 0000000000..e5c24720f2 --- /dev/null +++ b/Buffs/Fabsol/Rum.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Rum.png b/Buffs/Fabsol/Rum.png new file mode 100644 index 0000000000..ed16ae3277 Binary files /dev/null and b/Buffs/Fabsol/Rum.png differ diff --git a/Buffs/Fabsol/Screwdriver.cs b/Buffs/Fabsol/Screwdriver.cs new file mode 100644 index 0000000000..109346929b --- /dev/null +++ b/Buffs/Fabsol/Screwdriver.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Screwdriver.png b/Buffs/Fabsol/Screwdriver.png new file mode 100644 index 0000000000..f8eff84972 Binary files /dev/null and b/Buffs/Fabsol/Screwdriver.png differ diff --git a/Buffs/Fabsol/StarBeamRye.cs b/Buffs/Fabsol/StarBeamRye.cs new file mode 100644 index 0000000000..04dae08746 --- /dev/null +++ b/Buffs/Fabsol/StarBeamRye.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class StarBeamRye : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Star Beam Rye"); + Description.SetDefault("Max mana, magic damage, and magic critical strike chance boosted, defense, mana usage, 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).starBeamRye = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Fabsol/StarBeamRye.png b/Buffs/Fabsol/StarBeamRye.png new file mode 100644 index 0000000000..469bf8b6c8 Binary files /dev/null and b/Buffs/Fabsol/StarBeamRye.png differ diff --git a/Buffs/Fabsol/Tequila.cs b/Buffs/Fabsol/Tequila.cs new file mode 100644 index 0000000000..14a786a82f --- /dev/null +++ b/Buffs/Fabsol/Tequila.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Tequila.png b/Buffs/Fabsol/Tequila.png new file mode 100644 index 0000000000..e93e1d68f1 Binary files /dev/null and b/Buffs/Fabsol/Tequila.png differ diff --git a/Buffs/Fabsol/TequilaSunrise.cs b/Buffs/Fabsol/TequilaSunrise.cs new file mode 100644 index 0000000000..7e5f88d945 --- /dev/null +++ b/Buffs/Fabsol/TequilaSunrise.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/TequilaSunrise.png b/Buffs/Fabsol/TequilaSunrise.png new file mode 100644 index 0000000000..10777fd43d Binary files /dev/null and b/Buffs/Fabsol/TequilaSunrise.png differ diff --git a/Buffs/Fabsol/Vodka.cs b/Buffs/Fabsol/Vodka.cs new file mode 100644 index 0000000000..000840da4d --- /dev/null +++ b/Buffs/Fabsol/Vodka.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Vodka.png b/Buffs/Fabsol/Vodka.png new file mode 100644 index 0000000000..47e680eede Binary files /dev/null and b/Buffs/Fabsol/Vodka.png differ diff --git a/Buffs/Fabsol/Whiskey.cs b/Buffs/Fabsol/Whiskey.cs new file mode 100644 index 0000000000..fbb02965a1 --- /dev/null +++ b/Buffs/Fabsol/Whiskey.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/Whiskey.png b/Buffs/Fabsol/Whiskey.png new file mode 100644 index 0000000000..1c05b68602 Binary files /dev/null and b/Buffs/Fabsol/Whiskey.png differ diff --git a/Buffs/Fabsol/WhiteWine.cs b/Buffs/Fabsol/WhiteWine.cs new file mode 100644 index 0000000000..34eab1bc25 --- /dev/null +++ b/Buffs/Fabsol/WhiteWine.cs @@ -0,0 +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 diff --git a/Buffs/Fabsol/WhiteWine.png b/Buffs/Fabsol/WhiteWine.png new file mode 100644 index 0000000000..d294938dde Binary files /dev/null and b/Buffs/Fabsol/WhiteWine.png differ diff --git a/Buffs/FishAlert.cs b/Buffs/FishAlert.cs index 4f0df49827..265b5cf021 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 = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).fishAlert = true; - } - } +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 = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).fishAlert = true; + } + } } \ No newline at end of file diff --git a/Buffs/Fox.cs b/Buffs/Fox.cs index b58bf766c7..c6baa121a5 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); - } - } - } +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 diff --git a/Buffs/FungalClump.cs b/Buffs/FungalClump.cs index ffcff9d8d1..1a28870815 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; - } - } - } +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 diff --git a/Buffs/GlacialState.cs b/Buffs/GlacialState.cs index dad38be9da..b0f7c43111 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; - } - } +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 diff --git a/Buffs/GodSlayerCooldown.cs b/Buffs/GodSlayerCooldown.cs index 74fde54d7d..00927198f9 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; - } - } +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 diff --git a/Buffs/GodSlayerInferno.cs b/Buffs/GodSlayerInferno.cs index 8d499acb07..87adf6d5e4 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/GraxDefense.cs b/Buffs/GraxDefense.cs index af34777bf4..ae8f9634b1 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; - } - } +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 diff --git a/Buffs/HeartAttack.cs b/Buffs/HeartAttack.cs index 85ac07b132..2410e70e9d 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 life regen and 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; - } - } +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 life regen and 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 diff --git a/Buffs/Herring.cs b/Buffs/Herring.cs index 301d6c22ce..19e8c28aa7 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; - } - } - } +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 diff --git a/Buffs/HolyInferno.cs b/Buffs/HolyInferno.cs index 40933320d1..8ddcde31f7 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 God!"); - 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; - } - } +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 God!"); + 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 diff --git a/Buffs/HolyLight.cs b/Buffs/HolyLight.cs index 26fa4dbb76..4ddea2d2d4 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/Horror.cs b/Buffs/Horror.cs index 4930fc888e..9424c27803 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 = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).horror = true; - } - } +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 = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).horror = true; + } + } } \ No newline at end of file diff --git a/Buffs/HotE.cs b/Buffs/HotE.cs new file mode 100644 index 0000000000..f4c6a52298 --- /dev/null +++ b/Buffs/HotE.cs @@ -0,0 +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 diff --git a/Buffs/HotE.png b/Buffs/HotE.png new file mode 100644 index 0000000000..a2af725949 Binary files /dev/null and b/Buffs/HotE.png differ diff --git a/Buffs/IceClasper.cs b/Buffs/IceClasper.cs index efa3ab84c0..78a0bdd181 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; - } - } - } +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 diff --git a/Buffs/IceShieldBrokenBuff.cs b/Buffs/IceShieldBrokenBuff.cs index 20de3ae9ed..d7ca6e61b2 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; - } - } +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 diff --git a/Buffs/IceShieldBuff.cs b/Buffs/IceShieldBuff.cs index 08bd14442a..c4f97e1604 100644 --- a/Buffs/IceShieldBuff.cs +++ b/Buffs/IceShieldBuff.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 IceShieldBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Shield"); - Description.SetDefault("The shield will absorb 50% damage from one hit before breaking"); - 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).sirenIce = true; - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class IceShieldBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Shield"); + Description.SetDefault("The shield will absorb 50% damage from one hit before breaking"); + 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).sirenIce = true; + } + } } \ No newline at end of file diff --git a/Buffs/Invincible.cs b/Buffs/Invincible.cs index c26bb7e2e4..c053165f19 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; - } - } +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 diff --git a/Buffs/Irradiated.cs b/Buffs/Irradiated.cs index 1fecf81a8a..c7caa9a35d 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("Irradiated"); - 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; - } - } +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("Irradiated"); + 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 diff --git a/Buffs/Levi.cs b/Buffs/Levi.cs index d3ace67221..17b0bad31a 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); - } - } - } +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 diff --git a/Buffs/MarkedforDeath.cs b/Buffs/MarkedforDeath.cs index 46401260c6..6eef570d92 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/Mechworm.cs b/Buffs/Mechworm.cs index 741f27e882..e053f146c6 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; - } - } - } +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 diff --git a/Buffs/Molten.cs b/Buffs/Molten.cs index e4c2197c0d..0af9842656 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; - } - } +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 diff --git a/Buffs/Mushy.cs b/Buffs/Mushy.cs index 526729dd54..96a3e60371 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 by 10 and increased life regen by 5"); - 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; - } - } +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 by 10 and increased life regen by 5"); + 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 diff --git a/Buffs/NOU.cs b/Buffs/NOU.cs index 8ba7318b53..80d7ac629a 100644 --- a/Buffs/NOU.cs +++ b/Buffs/NOU.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 NOU : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("NO U"); - Description.SetDefault("O"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).NOU = true; - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class NOU : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("NO U"); + Description.SetDefault("O"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).NOU = true; + } + } } \ No newline at end of file diff --git a/Buffs/Nightwither.cs b/Buffs/Nightwither.cs index 0dd4844a2d..823d3e8851 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; - } - } +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 diff --git a/Buffs/Omniscience.cs b/Buffs/Omniscience.cs index d9f6dae148..d4119cc1bf 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; - } - } +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 diff --git a/Buffs/Permafrost/ConcoctionCooldown.cs b/Buffs/Permafrost/ConcoctionCooldown.cs index 17d2f47c0c..95d141815e 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 ee78e5c2b7..fd870ee38e 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/Phantom.cs b/Buffs/Phantom.cs index da0f3d9170..5fb83c1d77 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; - } - } - } +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 diff --git a/Buffs/Plague.cs b/Buffs/Plague.cs index 4a0962fbe7..f723a41f5d 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 = true; - } - - 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; - } - } +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 = true; + } + + 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 diff --git a/Buffs/RageMode.cs b/Buffs/RageMode.cs index 980f9cfa3d..8ef69f3d1b 100644 --- a/Buffs/RageMode.cs +++ b/Buffs/RageMode.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 RageMode : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Rage Mode"); - Description.SetDefault("100% (400% in Death Mode) increased damage. Can be boosted by other items up to 160% (640% in Death Mode)."); - 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).rageMode = true; - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class RageMode : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rage Mode"); + Description.SetDefault("100% (400% in Death Mode) increased damage. Can be boosted by other items up to 160% (640% in Death Mode)."); + 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).rageMode = true; + } + } } \ No newline at end of file diff --git a/Buffs/ReaverOrb.cs b/Buffs/ReaverOrb.cs index 53684d4c44..589c73583b 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; - } - } - } +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 diff --git a/Buffs/ReaverRage.cs b/Buffs/ReaverRage.cs index 8a6d04d7fd..31c1a0f58a 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; - } - } +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 diff --git a/Buffs/RedDevil.cs b/Buffs/RedDevil.cs index 7ef907199c..6f67dd2970 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; - } - } - } +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 diff --git a/Buffs/Sandnado.cs b/Buffs/Sandnado.cs index 9b542ed46d..5d34cb0894 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; - } - } - } +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 diff --git a/Buffs/SandyWaifu.cs b/Buffs/SandyWaifu.cs index 459e104f0c..b345cfba66 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("Sandy Waifu"); - 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; - } - } - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sandy Waifu"); + 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 diff --git a/Buffs/ScarfCooldown.cs b/Buffs/ScarfCooldown.cs index 083aa42fa2..27d4936d28 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; - } - } +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 diff --git a/Buffs/ScarfMeleeBoost.cs b/Buffs/ScarfMeleeBoost.cs index 3da7d40ede..fc7bd4e87d 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 melee damage, crit chance, and 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; - } - } +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, crit chance, and 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 diff --git a/Buffs/ShellBoost.cs b/Buffs/ShellBoost.cs index 98b94366b3..06eabc4b27 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; - } - } +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 diff --git a/Buffs/Shred.cs b/Buffs/Shred.cs index bfd93ca63c..907547948d 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; - } - } +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 diff --git a/Buffs/SilvaCrystal.cs b/Buffs/SilvaCrystal.cs index d3d0766f05..4df0285150 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; - } - } - } +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 diff --git a/Buffs/SilvaStun.cs b/Buffs/SilvaStun.cs index a8ab2002da..40b17c4376 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; - } - } +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 diff --git a/Buffs/SirenBobs.cs b/Buffs/SirenBobs.cs index 7b8d8f51e0..bd23e2db4f 100644 --- a/Buffs/SirenBobs.cs +++ b/Buffs/SirenBobs.cs @@ -1,56 +1,56 @@ -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 ? 10 : 0) + - (NPC.downedMoonlord ? 15 : 0); - player.detectCreature = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (Main.hardMode ? 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--; - } - } - } +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 ? 10 : 0) + + (NPC.downedMoonlord ? 15 : 0); + player.detectCreature = true; + player.lifeRegen += 0 + + (NPC.downedBoss3 ? 1 : 0) + + (Main.hardMode ? 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 diff --git a/Buffs/SirenBobsAlt.cs b/Buffs/SirenBobsAlt.cs index f4f6f21708..fd241e1d28 100644 --- a/Buffs/SirenBobsAlt.cs +++ b/Buffs/SirenBobsAlt.cs @@ -1,56 +1,56 @@ -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 ? 10 : 0) + - (NPC.downedMoonlord ? 15 : 0); - player.dangerSense = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (Main.hardMode ? 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--; - } - } - } +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 ? 10 : 0) + + (NPC.downedMoonlord ? 15 : 0); + player.dangerSense = true; + player.lifeRegen += 0 + + (NPC.downedBoss3 ? 1 : 0) + + (Main.hardMode ? 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 diff --git a/Buffs/SirenLure.cs b/Buffs/SirenLure.cs index 2c2d13778f..698bee1b82 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 Lure"); - Description.SetDefault("The siren lure 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; - } - } - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SirenLure : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren Lure"); + Description.SetDefault("The siren lure 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 diff --git a/Buffs/SirenWaterSpeed.cs b/Buffs/SirenWaterSpeed.cs index d0001aa99c..b849df2745 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; - } - } +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 diff --git a/Buffs/SlimeGod.cs b/Buffs/SlimeGod.cs index ff70719d10..ad945b56fc 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; - } - } - } +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 diff --git a/Buffs/SolarSpirit.cs b/Buffs/SolarSpirit.cs index c108b9333b..0fed3e68cd 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; - } - } - } +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 diff --git a/Buffs/SolarSpiritGod.cs b/Buffs/SolarSpiritGod.cs index 6f8e31eecb..dbaeecce4a 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; - } - } - } +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 diff --git a/Buffs/SpiritGeneratorAtkBuff.cs b/Buffs/SpiritGeneratorAtkBuff.cs index deeb01f5f0..3725707001 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; - } - } +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 diff --git a/Buffs/SpiritGeneratorDefBuff.cs b/Buffs/SpiritGeneratorDefBuff.cs index aa1db864d3..f7dca0166b 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; - } - } +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 diff --git a/Buffs/SpiritGeneratorRegenBuff.cs b/Buffs/SpiritGeneratorRegenBuff.cs index 62183488e7..1d2f59e961 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; - } - } +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 diff --git a/Buffs/SquishyBeanBuff.cs b/Buffs/SquishyBeanBuff.cs index 8549e7e25f..2b2cc3f930 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 112dd4d8aa..dad3805517 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); - } - } - } +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 diff --git a/Buffs/TarraLifeRegen.cs b/Buffs/TarraLifeRegen.cs index 897ee22ec3..35a435dd19 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; - } - } +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 diff --git a/Buffs/TemporalSadness.cs b/Buffs/TemporalSadness.cs index beffbf113d..a961dc747a 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; - } - } +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 diff --git a/Buffs/TitanScale.cs b/Buffs/TitanScale.cs index 2f07037ecc..fb005644e6 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; - } - } +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 diff --git a/Buffs/TyrantsFury.cs b/Buffs/TyrantsFury.cs index b6a1f14722..6a7a2c796e 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 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; - } - } +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 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 diff --git a/Buffs/Urchin.cs b/Buffs/Urchin.cs index f6f28bac89..aa8b477e31 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; - } - } - } +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 diff --git a/Buffs/Valkyrie.cs b/Buffs/Valkyrie.cs index 89dd5d0b53..13f22b836f 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; - } - } - } +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 diff --git a/Buffs/VulnerabilityHex.cs b/Buffs/VulnerabilityHex.cs index 1cc16b6502..6e1ecd3b3e 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 = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).vHex = true; - } - } +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 = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).vHex = true; + } + } } \ No newline at end of file diff --git a/Buffs/Warped.cs b/Buffs/Warped.cs index 233afb1ac7..bed1503f88 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 = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).warped = true; - } - } +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 = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).warped = true; + } + } } \ No newline at end of file diff --git a/Buffs/Warped.png b/Buffs/Warped.png index c02c223022..a22ac4bb1c 100644 Binary files a/Buffs/Warped.png and b/Buffs/Warped.png differ diff --git a/Buffs/WeakPetrification.cs b/Buffs/WeakPetrification.cs index 22538abed6..d9c37a78aa 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 = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).weakPetrification = true; - } - } +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 = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).weakPetrification = true; + } + } } \ No newline at end of file diff --git a/Buffs/WhisperingDeath.cs b/Buffs/WhisperingDeath.cs index 6a6dc22dfb..2eda8ed3b8 100644 --- a/Buffs/WhisperingDeath.cs +++ b/Buffs/WhisperingDeath.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 WhisperingDeath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Whispering Death"); - Description.SetDefault("Death approaches"); - 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).wDeath = true; - } - } +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"); + 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).wDeath = true; + } + } } \ No newline at end of file diff --git a/Buffs/XerocRage.cs b/Buffs/XerocRage.cs index 5e055196e0..a65918ded2 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; - } - } +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 diff --git a/Buffs/XerocWrath.cs b/Buffs/XerocWrath.cs index 30dd20842a..f9d778b81e 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; - } - } +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 diff --git a/Buffs/YharimPower.cs b/Buffs/YharimPower.cs index c0859c7571..5c45153e68 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; - } - } +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 diff --git a/Buffs/Zen.cs b/Buffs/Zen.cs index 0bdea8c5ba..a4987ad97e 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; - } - } +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 diff --git a/Buffs/Zerg.cs b/Buffs/Zerg.cs index 135aa1e660..aafdfdf889 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; - } - } +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 diff --git a/CalamityMod.cs b/CalamityMod.cs index 7ce60b42f6..0a780c9336 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,1894 +1,2484 @@ -using System; -using System.Collections.Generic; -using System.IO; -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.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; - -namespace CalamityMod -{ - public class CalamityMod : Mod - { - 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; - - public static int ghostKillCount = 0; - - public static int sharkKillCount = 0; - - //public static int musicStartTimer = 300; - - //public static float musicVolumeOriginal = 0.75f; - - 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 CalamityMod Instance; - - public static Effect CustomShader; - - public CalamityMod() - { - Instance = this; - /*Properties = new ModProperties() - { - Autoload = true, - AutoloadSounds = true, - AutoloadGores = true - };*/ - } - - public override void Load() - { - Main.tile = new Tile[8401, 2601]; - Main.Map = new Terraria.Map.WorldMap(Main.maxTilesX, 2601); - heartOriginal2 = Main.heartTexture; - heartOriginal = Main.heart2Texture; - rainOriginal = Main.rainTexture; - manaOriginal = Main.manaTexture; - carpetOriginal = Main.flyingCarpetTexture; - 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) - { - //Main.music[MusicID.Hell] = GetMusic("Sounds/Music/Crag"); - - 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"); - - AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); - AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); - AstralSky = GetTexture("ExtraTextures/AstralSky"); - CustomShader = GetEffect("Effects/CustomShader"); - - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"), ItemType("CryogenMusicbox"), TileType("CryogenMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"), ItemType("CalamitasMusicbox"), TileType("CalamitasMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"), ItemType("DoGMusicbox"), TileType("DoGMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"), ItemType("SulphurousMusicbox"), TileType("SulphurousMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"), ItemType("HigherAbyssMusicbox"), TileType("HigherAbyssMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"), ItemType("PlaguebringerMusicbox"), TileType("PlaguebringerMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"), ItemType("AquaticScourgeMusicbox"), TileType("AquaticScourgeMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"), ItemType("AstrageldonMusicbox"), TileType("AstrageldonMusicbox")); - //AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralMusicbox"), TileType("AstralMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"), ItemType("PolterghastMusicbox"), TileType("PolterghastMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"), ItemType("SignusMusicbox"), TileType("SignusMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"), ItemType("StormWeaverMusicbox"), TileType("StormWeaverMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"), ItemType("HiveMindMusicbox"), TileType("HiveMindMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"), ItemType("PerforatorMusicbox"), TileType("PerforatorMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Void"), ItemType("CeaselessVoidMusicbox"), TileType("CeaselessVoidMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"), ItemType("DesertScourgeMusicbox"), TileType("DesertScourgeMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"), ItemType("CrabulonMusicbox"), TileType("CrabulonMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"), ItemType("SlimeGodMusicbox"), TileType("SlimeGodMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"), ItemType("ProvidenceMusicbox"), TileType("ProvidenceMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"), ItemType("ProfanedGuardianMusicbox"), TileType("ProfanedGuardianMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"), ItemType("RavagerMusicbox"), TileType("RavagerMusicbox")); - AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralSurfaceMusicBox"), TileType("AstralSurfaceMusicBox")); - - 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); - base.Load(); - } - - BossHealthBarManager.Load(this); - base.Load(); - - Injections.Load(); - base.Load(); - - #region Text - ModTranslation text = CreateTranslation("SkyOreText"); - text.SetDefault("The ground is glittering with cyan light."); - AddTranslation(text); - - text = CreateTranslation("IceOreText"); - text.SetDefault("The ice caves are crackling with frigid energy."); - AddTranslation(text); - - text = CreateTranslation("PlantOreText"); - text.SetDefault("Energized plant matter has formed in the underground."); - AddTranslation(text); - - text = CreateTranslation("TreeOreText"); - text.SetDefault("Fossilized tree bark is bursting through the jungle's mud."); - AddTranslation(text); - - text = CreateTranslation("AuricOreText"); - text.SetDefault("A godly aura has blessed the world's caverns."); - AddTranslation(text); - - text = CreateTranslation("FutureOreText"); - text.SetDefault("A cold and dark energy has materialized in space."); - AddTranslation(text); - - text = CreateTranslation("UglyBossText"); - text.SetDefault("Calamitous creatures now roam free!"); - AddTranslation(text); - - text = CreateTranslation("UglyBossText2"); - text.SetDefault("The ancient ice spirits have been unbound!"); - AddTranslation(text); - - text = CreateTranslation("SteelSkullBossText"); - text.SetDefault("A blood red inferno lingers in the night..."); - AddTranslation(text); - - text = CreateTranslation("PlantBossText"); - text.SetDefault("The ocean depths are trembling."); - AddTranslation(text); - - text = CreateTranslation("BabyBossText"); - text.SetDefault("A plague has befallen the Jungle."); - AddTranslation(text); - - text = CreateTranslation("BabyBossText2"); - text.SetDefault("An ancient automaton roams the land."); - AddTranslation(text); - - text = CreateTranslation("MoonBossText"); - text.SetDefault("The profaned flame blazes fiercely!"); - AddTranslation(text); - - text = CreateTranslation("MoonBossText2"); - text.SetDefault("Cosmic terrors are watching..."); - AddTranslation(text); - - text = CreateTranslation("MoonBossText3"); - text.SetDefault("The bloody moon beckons..."); - AddTranslation(text); - - text = CreateTranslation("PlagueBossText"); - text.SetDefault("PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!"); - AddTranslation(text); - - text = CreateTranslation("PlagueBossText2"); - text.SetDefault("MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!"); - AddTranslation(text); - - text = CreateTranslation("ProfanedBossText"); - text.SetDefault("The air is burning..."); - AddTranslation(text); - - text = CreateTranslation("ProfanedBossText2"); - text.SetDefault("Shrieks are echoing from the dungeon."); - AddTranslation(text); - - text = CreateTranslation("ProfanedBossText3"); - text.SetDefault("The calamitous beings have been inundated with bloodstone."); - AddTranslation(text); - - text = CreateTranslation("GhostBossText"); - text.SetDefault("The abyssal spirits have been disturbed."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText3"); //start - text.SetDefault("Alright, let's get started. Not sure why you're bothering."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText4"); //75% - text.SetDefault("You seem so confident...yet painfully ignorant of what has yet to transpire."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText5"); //50% - text.SetDefault("Couldn't leave well enough alone could you? Everything was going well until you came along."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText6"); //45% - text.SetDefault("Brothers, could you assist me for a moment? Dealing with this fool is growing tiresome."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText"); //40% - text.SetDefault("Don't worry, I still have plenty of tricks left."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText7"); //30% - text.SetDefault("Hmm...perhaps I should let the little ones out to play for a while."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText8"); //20% - text.SetDefault("Impressive...but still not good enough!"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText9"); //10% - text.SetDefault("I'm just getting started!"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText20"); //8% - text.SetDefault("What!? How are you still alive!?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText21"); //6% - text.SetDefault("Just stop!"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText22"); //4% - text.SetDefault("Even if you defeat me you still have my lord to contend with!"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText23"); //2% - text.SetDefault("To this day he has yet to lose a battle!"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText24"); //1% - text.SetDefault("Not even I could defeat him! What hope do YOU have!?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText25"); //1% after 10 seconds - text.SetDefault("He has grown far stronger since we fought...I can't see you defeating him, at least not with your current strength."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText26"); //1% after 15 seconds - text.SetDefault("Well...I guess this is the end..."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText27"); //1% after first win - text.SetDefault("Perhaps one of these times I'll change my mind after all these deaths..."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText28"); //not taking enough damage - text.SetDefault("You aren't hurting as much as I'd like...are you cheating? trollface.png"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText29"); //getting hit too much - text.SetDefault("You got hit too many times...noice. Did you take lessons from Leviathan?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText2"); //cheater - text.SetDefault("Go to hell."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText10"); //end after 20 seconds - text.SetDefault("At long last I am free...no...wait. I'll just keep coming back, like you. Funny how that works...isn't it?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText11"); //rebattle after killing once - text.SetDefault("Do you enjoy going through hell?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText12"); //rebattle after killing four times - text.SetDefault("Don't get me wrong, I like pain too, but you're just ridiculous."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText13"); //rebattle five deaths - text.SetDefault("You must enjoy dying more than most people, huh?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText14"); //rebattle twenty deaths - text.SetDefault("Do you have a fetish for getting killed or something?"); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText15"); //rebattle fifty deaths - text.SetDefault("Alright, I'm done counting. You probably died this much just to see what I'd say."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText16"); //die 0 times - text.SetDefault("You didn't die at all huh? Welp, you probably cheated then. Do it again, for real this time...but here's your reward I guess."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText17"); //die 1 time and win - text.SetDefault("One death? That's it? ...I guess you earned this then."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText18"); //die 2 times and win - text.SetDefault("Two deaths. Good job. Here's your reward."); - AddTranslation(text); - - text = CreateTranslation("SupremeBossText19"); //die 3 times and win - text.SetDefault("Third time's the charm huh? I guess it is. Here's a special reward."); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText"); - text.SetDefault("Don't get cocky, kid!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText2"); - text.SetDefault("You think...you can butcher...ME!?"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText3"); - text.SetDefault("A fatal mistake!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText4"); - text.SetDefault("Good luck recovering from that!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText5"); - text.SetDefault("Delicious..."); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText6"); - text.SetDefault("Did that hurt?"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText7"); - text.SetDefault("Nothing personal, kid."); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText8"); - text.SetDefault("Are you honestly that bad at dodging?"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText9"); - text.SetDefault("Of all my segments to get hit by..."); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText10"); - text.SetDefault("It's not over yet, kid!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText11"); - text.SetDefault("A GOD DOES NOT FEAR DEATH!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText12"); - text.SetDefault("You are no god...but I shall feast upon your essence regardless!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText13"); - text.SetDefault("SO WEAK!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText14"); - text.SetDefault("YOU FOOL!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText15"); - text.SetDefault("DOES IT HURT!?"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText16"); - text.SetDefault("WHY DIDN'T YOU DODGE!?"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText17"); - text.SetDefault("NO! I AM THE ONE ABOVE ALL! I WILL CONSUME YOUR UNIVERSE!"); - AddTranslation(text); - - text = CreateTranslation("EdgyBossText18"); - text.SetDefault("YOU CAN'T BUTCHER A GOD!"); - AddTranslation(text); - - text = CreateTranslation("DoGBossText"); - text.SetDefault("The frigid moon shimmers brightly."); - AddTranslation(text); - - text = CreateTranslation("DoGBossText2"); - text.SetDefault("The harvest moon glows eerily."); - AddTranslation(text); - - text = CreateTranslation("AstralText"); - text.SetDefault("A star has fallen from the heavens!"); - AddTranslation(text); - - text = CreateTranslation("AstralBossText"); - text.SetDefault("The seal of the stars has been broken! You can now mine Astral Ore!"); - AddTranslation(text); - - text = CreateTranslation("CalamitasBossText"); - text.SetDefault("You underestimate my power..."); - AddTranslation(text); - - text = CreateTranslation("CalamitasBossText2"); - text.SetDefault("The brothers have awoken!"); - AddTranslation(text); - - text = CreateTranslation("CalamitasBossText3"); - text.SetDefault("Impressive child, most impressive..."); - AddTranslation(text); - - text = CreateTranslation("CalamitasBossText4"); - text.SetDefault("The brothers have been reborn!"); - AddTranslation(text); - - text = CreateTranslation("CryogenBossText"); - text.SetDefault("Cryogen is derping out!"); - AddTranslation(text); - - text = CreateTranslation("BloodMoonText"); - text.SetDefault("The Blood Moon is rising..."); - AddTranslation(text); - - text = CreateTranslation("DargonBossText"); - text.SetDefault("The dark sun awaits."); - AddTranslation(text); - - text = CreateTranslation("DargonBossText2"); - text.SetDefault("My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power."); - AddTranslation(text); - - text = CreateTranslation("DargonBossText3"); - text.SetDefault("My dragon deems you an unworthy opponent. Snuff out the profaned flame and destroy the god devourer to witness his true power."); - AddTranslation(text); - - text = CreateTranslation("DeathText"); - text.SetDefault("Death is active, enjoy the fun."); - AddTranslation(text); - - text = CreateTranslation("DeathText2"); - text.SetDefault("Death is not active, not fun enough for you?"); - AddTranslation(text); - - text = CreateTranslation("ArmageddonText"); - text.SetDefault("Bosses will now kill you instantly."); - AddTranslation(text); - - text = CreateTranslation("ArmageddonText2"); - text.SetDefault("Bosses will no longer kill you instantly."); - AddTranslation(text); - - text = CreateTranslation("DefiledText"); - text.SetDefault("Your soul is mine..."); - AddTranslation(text); - - text = CreateTranslation("DefiledText2"); - text.SetDefault("Your soul is yours once more..."); - AddTranslation(text); - - text = CreateTranslation("FlameText"); - text.SetDefault("The air is getting warmer around you."); - AddTranslation(text); - - text = CreateTranslation("BossRushStartText"); - text.SetDefault("Hmm? Ah, another contender. Very well, may the ritual commence!"); - AddTranslation(text); - - text = CreateTranslation("BossRushTierOneEndText"); - text.SetDefault("Hmm? Oh, you're still alive. Unexpected and exhilarating, but don't get complacent just yet."); - AddTranslation(text); - - text = CreateTranslation("BossRushTierTwoEndText"); - text.SetDefault("Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers."); - AddTranslation(text); - - text = CreateTranslation("BossRushTierThreeEndText"); - text.SetDefault("Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time."); - AddTranslation(text); - - text = CreateTranslation("BossRushTierThreeEndText2"); - text.SetDefault("May your skills remain sharp for the last challenges."); - AddTranslation(text); - - text = CreateTranslation("BossRushTierFourEndText"); - text.SetDefault("Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods."); - AddTranslation(text); - - text = CreateTranslation("BossRushTierFourEndText2"); - text.SetDefault("Go forth and conquer 'til the ritual's end!"); - AddTranslation(text); - - text = CreateTranslation("BossRushTierFiveEndText"); - text.SetDefault("Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will come apparent in time..."); - AddTranslation(text); - #endregion - } - - public override void Unload() - { - AstralCactusTexture = null; - AstralCactusGlowTexture = null; - AstralSky = null; - RageHotKey = null; - AdrenalineHotKey = null; - AegisHotKey = null; - TarraHotKey = null; - AstralTeleportHotKey = null; - AstralArcanumUIHotkey = null; - BossBarToggleHotKey = null; - BossBarToggleSmallTextHotKey = null; - BossHealthBarManager.Unload(); - base.Unload(); - AstralArcanumUI.Unload(); - base.Unload(); - Instance = null; - Injections.Unload(); - base.Unload(); - if (!Main.dedServ) - { - Main.music[MusicID.Hell] = Main.soundBank.GetCue("Music_" + MusicID.Hell); - Main.heartTexture = heartOriginal2; - Main.heart2Texture = heartOriginal; - Main.rainTexture = rainOriginal; - Main.manaTexture = manaOriginal; - Main.flyingCarpetTexture = carpetOriginal; - } - } - - public override void UpdateMusic(ref int music, ref MusicPriority priority) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (Main.musicVolume != 0) - { - if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) - { - if (NPC.AnyNPCs(NPCID.CultistBoss)) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Doomsayer"); priority = MusicPriority.BossMedium; - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); priority = MusicPriority.Environment; } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); priority = MusicPriority.BiomeHigh; } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer1 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer2) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); priority = MusicPriority.BiomeHigh; } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer3 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer4) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); priority = MusicPriority.BiomeHigh; } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneSulphur) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); priority = MusicPriority.BiomeHigh; } - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 540 && CalamityGlobalNPC.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); priority = MusicPriority.BossMedium; - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) - { - if (!CalamityGlobalNPC.AnyBossNPCS()) { music = GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); priority = MusicPriority.BiomeHigh; } - } - } - } - } - - public override void PostSetupContent() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - if (bossChecklist != null) - { - #region NormalModes - // 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", "Astrageldon Slime", 10.55f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.25 - bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 10.6f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] 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", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 - 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", "Bumblebirb", 16.5f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome or find it in the Jungle Biome"); //16 - 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 - #endregion - } - } - - #region DrawingStuff - public override void ModifyInterfaceLayers(List layers) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (CalamityWorld.revenge) - { - 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 - - public override void AddRecipeGroups() - { - RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + (" Silt"), new int[] - { - 424, - 1103 - }); - RecipeGroup.RegisterGroup("SiltGroup", group); - group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Pickaxe"), new int[] - { - 2776, - 2781, - 2786, - 3466 - }); - RecipeGroup.RegisterGroup("LunarPickaxe", group); - group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Axe"), new int[] - { - 3522, - 3523, - 3524, - 3525 - }); - RecipeGroup.RegisterGroup("LunarAxe", group); - group = new RecipeGroup(() => Lang.misc[37] + (" Wings"), new int[] - { - 492, - 493, - 665, - 749, - 761, - 785, - 786, - 821, - 822, - 823, - 948, - 1162, - 1165, - 1515, - 1583, - 1584, - 1585, - 1586, - 1797, - 1830, - 1871, - 2280, - 2494, - 2609, - 2770, - 3468, - 3469, - 3470, - 3471, - 3580, - 3582, - 3588, - 3592, - 3883, - ItemType("SkylineWings"), - ItemType("StarlightWings"), - ItemType("AureateWings"), - ItemType("DiscordianWings"), - ItemType("TarragonWings"), - ItemType("XerocWings") - }); - RecipeGroup.RegisterGroup("WingsGroup", group); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.SunplateBlock, 10); - recipe.AddIngredient(ItemID.Cloud, 5); - recipe.AddIngredient(ItemID.RainCloud, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.SkyMill); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IceBlock, 20); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(ItemID.IceSkates); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IceBlock, 20); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ItemID.LeadBar, 5); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(ItemID.IceSkates); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Lens); - recipe.AddIngredient(ItemID.BlackDye); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(ItemID.BlackLens); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Vertebrae, 5); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(ItemID.Leather); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IceBlock, 25); - recipe.AddIngredient(ItemID.SnowBlock, 15); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.IceMachine); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IceBlock, 25); - recipe.AddIngredient(ItemID.SnowBlock, 15); - recipe.AddIngredient(ItemID.LeadBar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.IceMachine); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.GoldBroadsword); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddIngredient(null, "VictoryShard", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Starfury); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.PlatinumBroadsword); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddIngredient(null, "VictoryShard", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Starfury); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Feather, 2); - recipe.AddIngredient(ItemID.Bottle); - recipe.AddIngredient(ItemID.Cloud, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.CloudinaBottle); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Feather, 4); - recipe.AddIngredient(ItemID.Bottle); - recipe.AddIngredient(ItemID.SnowBlock, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.BlizzardinaBottle); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "DesertFeather", 10); - recipe.AddIngredient(ItemID.Feather, 6); - recipe.AddIngredient(ItemID.Bottle); - recipe.AddIngredient(ItemID.SandBlock, 70); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.SandstorminaBottle); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.WhiteString); - recipe.AddIngredient(ItemID.Gel, 80); - recipe.AddIngredient(ItemID.Cloud, 40); - recipe.AddTile(TileID.Solidifier); - recipe.SetResult(ItemID.ShinyRedBalloon); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ItemID.WaterWalkingPotion, 8); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.WaterWalkingBoots); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LavaBucket, 5); - recipe.AddIngredient(ItemID.Obsidian, 25); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.LavaCharm); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LavaBucket, 5); - recipe.AddIngredient(ItemID.Obsidian, 25); - recipe.AddIngredient(ItemID.LeadBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.LavaCharm); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "CryoBar", 6); - recipe.AddIngredient(ItemID.FrostCore); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(ItemID.FrostHelmet); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "CryoBar", 10); - recipe.AddIngredient(ItemID.FrostCore); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(ItemID.FrostBreastplate); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "CryoBar", 8); - recipe.AddIngredient(ItemID.FrostCore); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(ItemID.FrostLeggings); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.CobaltBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.CobaltShield); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.PalladiumBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.CobaltShield); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.CobaltBar, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Muramasa); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.PalladiumBar, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Muramasa); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "TrueBloodyEdge"); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.TerraBlade); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "Ectoblood", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Ectoplasm); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.EmptyBullet); - recipe.AddIngredient(ItemID.ExplosivePowder, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.RocketI, 5); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "VictoryShard", 10); - recipe.AddIngredient(ItemID.SoulofLight, 15); - recipe.AddIngredient(ItemID.UnicornHorn, 3); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.EnchantedSword); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.WormholePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.WarmthPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.CratePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.SonarPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.FishingPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.TeleportationPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.StinkPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.LovePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.WrathPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.InfernoPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.RagePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.EndurancePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.LifeforcePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.AmmoReservationPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.TrapsightPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.SummoningPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.FlipperPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.TitanPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.BuilderPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.CalmingPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.HeartreachPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.MiningPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.GenderChangePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.GravitationPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.HunterPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.ArcheryPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.WaterWalkingPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.ThornsPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.BattlePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.NightOwlPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.ShinePotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.InvisibilityPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.SpelunkerPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.FeatherfallPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.MagicPowerPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.ManaRegenerationPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.IronskinPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.GillsPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.SwiftnessPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.RegenerationPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(ItemID.ObsidianSkinPotion); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.AncientCloth, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.FlyingCarpet); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LihzahrdBrick, 15); - recipe.AddIngredient(null, "CoreofCinder"); - recipe.AddTile(TileID.LihzahrdFurnace); - recipe.SetResult(ItemID.LihzahrdPowerCell); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.GlowingMushroom, 15); - recipe.AddIngredient(ItemID.Worm); - recipe.AddTile(TileID.Autohammer); - recipe.SetResult(ItemID.TruffleWorm); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Aglet); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LeadBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Aglet); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.JungleSpores, 15); - recipe.AddIngredient(ItemID.Cloud, 15); - recipe.AddIngredient(ItemID.PinkGel, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.AnkletoftheWind); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.SunplateBlock, 10); - recipe.AddIngredient(ItemID.Cloud, 10); - recipe.AddIngredient(ItemID.GoldBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.LuckyHorseshoe); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.SunplateBlock, 10); - recipe.AddIngredient(ItemID.Cloud, 10); - recipe.AddIngredient(ItemID.PlatinumBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.LuckyHorseshoe); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.SoulofLight, 30); - recipe.AddIngredient(ItemID.ChaosFish, 5); - recipe.AddIngredient(ItemID.PixieDust, 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.RodofDiscord); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.TurtleShell, 3); - recipe.AddIngredient(null, "EssenceofEleum", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.FrozenTurtleShell); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(null, "PlantyMush", 10); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.LifeFruit); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.FallenStar, 20); - recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(null, "CryoBar", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.CelestialMagnet); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 1 - recipe.AddIngredient(ItemID.Silk, 20); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.TrifoldMap); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 2 - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(null, "AncientBoneDust", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.ArmorPolish); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 3 - recipe.AddIngredient(ItemID.SoulofNight, 20); - recipe.AddIngredient(ItemID.Lens, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Nazar); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 4 - recipe.AddIngredient(ItemID.Stinger, 15); - recipe.AddIngredient(null, "MurkyPaste"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Bezoar); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 5 - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Waterleaf, 5); - recipe.AddIngredient(ItemID.Blinkroot, 5); - recipe.AddIngredient(ItemID.Daybloom, 5); - recipe.AddIngredient(null, "BeetleJuice", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Vitamins); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 6 - recipe.AddIngredient(ItemID.Silk, 30); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Blindfold); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 7 - recipe.AddIngredient(ItemID.Timer1Second); - recipe.AddIngredient(ItemID.PixieDust, 15); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.FastClock); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 8 - recipe.AddIngredient(ItemID.Wire, 10); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.Ruby, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.Megaphone); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //ankh 9 - recipe.AddIngredient(ItemID.Silk, 10); - recipe.AddIngredient(ItemID.Gel, 50); - recipe.AddIngredient(ItemID.GreaterHealingPotion); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.AdhesiveBandage); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Frog, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.FrogLeg); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //hermesboots - recipe.AddIngredient(ItemID.Silk, 10); - recipe.AddTile(TileID.Loom); - recipe.SetResult(ItemID.HermesBoots); - recipe.AddRecipe(); - recipe = new ModRecipe(this); //radar - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Radar); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LeadBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Radar); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Bone, 5); - recipe.AddIngredient(ItemID.PinkGel); - recipe.AddIngredient(ItemID.HealingPotion); - recipe.AddIngredient(ItemID.Ruby); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.LifeCrystal); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Wood, 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.AddIngredient(ItemID.FallenStar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.WandofSparking); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IronBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.ThrowingKnife, 50); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LeadBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.ThrowingKnife, 50); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.IronBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Shuriken, 50); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.LeadBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.Shuriken, 50); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Leather, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(ItemID.FeralClaws); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddTile(TileID.Hellforge); - recipe.SetResult(ItemID.GuideVoodooDoll); - recipe.AddRecipe(); - recipe = new ModRecipe(this); - recipe.AddIngredient(ItemID.JungleSpores, 15); - recipe.AddIngredient(ItemID.RichMahogany, 15); - recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddIngredient(ItemID.SoulofLight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.TempleKey); - recipe.AddRecipe(); - } - - public override void HandlePacket(BinaryReader reader, int whoAmI) - { - CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - switch (msgType) - { - case CalamityModMessageType.StressSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleStress(reader); - break; - case CalamityModMessageType.Ravager: - int ravagerAlive = reader.ReadInt32(); - CalamityGlobalNPC.scavenger = ravagerAlive; - break; - case CalamityModMessageType.DoG: - int DoGAlive = reader.ReadInt32(); - CalamityGlobalNPC.DoGHead = DoGAlive; - break; - case CalamityModMessageType.Polterghast: - int polterAlive = reader.ReadInt32(); - CalamityGlobalNPC.ghostBoss = polterAlive; - break; - case CalamityModMessageType.LORDE: - int lordeAlive = reader.ReadInt32(); - CalamityGlobalNPC.lordeBoss = lordeAlive; - break; - case CalamityModMessageType.Providence: - int provAlive = reader.ReadInt32(); - CalamityGlobalNPC.holyBoss = provAlive; - break; - case CalamityModMessageType.BossRushStage: - int stage = reader.ReadInt32(); - CalamityPlayer.bossRushStage = stage; - break; - case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleAdrenaline(reader); - break; - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].GetModPlayer().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; - default: - ErrorLogger.Log("CalamityMod: Unknown Message type: " + msgType); - break; - } - } - - public override object Call(params object[] args) - { - return ModSupport.Call(args); - } - } - - enum CalamityModMessageType : byte - { - StressSync, - Ravager, - DoG, - Polterghast, - LORDE, - Providence, - AdrenalineSync, - TeleportPlayer, - BossRushStage - } +using System; +using System.Collections.Generic; +using System.IO; +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; + +namespace CalamityMod +{ + public class CalamityMod : Mod + { + 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; + + public static int ghostKillCount = 0; + + public static int sharkKillCount = 0; + + 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; + + public static List rangedProjectileExceptionList; + + public static List projectileMinionList; + + public static List enemyImmunityList; + + public static List hardModeNerfExceptionList; + + public static List dungeonEnemyBuffList; + + 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 CalamityMod Instance; + + public CalamityMod() + { + Instance = this; + } + + #region Load + public override void Load() + { + Main.tile = new Tile[8401, 2601]; + Main.Map = new Terraria.Map.WorldMap(Main.maxTilesX, 2601); + Main.mapTargetY = 3; + Main.instance.mapTarget = new RenderTarget2D[Main.mapTargetX, Main.mapTargetY]; + Main.initMap = new bool[Main.mapTargetX, Main.mapTargetY]; + Main.mapWasContentLost = new bool[Main.mapTargetX, Main.mapTargetY]; + + heartOriginal2 = Main.heartTexture; + heartOriginal = Main.heart2Texture; + rainOriginal = Main.rainTexture; + manaOriginal = Main.manaTexture; + carpetOriginal = Main.flyingCarpetTexture; + + 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) + { + 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"); + + AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); + AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); + AstralSky = GetTexture("ExtraTextures/AstralSky"); + CustomShader = GetEffect("Effects/CustomShader"); + + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"), ItemType("CryogenMusicbox"), TileType("CryogenMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"), ItemType("CalamitasMusicbox"), TileType("CalamitasMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"), ItemType("DoGMusicbox"), TileType("DoGMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"), ItemType("SulphurousMusicbox"), TileType("SulphurousMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"), ItemType("HigherAbyssMusicbox"), TileType("HigherAbyssMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"), ItemType("PlaguebringerMusicbox"), TileType("PlaguebringerMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"), ItemType("AquaticScourgeMusicbox"), TileType("AquaticScourgeMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"), ItemType("AstrageldonMusicbox"), TileType("AstrageldonMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralMusicbox"), TileType("AstralMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"), ItemType("PolterghastMusicbox"), TileType("PolterghastMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"), ItemType("SignusMusicbox"), TileType("SignusMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"), ItemType("StormWeaverMusicbox"), TileType("StormWeaverMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"), ItemType("HiveMindMusicbox"), TileType("HiveMindMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"), ItemType("PerforatorMusicbox"), TileType("PerforatorMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Void"), ItemType("CeaselessVoidMusicbox"), TileType("CeaselessVoidMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"), ItemType("DesertScourgeMusicbox"), TileType("DesertScourgeMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"), ItemType("CrabulonMusicbox"), TileType("CrabulonMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"), ItemType("SlimeGodMusicbox"), TileType("SlimeGodMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"), ItemType("ProvidenceMusicbox"), TileType("ProvidenceMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"), ItemType("ProfanedGuardianMusicbox"), TileType("ProfanedGuardianMusicbox")); + AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"), ItemType("RavagerMusicbox"), TileType("RavagerMusicbox")); + + 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); + base.Load(); + } + + BossHealthBarManager.Load(this); + base.Load(); + + Injections.Load(); + base.Load(); + + SetupLists(); + + #region Text + ModTranslation text = CreateTranslation("SkyOreText"); + text.SetDefault("The ground is glittering with cyan light."); + AddTranslation(text); + + text = CreateTranslation("IceOreText"); + text.SetDefault("The ice caves are crackling with frigid energy."); + AddTranslation(text); + + text = CreateTranslation("PlantOreText"); + text.SetDefault("Energized plant matter has formed in the underground."); + AddTranslation(text); + + text = CreateTranslation("TreeOreText"); + text.SetDefault("Fossilized tree bark is bursting through the jungle's mud."); + AddTranslation(text); + + text = CreateTranslation("AuricOreText"); + text.SetDefault("A godly aura has blessed the world's caverns."); + AddTranslation(text); + + text = CreateTranslation("FutureOreText"); + text.SetDefault("A cold and dark energy has materialized in space."); + AddTranslation(text); + + text = CreateTranslation("UglyBossText"); + text.SetDefault("Calamitous creatures now roam free!"); + AddTranslation(text); + + text = CreateTranslation("UglyBossText2"); + text.SetDefault("The ancient ice spirits have been unbound!"); + AddTranslation(text); + + text = CreateTranslation("SteelSkullBossText"); + text.SetDefault("A blood red inferno lingers in the night..."); + AddTranslation(text); + + text = CreateTranslation("PlantBossText"); + text.SetDefault("The ocean depths are trembling."); + AddTranslation(text); + + text = CreateTranslation("BabyBossText"); + text.SetDefault("A plague has befallen the Jungle."); + AddTranslation(text); + + text = CreateTranslation("BabyBossText2"); + text.SetDefault("An ancient automaton roams the land."); + AddTranslation(text); + + text = CreateTranslation("MoonBossText"); + text.SetDefault("The profaned flame blazes fiercely!"); + AddTranslation(text); + + text = CreateTranslation("MoonBossText2"); + text.SetDefault("Cosmic terrors are watching..."); + AddTranslation(text); + + text = CreateTranslation("MoonBossText3"); + text.SetDefault("The bloody moon beckons..."); + AddTranslation(text); + + text = CreateTranslation("PlagueBossText"); + text.SetDefault("PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!"); + AddTranslation(text); + + text = CreateTranslation("PlagueBossText2"); + text.SetDefault("MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!"); + AddTranslation(text); + + text = CreateTranslation("ProfanedBossText"); + text.SetDefault("The air is burning..."); + AddTranslation(text); + + text = CreateTranslation("ProfanedBossText2"); + text.SetDefault("Shrieks are echoing from the dungeon."); + AddTranslation(text); + + text = CreateTranslation("ProfanedBossText3"); + text.SetDefault("The calamitous beings have been inundated with bloodstone."); + AddTranslation(text); + + text = CreateTranslation("GhostBossText"); + text.SetDefault("The abyssal spirits have been disturbed."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText3"); //start + text.SetDefault("Alright, let's get started. Not sure why you're bothering."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText4"); //75% + text.SetDefault("You seem so confident...yet painfully ignorant of what has yet to transpire."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText5"); //50% + text.SetDefault("Couldn't leave well enough alone could you? Everything was going well until you came along."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText6"); //45% + text.SetDefault("Brothers, could you assist me for a moment? Dealing with this fool is growing tiresome."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText"); //40% + text.SetDefault("Don't worry, I still have plenty of tricks left."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText7"); //30% + text.SetDefault("Hmm...perhaps I should let the little ones out to play for a while."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText8"); //20% + text.SetDefault("Impressive...but still not good enough!"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText9"); //10% + text.SetDefault("I'm just getting started!"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText20"); //8% + text.SetDefault("What!? How are you still alive!?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText21"); //6% + text.SetDefault("Just stop!"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText22"); //4% + text.SetDefault("Even if you defeat me you still have my lord to contend with!"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText23"); //2% + text.SetDefault("To this day he has yet to lose a battle!"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText24"); //1% + text.SetDefault("Not even I could defeat him! What hope do YOU have!?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText25"); //1% after 10 seconds + text.SetDefault("He has grown far stronger since we fought...I can't see you defeating him, at least not with your current strength."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText26"); //1% after 15 seconds + text.SetDefault("Well...I guess this is the end..."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText27"); //1% after first win + text.SetDefault("Perhaps one of these times I'll change my mind after all these deaths..."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText28"); //not taking enough damage + text.SetDefault("You aren't hurting as much as I'd like...are you cheating?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText2"); //cheater + text.SetDefault("Go to hell."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText10"); //end after 20 seconds + text.SetDefault("At long last I am free...no...wait. I'll just keep coming back, like you. Funny how that works...isn't it?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText11"); //rebattle after killing once + text.SetDefault("Do you enjoy going through hell?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText12"); //rebattle after killing four times + text.SetDefault("Don't get me wrong, I like pain too, but you're just ridiculous."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText13"); //rebattle five deaths + text.SetDefault("You must enjoy dying more than most people, huh?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText14"); //rebattle twenty deaths + text.SetDefault("Do you have a fetish for getting killed or something?"); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText15"); //rebattle fifty deaths + text.SetDefault("Alright, I'm done counting. You probably died this much just to see what I'd say."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText16"); //die 0 times + text.SetDefault("You didn't die at all huh? Welp, you probably cheated then. Do it again, for real this time...but here's your reward I guess."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText17"); //die 1 time and win + text.SetDefault("One death? That's it? ...I guess you earned this then."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText18"); //die 2 times and win + text.SetDefault("Two deaths. Good job. Here's your reward."); + AddTranslation(text); + + text = CreateTranslation("SupremeBossText19"); //die 3 times and win + text.SetDefault("Third time's the charm huh? I guess it is. Here's a special reward."); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText"); + text.SetDefault("Don't get cocky, kid!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText2"); + text.SetDefault("You think...you can butcher...ME!?"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText3"); + text.SetDefault("A fatal mistake!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText4"); + text.SetDefault("Good luck recovering from that!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText5"); + text.SetDefault("Delicious..."); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText6"); + text.SetDefault("Did that hurt?"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText7"); + text.SetDefault("Nothing personal, kid."); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText8"); + text.SetDefault("Are you honestly that bad at dodging?"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText9"); + text.SetDefault("Of all my segments to get hit by..."); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText10"); + text.SetDefault("It's not over yet, kid!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText11"); + text.SetDefault("A GOD DOES NOT FEAR DEATH!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText12"); + text.SetDefault("You are no god...but I shall feast upon your essence regardless!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText13"); + text.SetDefault("SO WEAK!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText14"); + text.SetDefault("YOU FOOL!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText15"); + text.SetDefault("DOES IT HURT!?"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText16"); + text.SetDefault("WHY DIDN'T YOU DODGE!?"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText17"); + text.SetDefault("NO! I AM THE ONE ABOVE ALL! I WILL CONSUME YOUR UNIVERSE!"); + AddTranslation(text); + + text = CreateTranslation("EdgyBossText18"); + text.SetDefault("YOU CAN'T BUTCHER A GOD!"); + AddTranslation(text); + + text = CreateTranslation("DoGBossText"); + text.SetDefault("The frigid moon shimmers brightly."); + AddTranslation(text); + + text = CreateTranslation("DoGBossText2"); + text.SetDefault("The harvest moon glows eerily."); + AddTranslation(text); + + text = CreateTranslation("AstralText"); + text.SetDefault("A star has fallen from the heavens!"); + AddTranslation(text); + + text = CreateTranslation("AstralBossText"); + text.SetDefault("The seal of the stars has been broken! You can now mine Astral Ore!"); + AddTranslation(text); + + text = CreateTranslation("CalamitasBossText"); + text.SetDefault("You underestimate my power..."); + AddTranslation(text); + + text = CreateTranslation("CalamitasBossText2"); + text.SetDefault("The brothers have awoken!"); + AddTranslation(text); + + text = CreateTranslation("CalamitasBossText3"); + text.SetDefault("Impressive child, most impressive..."); + AddTranslation(text); + + text = CreateTranslation("CalamitasBossText4"); + text.SetDefault("The brothers have been reborn!"); + AddTranslation(text); + + text = CreateTranslation("CryogenBossText"); + text.SetDefault("Cryogen is derping out!"); + AddTranslation(text); + + text = CreateTranslation("BloodMoonText"); + text.SetDefault("The Blood Moon is rising..."); + AddTranslation(text); + + text = CreateTranslation("DargonBossText"); + text.SetDefault("The dark sun awaits."); + AddTranslation(text); + + text = CreateTranslation("DargonBossText2"); + text.SetDefault("My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power."); + AddTranslation(text); + + text = CreateTranslation("DargonBossText3"); + text.SetDefault("My dragon deems you an unworthy opponent. Snuff out the profaned flame and destroy the god devourer to witness his true power."); + AddTranslation(text); + + text = CreateTranslation("DeathText"); + text.SetDefault("Death is active, enjoy the fun."); + AddTranslation(text); + + text = CreateTranslation("DeathText2"); + text.SetDefault("Death is not active, not fun enough for you?"); + AddTranslation(text); + + text = CreateTranslation("ArmageddonText"); + text.SetDefault("Bosses will now kill you instantly."); + AddTranslation(text); + + text = CreateTranslation("ArmageddonText2"); + text.SetDefault("Bosses will no longer kill you instantly."); + AddTranslation(text); + + text = CreateTranslation("DefiledText"); + text.SetDefault("Your soul is mine..."); + AddTranslation(text); + + text = CreateTranslation("DefiledText2"); + text.SetDefault("Your soul is yours once more..."); + AddTranslation(text); + + text = CreateTranslation("FlameText"); + text.SetDefault("The air is getting warmer around you."); + AddTranslation(text); + + text = CreateTranslation("BossRushStartText"); + text.SetDefault("Hmm? Ah, another contender. Very well, may the ritual commence!"); + AddTranslation(text); + + text = CreateTranslation("BossRushTierOneEndText"); + text.SetDefault("Hmm? Oh, you're still alive. Unexpected and exhilarating, but don't get complacent just yet."); + AddTranslation(text); + + text = CreateTranslation("BossRushTierTwoEndText"); + text.SetDefault("Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers."); + AddTranslation(text); + + text = CreateTranslation("BossRushTierThreeEndText"); + text.SetDefault("Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time."); + AddTranslation(text); + + text = CreateTranslation("BossRushTierThreeEndText2"); + text.SetDefault("May your skills remain sharp for the last challenges."); + AddTranslation(text); + + text = CreateTranslation("BossRushTierFourEndText"); + text.SetDefault("Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods."); + AddTranslation(text); + + text = CreateTranslation("BossRushTierFourEndText2"); + text.SetDefault("Go forth and conquer 'til the ritual's end!"); + AddTranslation(text); + + text = CreateTranslation("BossRushTierFiveEndText"); + text.SetDefault("Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will come apparent in time..."); + AddTranslation(text); + #endregion + } + #endregion + + #region Unload + public override void Unload() + { + RageHotKey = null; + AdrenalineHotKey = null; + AegisHotKey = null; + TarraHotKey = null; + AstralTeleportHotKey = null; + AstralArcanumUIHotkey = null; + BossBarToggleHotKey = null; + BossBarToggleSmallTextHotKey = null; + + AstralCactusTexture = null; + AstralCactusGlowTexture = null; + AstralSky = null; + + rangedProjectileExceptionList = null; + projectileMinionList = null; + enemyImmunityList = null; + hardModeNerfExceptionList = null; + dungeonEnemyBuffList = null; + bossScaleList = null; + beeEnemyList = null; + beeProjectileList = null; + hardModeNerfList = null; + debuffList = null; + fireWeaponList = null; + natureWeaponList = null; + alcoholList = null; + + BossHealthBarManager.Unload(); + base.Unload(); + + AstralArcanumUI.Unload(); + base.Unload(); + + Instance = null; + + Injections.Unload(); + base.Unload(); + + if (!Main.dedServ) + { + Main.music[MusicID.Hell] = Main.soundBank.GetCue("Music_" + MusicID.Hell); //remove in 1.4.1 + + Main.heartTexture = heartOriginal2; + Main.heart2Texture = heartOriginal; + Main.rainTexture = rainOriginal; + Main.manaTexture = manaOriginal; + Main.flyingCarpetTexture = carpetOriginal; + } + } + #endregion + + #region SetupLists + public static void SetupLists() + { + rangedProjectileExceptionList = new List(); + + rangedProjectileExceptionList.Add(ProjectileID.Phantasm); + rangedProjectileExceptionList.Add(ProjectileID.VortexBeater); + rangedProjectileExceptionList.Add(ProjectileID.DD2PhoenixBow); + + projectileMinionList = new List(); + + projectileMinionList.Add(ProjectileID.PygmySpear); + projectileMinionList.Add(ProjectileID.UFOMinion); + projectileMinionList.Add(ProjectileID.UFOLaser); + projectileMinionList.Add(ProjectileID.StardustCellMinionShot); + projectileMinionList.Add(ProjectileID.MiniSharkron); + projectileMinionList.Add(ProjectileID.MiniRetinaLaser); + projectileMinionList.Add(ProjectileID.ImpFireball); + projectileMinionList.Add(ProjectileID.HornetStinger); + projectileMinionList.Add(ProjectileID.DD2FlameBurstTowerT1Shot); + projectileMinionList.Add(ProjectileID.DD2FlameBurstTowerT2Shot); + projectileMinionList.Add(ProjectileID.DD2FlameBurstTowerT3Shot); + projectileMinionList.Add(ProjectileID.DD2BallistraProj); + projectileMinionList.Add(ProjectileID.DD2ExplosiveTrapT1Explosion); + projectileMinionList.Add(ProjectileID.DD2ExplosiveTrapT2Explosion); + projectileMinionList.Add(ProjectileID.DD2ExplosiveTrapT3Explosion); + projectileMinionList.Add(ProjectileID.SpiderEgg); + projectileMinionList.Add(ProjectileID.BabySpider); + projectileMinionList.Add(ProjectileID.FrostBlastFriendly); + projectileMinionList.Add(ProjectileID.MoonlordTurretLaser); + projectileMinionList.Add(ProjectileID.RainbowCrystalExplosion); + + enemyImmunityList = new List(); + + enemyImmunityList.Add(NPCID.QueenBee); + enemyImmunityList.Add(NPCID.WallofFlesh); + enemyImmunityList.Add(NPCID.WallofFleshEye); + enemyImmunityList.Add(NPCID.Retinazer); + enemyImmunityList.Add(NPCID.Spazmatism); + enemyImmunityList.Add(NPCID.SkeletronPrime); + enemyImmunityList.Add(NPCID.PrimeCannon); + enemyImmunityList.Add(NPCID.PrimeSaw); + enemyImmunityList.Add(NPCID.PrimeLaser); + enemyImmunityList.Add(NPCID.PrimeVice); + enemyImmunityList.Add(NPCID.Plantera); + enemyImmunityList.Add(NPCID.IceQueen); + enemyImmunityList.Add(NPCID.Pumpking); + enemyImmunityList.Add(NPCID.Mothron); + enemyImmunityList.Add(NPCID.Golem); + enemyImmunityList.Add(NPCID.GolemHead); + enemyImmunityList.Add(NPCID.GolemFistRight); + enemyImmunityList.Add(NPCID.GolemFistLeft); + enemyImmunityList.Add(NPCID.DukeFishron); + enemyImmunityList.Add(NPCID.CultistBoss); + enemyImmunityList.Add(NPCID.MoonLordHead); + enemyImmunityList.Add(NPCID.MoonLordHand); + enemyImmunityList.Add(NPCID.MoonLordCore); + enemyImmunityList.Add(NPCID.MoonLordFreeEye); + + hardModeNerfExceptionList = new List(); + + hardModeNerfExceptionList.Add(NPCID.Probe); + hardModeNerfExceptionList.Add(NPCID.TheHungry); + hardModeNerfExceptionList.Add(NPCID.TheHungryII); + hardModeNerfExceptionList.Add(NPCID.WallofFleshEye); + hardModeNerfExceptionList.Add(NPCID.Creeper); + hardModeNerfExceptionList.Add(NPCID.EaterofWorldsHead); + hardModeNerfExceptionList.Add(NPCID.EaterofWorldsBody); + hardModeNerfExceptionList.Add(NPCID.EaterofWorldsTail); + hardModeNerfExceptionList.Add(NPCID.SkeletronHand); + + dungeonEnemyBuffList = new List(); + + dungeonEnemyBuffList.Add(NPCID.SkeletonSniper); + dungeonEnemyBuffList.Add(NPCID.TacticalSkeleton); + dungeonEnemyBuffList.Add(NPCID.SkeletonCommando); + dungeonEnemyBuffList.Add(NPCID.Paladin); + dungeonEnemyBuffList.Add(NPCID.GiantCursedSkull); + dungeonEnemyBuffList.Add(NPCID.BoneLee); + dungeonEnemyBuffList.Add(NPCID.DiabolistWhite); + dungeonEnemyBuffList.Add(NPCID.DiabolistRed); + dungeonEnemyBuffList.Add(NPCID.NecromancerArmored); + dungeonEnemyBuffList.Add(NPCID.Necromancer); + dungeonEnemyBuffList.Add(NPCID.RaggedCasterOpenCoat); + dungeonEnemyBuffList.Add(NPCID.RaggedCaster); + dungeonEnemyBuffList.Add(NPCID.HellArmoredBonesSword); + dungeonEnemyBuffList.Add(NPCID.HellArmoredBonesMace); + dungeonEnemyBuffList.Add(NPCID.HellArmoredBonesSpikeShield); + dungeonEnemyBuffList.Add(NPCID.HellArmoredBones); + dungeonEnemyBuffList.Add(NPCID.BlueArmoredBonesSword); + dungeonEnemyBuffList.Add(NPCID.BlueArmoredBonesNoPants); + dungeonEnemyBuffList.Add(NPCID.BlueArmoredBonesMace); + dungeonEnemyBuffList.Add(NPCID.BlueArmoredBones); + dungeonEnemyBuffList.Add(NPCID.RustyArmoredBonesSwordNoArmor); + dungeonEnemyBuffList.Add(NPCID.RustyArmoredBonesSword); + dungeonEnemyBuffList.Add(NPCID.RustyArmoredBonesFlail); + dungeonEnemyBuffList.Add(NPCID.RustyArmoredBonesAxe); + + bossScaleList = new List(); + + bossScaleList.Add(NPCID.EaterofWorldsHead); + bossScaleList.Add(NPCID.EaterofWorldsBody); + bossScaleList.Add(NPCID.EaterofWorldsTail); + bossScaleList.Add(NPCID.Creeper); + bossScaleList.Add(NPCID.SkeletronHand); + bossScaleList.Add(NPCID.WallofFleshEye); + bossScaleList.Add(NPCID.TheHungry); + bossScaleList.Add(NPCID.TheHungryII); + bossScaleList.Add(NPCID.TheDestroyerBody); + bossScaleList.Add(NPCID.TheDestroyerTail); + bossScaleList.Add(NPCID.PrimeCannon); + bossScaleList.Add(NPCID.PrimeVice); + bossScaleList.Add(NPCID.PrimeSaw); + bossScaleList.Add(NPCID.PrimeLaser); + bossScaleList.Add(NPCID.PlanterasTentacle); + bossScaleList.Add(NPCID.Pumpking); + bossScaleList.Add(NPCID.IceQueen); + bossScaleList.Add(NPCID.Mothron); + bossScaleList.Add(NPCID.GolemHead); + + beeEnemyList = new List(); + + beeEnemyList.Add(NPCID.GiantMossHornet); + beeEnemyList.Add(NPCID.BigMossHornet); + beeEnemyList.Add(NPCID.LittleMossHornet); + beeEnemyList.Add(NPCID.TinyMossHornet); + beeEnemyList.Add(NPCID.MossHornet); + beeEnemyList.Add(NPCID.VortexHornetQueen); + beeEnemyList.Add(NPCID.VortexHornet); + beeEnemyList.Add(NPCID.Bee); + beeEnemyList.Add(NPCID.BeeSmall); + beeEnemyList.Add(NPCID.QueenBee); + + beeProjectileList = new List(); + + beeProjectileList.Add(ProjectileID.Stinger); + beeProjectileList.Add(ProjectileID.HornetStinger); + + hardModeNerfList = new List(); + + hardModeNerfList.Add(ProjectileID.WebSpit); + hardModeNerfList.Add(ProjectileID.PinkLaser); + hardModeNerfList.Add(ProjectileID.FrostBlastHostile); + hardModeNerfList.Add(ProjectileID.RuneBlast); + hardModeNerfList.Add(ProjectileID.GoldenShowerHostile); + hardModeNerfList.Add(ProjectileID.RainNimbus); + hardModeNerfList.Add(ProjectileID.Stinger); + hardModeNerfList.Add(ProjectileID.FlamingArrow); + hardModeNerfList.Add(ProjectileID.BulletDeadeye); + hardModeNerfList.Add(ProjectileID.CannonballHostile); + + debuffList = new List(); + + debuffList.Add(BuffID.Poisoned); + debuffList.Add(BuffID.Darkness); + debuffList.Add(BuffID.Cursed); + debuffList.Add(BuffID.OnFire); + debuffList.Add(BuffID.Bleeding); + debuffList.Add(BuffID.Confused); + debuffList.Add(BuffID.Slow); + debuffList.Add(BuffID.Weak); + debuffList.Add(BuffID.Silenced); + debuffList.Add(BuffID.BrokenArmor); + debuffList.Add(BuffID.CursedInferno); + debuffList.Add(BuffID.Frostburn); + debuffList.Add(BuffID.Chilled); + debuffList.Add(BuffID.Frozen); + debuffList.Add(BuffID.Burning); + debuffList.Add(BuffID.Suffocation); + debuffList.Add(BuffID.Ichor); + debuffList.Add(BuffID.Venom); + debuffList.Add(BuffID.Blackout); + debuffList.Add(BuffID.Electrified); + debuffList.Add(BuffID.Rabies); + debuffList.Add(BuffID.Webbed); + debuffList.Add(BuffID.Stoned); + debuffList.Add(BuffID.Dazed); + debuffList.Add(BuffID.VortexDebuff); + debuffList.Add(BuffID.WitheredArmor); + debuffList.Add(BuffID.WitheredWeapon); + debuffList.Add(BuffID.OgreSpit); + debuffList.Add(BuffID.BetsysCurse); + + fireWeaponList = new List(); + + fireWeaponList.Add(ItemID.FieryGreatsword); + fireWeaponList.Add(ItemID.DD2SquireDemonSword); + fireWeaponList.Add(ItemID.TheHorsemansBlade); + fireWeaponList.Add(ItemID.DD2SquireBetsySword); + fireWeaponList.Add(ItemID.Cascade); + fireWeaponList.Add(ItemID.HelFire); + fireWeaponList.Add(ItemID.MonkStaffT2); + fireWeaponList.Add(ItemID.Flamarang); + fireWeaponList.Add(ItemID.MoltenFury); + fireWeaponList.Add(ItemID.Sunfury); + fireWeaponList.Add(ItemID.PhoenixBlaster); + fireWeaponList.Add(ItemID.Flamelash); + fireWeaponList.Add(ItemID.SolarEruption); + fireWeaponList.Add(ItemID.DayBreak); + fireWeaponList.Add(ItemID.MonkStaffT3); + fireWeaponList.Add(ItemID.HellwingBow); + fireWeaponList.Add(ItemID.DD2PhoenixBow); + fireWeaponList.Add(ItemID.DD2BetsyBow); + fireWeaponList.Add(ItemID.FlareGun); + fireWeaponList.Add(ItemID.Flamethrower); + fireWeaponList.Add(ItemID.EldMelter); + fireWeaponList.Add(ItemID.FlowerofFire); + fireWeaponList.Add(ItemID.MeteorStaff); + fireWeaponList.Add(ItemID.ApprenticeStaffT3); + fireWeaponList.Add(ItemID.InfernoFork); + fireWeaponList.Add(ItemID.HeatRay); + fireWeaponList.Add(ItemID.BookofSkulls); + fireWeaponList.Add(ItemID.ImpStaff); + fireWeaponList.Add(ItemID.DD2FlameburstTowerT1Popper); + fireWeaponList.Add(ItemID.DD2FlameburstTowerT2Popper); + fireWeaponList.Add(ItemID.DD2FlameburstTowerT3Popper); + fireWeaponList.Add(ItemID.MolotovCocktail); + + natureWeaponList = new List(); + + natureWeaponList.Add(ItemID.BladeofGrass); + natureWeaponList.Add(ItemID.ChlorophyteClaymore); + natureWeaponList.Add(ItemID.ChlorophyteSaber); + natureWeaponList.Add(ItemID.ChlorophytePartisan); + natureWeaponList.Add(ItemID.ChlorophyteShotbow); + natureWeaponList.Add(ItemID.Seedler); + natureWeaponList.Add(ItemID.ChristmasTreeSword); + natureWeaponList.Add(ItemID.TerraBlade); + natureWeaponList.Add(ItemID.JungleYoyo); + natureWeaponList.Add(ItemID.Yelets); + natureWeaponList.Add(ItemID.MushroomSpear); + natureWeaponList.Add(ItemID.ThornChakram); + natureWeaponList.Add(ItemID.Bananarang); + natureWeaponList.Add(ItemID.FlowerPow); + natureWeaponList.Add(ItemID.BeesKnees); + natureWeaponList.Add(ItemID.Toxikarp); + natureWeaponList.Add(ItemID.Bladetongue); + natureWeaponList.Add(ItemID.PoisonStaff); + natureWeaponList.Add(ItemID.VenomStaff); + natureWeaponList.Add(ItemID.StaffofEarth); + natureWeaponList.Add(ItemID.BeeGun); + natureWeaponList.Add(ItemID.LeafBlower); + natureWeaponList.Add(ItemID.WaspGun); + natureWeaponList.Add(ItemID.CrystalSerpent); + natureWeaponList.Add(ItemID.Razorpine); + natureWeaponList.Add(ItemID.HornetStaff); + natureWeaponList.Add(ItemID.QueenSpiderStaff); + natureWeaponList.Add(ItemID.SlimeStaff); + natureWeaponList.Add(ItemID.PygmyStaff); + natureWeaponList.Add(ItemID.RavenStaff); + natureWeaponList.Add(ItemID.BatScepter); + natureWeaponList.Add(ItemID.SpiderStaff); + natureWeaponList.Add(ItemID.Beenade); + natureWeaponList.Add(ItemID.FrostDaggerfish); + + alcoholList = new List(); + + Mod calamity = ModLoader.GetMod("CalamityMod"); + if (calamity != null) + { + rangedProjectileExceptionList.Add(calamity.ProjectileType("Phangasm")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("Contagion")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("DaemonsFlame")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("ExoTornado")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("Drataliornus")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("FlakKrakenGun")); + rangedProjectileExceptionList.Add(calamity.ProjectileType("Butcher")); + + beeEnemyList.Add(calamity.NPCType("PlaguebringerGoliath")); + beeEnemyList.Add(calamity.NPCType("PlaguebringerShade")); + beeEnemyList.Add(calamity.NPCType("PlagueBeeLargeG")); + beeEnemyList.Add(calamity.NPCType("PlagueBeeLarge")); + beeEnemyList.Add(calamity.NPCType("PlagueBeeG")); + beeEnemyList.Add(calamity.NPCType("PlagueBee")); + + beeProjectileList.Add(calamity.ProjectileType("PlagueStingerGoliath")); + beeProjectileList.Add(calamity.ProjectileType("PlagueStingerGoliathV2")); + beeProjectileList.Add(calamity.ProjectileType("PlagueExplosion")); + + debuffList.Add(calamity.BuffType("BrimstoneFlames")); + debuffList.Add(calamity.BuffType("BurningBlood")); + debuffList.Add(calamity.BuffType("GlacialState")); + debuffList.Add(calamity.BuffType("GodSlayerInferno")); + debuffList.Add(calamity.BuffType("HolyLight")); + debuffList.Add(calamity.BuffType("Irradiated")); + debuffList.Add(calamity.BuffType("Plague")); + debuffList.Add(calamity.BuffType("AbyssalFlames")); + debuffList.Add(calamity.BuffType("CrushDepth")); + debuffList.Add(calamity.BuffType("Horror")); + debuffList.Add(calamity.BuffType("MarkedforDeath")); + + fireWeaponList.Add(calamity.ItemType("AegisBlade")); + fireWeaponList.Add(calamity.ItemType("BalefulHarvester")); + fireWeaponList.Add(calamity.ItemType("Chaotrix")); + fireWeaponList.Add(calamity.ItemType("CometQuasher")); + fireWeaponList.Add(calamity.ItemType("DraconicDestruction")); + fireWeaponList.Add(calamity.ItemType("Drataliornus")); + fireWeaponList.Add(calamity.ItemType("EnergyStaff")); + fireWeaponList.Add(calamity.ItemType("ExsanguinationLance")); + fireWeaponList.Add(calamity.ItemType("FirestormCannon")); + fireWeaponList.Add(calamity.ItemType("FlameburstShortsword")); + fireWeaponList.Add(calamity.ItemType("FlameScythe")); + fireWeaponList.Add(calamity.ItemType("FlameScytheMelee")); + fireWeaponList.Add(calamity.ItemType("FlareBolt")); + fireWeaponList.Add(calamity.ItemType("FlarefrostBlade")); + fireWeaponList.Add(calamity.ItemType("FlarewingBow")); + fireWeaponList.Add(calamity.ItemType("ForbiddenSun")); + fireWeaponList.Add(calamity.ItemType("FrigidflashBolt")); + fireWeaponList.Add(calamity.ItemType("GreatbowofTurmoil")); + fireWeaponList.Add(calamity.ItemType("HarvestStaff")); + fireWeaponList.Add(calamity.ItemType("HellBurst")); + fireWeaponList.Add(calamity.ItemType("HellfireFlamberge")); + fireWeaponList.Add(calamity.ItemType("Hellkite")); + fireWeaponList.Add(calamity.ItemType("HellwingStaff")); + fireWeaponList.Add(calamity.ItemType("Helstorm")); + fireWeaponList.Add(calamity.ItemType("InfernaCutter")); + fireWeaponList.Add(calamity.ItemType("Lazhar")); + fireWeaponList.Add(calamity.ItemType("MeteorFist")); + fireWeaponList.Add(calamity.ItemType("Mourningstar")); + fireWeaponList.Add(calamity.ItemType("PhoenixBlade")); + fireWeaponList.Add(calamity.ItemType("Photoviscerator")); + fireWeaponList.Add(calamity.ItemType("RedSun")); + fireWeaponList.Add(calamity.ItemType("SpectralstormCannon")); + fireWeaponList.Add(calamity.ItemType("SunGodStaff")); + fireWeaponList.Add(calamity.ItemType("SunSpiritStaff")); + fireWeaponList.Add(calamity.ItemType("TearsofHeaven")); + fireWeaponList.Add(calamity.ItemType("TerraFlameburster")); + fireWeaponList.Add(calamity.ItemType("TheEmpyrean")); + fireWeaponList.Add(calamity.ItemType("TheWand")); + fireWeaponList.Add(calamity.ItemType("VenusianTrident")); + fireWeaponList.Add(calamity.ItemType("Vesuvius")); + fireWeaponList.Add(calamity.ItemType("BlissfulBombardier")); + fireWeaponList.Add(calamity.ItemType("HolyCollider")); + fireWeaponList.Add(calamity.ItemType("MoltenAmputator")); + fireWeaponList.Add(calamity.ItemType("PurgeGuzzler")); + fireWeaponList.Add(calamity.ItemType("SolarFlare")); + fireWeaponList.Add(calamity.ItemType("TelluricGlare")); + fireWeaponList.Add(calamity.ItemType("AngryChickenStaff")); + fireWeaponList.Add(calamity.ItemType("ChickenCannon")); + fireWeaponList.Add(calamity.ItemType("DragonRage")); + fireWeaponList.Add(calamity.ItemType("DragonsBreath")); + fireWeaponList.Add(calamity.ItemType("PhoenixFlameBarrage")); + fireWeaponList.Add(calamity.ItemType("ProfanedTrident")); + fireWeaponList.Add(calamity.ItemType("TheBurningSky")); + + natureWeaponList.Add(calamity.ItemType("DepthBlade")); + natureWeaponList.Add(calamity.ItemType("AbyssBlade")); + natureWeaponList.Add(calamity.ItemType("NeptunesBounty")); + natureWeaponList.Add(calamity.ItemType("AquaticDissolution")); + natureWeaponList.Add(calamity.ItemType("ArchAmaryllis")); + natureWeaponList.Add(calamity.ItemType("BiomeBlade")); + natureWeaponList.Add(calamity.ItemType("TrueBiomeBlade")); + natureWeaponList.Add(calamity.ItemType("OmegaBiomeBlade")); + natureWeaponList.Add(calamity.ItemType("BladedgeGreatbow")); + natureWeaponList.Add(calamity.ItemType("BlossomFlux")); + natureWeaponList.Add(calamity.ItemType("EvergladeSpray")); + natureWeaponList.Add(calamity.ItemType("FeralthornClaymore")); + natureWeaponList.Add(calamity.ItemType("Floodtide")); + natureWeaponList.Add(calamity.ItemType("FourSeasonsGalaxia")); + natureWeaponList.Add(calamity.ItemType("GammaFusillade")); + natureWeaponList.Add(calamity.ItemType("GleamingMagnolia")); + natureWeaponList.Add(calamity.ItemType("HarvestStaff")); + natureWeaponList.Add(calamity.ItemType("HellionFlowerSpear")); + natureWeaponList.Add(calamity.ItemType("Lazhar")); + natureWeaponList.Add(calamity.ItemType("LifefruitScythe")); + natureWeaponList.Add(calamity.ItemType("ManaRose")); + natureWeaponList.Add(calamity.ItemType("MangroveChakram")); + natureWeaponList.Add(calamity.ItemType("MangroveChakramMelee")); + natureWeaponList.Add(calamity.ItemType("MantisClaws")); + natureWeaponList.Add(calamity.ItemType("Mariana")); + natureWeaponList.Add(calamity.ItemType("Mistlestorm")); + natureWeaponList.Add(calamity.ItemType("Monsoon")); + natureWeaponList.Add(calamity.ItemType("Alluvion")); + natureWeaponList.Add(calamity.ItemType("Needler")); + natureWeaponList.Add(calamity.ItemType("NettlelineGreatbow")); + natureWeaponList.Add(calamity.ItemType("Quagmire")); + natureWeaponList.Add(calamity.ItemType("Shroomer")); + natureWeaponList.Add(calamity.ItemType("SolsticeClaymore")); + natureWeaponList.Add(calamity.ItemType("SporeKnife")); + natureWeaponList.Add(calamity.ItemType("Spyker")); + natureWeaponList.Add(calamity.ItemType("StormSaber")); + natureWeaponList.Add(calamity.ItemType("StormRuler")); + natureWeaponList.Add(calamity.ItemType("StormSurge")); + natureWeaponList.Add(calamity.ItemType("TarragonThrowingDart")); + natureWeaponList.Add(calamity.ItemType("TerraEdge")); + natureWeaponList.Add(calamity.ItemType("TerraLance")); + natureWeaponList.Add(calamity.ItemType("TerraRay")); + natureWeaponList.Add(calamity.ItemType("TerraShiv")); + natureWeaponList.Add(calamity.ItemType("Terratomere")); + natureWeaponList.Add(calamity.ItemType("TerraFlameburster")); + natureWeaponList.Add(calamity.ItemType("TheSwarmer")); + natureWeaponList.Add(calamity.ItemType("Verdant")); + natureWeaponList.Add(calamity.ItemType("Barinautical")); + natureWeaponList.Add(calamity.ItemType("DeepseaStaff")); + natureWeaponList.Add(calamity.ItemType("Downpour")); + natureWeaponList.Add(calamity.ItemType("SubmarineShocker")); + natureWeaponList.Add(calamity.ItemType("Archerfish")); + natureWeaponList.Add(calamity.ItemType("BallOFugu")); + natureWeaponList.Add(calamity.ItemType("BlackAnurian")); + natureWeaponList.Add(calamity.ItemType("CalamarisLament")); + natureWeaponList.Add(calamity.ItemType("HerringStaff")); + natureWeaponList.Add(calamity.ItemType("Lionfish")); + + alcoholList.Add(calamity.BuffType("BloodyMary")); + alcoholList.Add(calamity.BuffType("CaribbeanRum")); + alcoholList.Add(calamity.BuffType("CinnamonRoll")); + alcoholList.Add(calamity.BuffType("Everclear")); + alcoholList.Add(calamity.BuffType("EvergreenGin")); + alcoholList.Add(calamity.BuffType("Fireball")); + alcoholList.Add(calamity.BuffType("GrapeBeer")); + alcoholList.Add(calamity.BuffType("Margarita")); + alcoholList.Add(calamity.BuffType("Moonshine")); + alcoholList.Add(calamity.BuffType("MoscowMule")); + alcoholList.Add(calamity.BuffType("RedWine")); + alcoholList.Add(calamity.BuffType("Rum")); + alcoholList.Add(calamity.BuffType("Screwdriver")); + alcoholList.Add(calamity.BuffType("StarBeamRye")); + alcoholList.Add(calamity.BuffType("Tequila")); + alcoholList.Add(calamity.BuffType("TequilaSunrise")); + alcoholList.Add(calamity.BuffType("Vodka")); + alcoholList.Add(calamity.BuffType("Whiskey")); + alcoholList.Add(calamity.BuffType("WhiteWine")); + } + } + #endregion + + #region Music + public override void UpdateMusic(ref int music, ref MusicPriority priority) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (Main.musicVolume != 0) + { + if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) + { + if (NPC.AnyNPCs(NPCID.CultistBoss)) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Doomsayer"); priority = MusicPriority.BossMedium; + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); priority = MusicPriority.Environment; } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); priority = MusicPriority.Environment; } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer1 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer2) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); priority = MusicPriority.BiomeHigh; } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer3) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); priority = MusicPriority.BiomeHigh; } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer4) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); priority = MusicPriority.BiomeHigh; } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneSulphur) + { + if (!CalamityGlobalNPC.AnyBossNPCS()) { music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); priority = MusicPriority.BiomeHigh; } + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 540 && CalamityGlobalNPC.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); priority = MusicPriority.BossMedium; + } + } + } + } + #endregion + + #region PostSetupContent + public override void PostSetupContent() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod bossChecklist = ModLoader.GetMod("BossChecklist"); + + if (bossChecklist != null) + { + #region NormalModes + // 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", "Astrageldon Slime", 10.55f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.25 + bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 10.6f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] 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", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 + 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", "Bumblebirb", 16.5f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome or find it in the Jungle Biome"); //16 + 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 + #endregion + } + } + #endregion + + #region DrawingStuff + public override void ModifyInterfaceLayers(List layers) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (CalamityWorld.revenge) + { + 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 RecipeGroups + public override void AddRecipeGroups() + { + RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + (" Silt"), new int[] + { + 424, + 1103 + }); + RecipeGroup.RegisterGroup("SiltGroup", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Pickaxe"), new int[] + { + 2776, + 2781, + 2786, + 3466 + }); + RecipeGroup.RegisterGroup("LunarPickaxe", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Axe"), new int[] + { + 3522, + 3523, + 3524, + 3525 + }); + RecipeGroup.RegisterGroup("LunarAxe", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Wings"), new int[] + { + 492, + 493, + 665, + 749, + 761, + 785, + 786, + 821, + 822, + 823, + 948, + 1162, + 1165, + 1515, + 1583, + 1584, + 1585, + 1586, + 1797, + 1830, + 1871, + 2280, + 2494, + 2609, + 2770, + 3468, + 3469, + 3470, + 3471, + 3580, + 3582, + 3588, + 3592, + 3883, + ItemType("SkylineWings"), + ItemType("StarlightWings"), + ItemType("AureateWings"), + ItemType("DiscordianWings"), + ItemType("TarragonWings"), + ItemType("XerocWings") + }); + RecipeGroup.RegisterGroup("WingsGroup", group); + } + #endregion + + #region Recipes + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.SunplateBlock, 10); + recipe.AddIngredient(ItemID.Cloud, 5); + recipe.AddIngredient(ItemID.RainCloud, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.SkyMill); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IceBlock, 20); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(ItemID.IronBar, 5); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(ItemID.IceSkates); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IceBlock, 20); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(ItemID.LeadBar, 5); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(ItemID.IceSkates); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Lens); + recipe.AddIngredient(ItemID.BlackDye); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(ItemID.BlackLens); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Vertebrae, 5); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(ItemID.Leather); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IceBlock, 25); + recipe.AddIngredient(ItemID.SnowBlock, 15); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.IceMachine); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IceBlock, 25); + recipe.AddIngredient(ItemID.SnowBlock, 15); + recipe.AddIngredient(ItemID.LeadBar, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.IceMachine); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.GoldBroadsword); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddIngredient(null, "VictoryShard", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Starfury); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.PlatinumBroadsword); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddIngredient(null, "VictoryShard", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Starfury); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Feather, 2); + recipe.AddIngredient(ItemID.Bottle); + recipe.AddIngredient(ItemID.Cloud, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.CloudinaBottle); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Feather, 4); + recipe.AddIngredient(ItemID.Bottle); + recipe.AddIngredient(ItemID.SnowBlock, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.BlizzardinaBottle); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "DesertFeather", 10); + recipe.AddIngredient(ItemID.Feather, 6); + recipe.AddIngredient(ItemID.Bottle); + recipe.AddIngredient(ItemID.SandBlock, 70); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.SandstorminaBottle); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.WhiteString); + recipe.AddIngredient(ItemID.Gel, 80); + recipe.AddIngredient(ItemID.Cloud, 40); + recipe.AddTile(TileID.Solidifier); + recipe.SetResult(ItemID.ShinyRedBalloon); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(ItemID.WaterWalkingPotion, 8); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.WaterWalkingBoots); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LavaBucket, 5); + recipe.AddIngredient(ItemID.Obsidian, 25); + recipe.AddIngredient(ItemID.IronBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.LavaCharm); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LavaBucket, 5); + recipe.AddIngredient(ItemID.Obsidian, 25); + recipe.AddIngredient(ItemID.LeadBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.LavaCharm); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "CryoBar", 6); + recipe.AddIngredient(ItemID.FrostCore); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(ItemID.FrostHelmet); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "CryoBar", 10); + recipe.AddIngredient(ItemID.FrostCore); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(ItemID.FrostBreastplate); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "CryoBar", 8); + recipe.AddIngredient(ItemID.FrostCore); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(ItemID.FrostLeggings); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.CobaltBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.CobaltShield); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.PalladiumBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.CobaltShield); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.CobaltBar, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Muramasa); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.PalladiumBar, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Muramasa); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "TrueBloodyEdge"); + recipe.AddIngredient(ItemID.TrueExcalibur); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.TerraBlade); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "Ectoblood", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Ectoplasm); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.EmptyBullet); + recipe.AddIngredient(ItemID.ExplosivePowder, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.RocketI, 5); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "VictoryShard", 10); + recipe.AddIngredient(ItemID.SoulofLight, 15); + recipe.AddIngredient(ItemID.UnicornHorn, 3); + recipe.AddIngredient(ItemID.LightShard); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.EnchantedSword); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.WormholePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.WarmthPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.CratePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.SonarPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.FishingPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.TeleportationPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.StinkPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.LovePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.WrathPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.InfernoPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.RagePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.EndurancePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.LifeforcePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.AmmoReservationPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.TrapsightPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.SummoningPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.FlipperPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.TitanPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.BuilderPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.CalmingPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.HeartreachPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.MiningPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.GenderChangePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.GravitationPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.HunterPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.ArcheryPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.WaterWalkingPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.ThornsPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.BattlePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.NightOwlPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.ShinePotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.InvisibilityPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.SpelunkerPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.FeatherfallPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.MagicPowerPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.ManaRegenerationPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.IronskinPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.GillsPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.SwiftnessPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.RegenerationPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(ItemID.ObsidianSkinPotion); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.AncientCloth, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.FlyingCarpet); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LihzahrdBrick, 15); + recipe.AddIngredient(null, "CoreofCinder"); + recipe.AddTile(TileID.LihzahrdFurnace); + recipe.SetResult(ItemID.LihzahrdPowerCell); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.GlowingMushroom, 15); + recipe.AddIngredient(ItemID.Worm); + recipe.AddTile(TileID.Autohammer); + recipe.SetResult(ItemID.TruffleWorm); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IronBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Aglet); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LeadBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Aglet); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.JungleSpores, 15); + recipe.AddIngredient(ItemID.Cloud, 15); + recipe.AddIngredient(ItemID.PinkGel, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.AnkletoftheWind); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.SunplateBlock, 10); + recipe.AddIngredient(ItemID.Cloud, 10); + recipe.AddIngredient(ItemID.GoldBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.LuckyHorseshoe); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.SunplateBlock, 10); + recipe.AddIngredient(ItemID.Cloud, 10); + recipe.AddIngredient(ItemID.PlatinumBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.LuckyHorseshoe); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.SoulofLight, 30); + recipe.AddIngredient(ItemID.ChaosFish, 5); + recipe.AddIngredient(ItemID.PixieDust, 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.RodofDiscord); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.TurtleShell, 3); + recipe.AddIngredient(null, "EssenceofEleum", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.FrozenTurtleShell); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(null, "PlantyMush", 10); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.LifeFruit); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.FallenStar, 20); + recipe.AddIngredient(ItemID.SoulofMight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 5); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(null, "CryoBar", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.CelestialMagnet); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 1 + recipe.AddIngredient(ItemID.Silk, 20); + recipe.AddIngredient(ItemID.SoulofLight, 3); + recipe.AddIngredient(ItemID.SoulofNight, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.TrifoldMap); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 2 + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddIngredient(null, "AncientBoneDust", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.ArmorPolish); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 3 + recipe.AddIngredient(ItemID.SoulofNight, 20); + recipe.AddIngredient(ItemID.Lens, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Nazar); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 4 + recipe.AddIngredient(ItemID.Stinger, 15); + recipe.AddIngredient(null, "MurkyPaste"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Bezoar); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 5 + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Waterleaf, 5); + recipe.AddIngredient(ItemID.Blinkroot, 5); + recipe.AddIngredient(ItemID.Daybloom, 5); + recipe.AddIngredient(null, "BeetleJuice", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Vitamins); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 6 + recipe.AddIngredient(ItemID.Silk, 30); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Blindfold); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 7 + recipe.AddIngredient(ItemID.Timer1Second); + recipe.AddIngredient(ItemID.PixieDust, 15); + recipe.AddIngredient(ItemID.SoulofLight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.FastClock); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 8 + recipe.AddIngredient(ItemID.Wire, 10); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.Ruby, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.Megaphone); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //ankh 9 + recipe.AddIngredient(ItemID.Silk, 10); + recipe.AddIngredient(ItemID.Gel, 50); + recipe.AddIngredient(ItemID.GreaterHealingPotion); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.AdhesiveBandage); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Frog, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.FrogLeg); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //hermesboots + recipe.AddIngredient(ItemID.Silk, 10); + recipe.AddTile(TileID.Loom); + recipe.SetResult(ItemID.HermesBoots); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); //radar + recipe.AddIngredient(ItemID.IronBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Radar); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LeadBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Radar); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Bone, 5); + recipe.AddIngredient(ItemID.PinkGel); + recipe.AddIngredient(ItemID.HealingPotion); + recipe.AddIngredient(ItemID.Ruby); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.LifeCrystal); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Wood, 5); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.AddIngredient(ItemID.FallenStar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.WandofSparking); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IronBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.ThrowingKnife, 50); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LeadBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.ThrowingKnife, 50); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.IronBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Shuriken, 50); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.LeadBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.Shuriken, 50); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Leather, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(ItemID.FeralClaws); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(TileID.Hellforge); + recipe.SetResult(ItemID.GuideVoodooDoll); + recipe.AddRecipe(); + + recipe = new ModRecipe(this); + recipe.AddIngredient(ItemID.JungleSpores, 15); + recipe.AddIngredient(ItemID.RichMahogany, 15); + recipe.AddIngredient(ItemID.SoulofNight, 15); + recipe.AddIngredient(ItemID.SoulofLight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.TempleKey); + recipe.AddRecipe(); + } + #endregion + + #region Packets + public override void HandlePacket(BinaryReader reader, int whoAmI) + { + CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); + switch (msgType) + { + case CalamityModMessageType.StressSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleStress(reader); + break; + case CalamityModMessageType.Ravager: + int ravagerAlive = reader.ReadInt32(); + CalamityGlobalNPC.scavenger = ravagerAlive; + break; + case CalamityModMessageType.DoG: + int DoGAlive = reader.ReadInt32(); + CalamityGlobalNPC.DoGHead = DoGAlive; + break; + case CalamityModMessageType.Polterghast: + int polterAlive = reader.ReadInt32(); + CalamityGlobalNPC.ghostBoss = polterAlive; + break; + case CalamityModMessageType.LORDE: + int lordeAlive = reader.ReadInt32(); + CalamityGlobalNPC.lordeBoss = lordeAlive; + break; + case CalamityModMessageType.Providence: + int provAlive = reader.ReadInt32(); + CalamityGlobalNPC.holyBoss = provAlive; + break; + case CalamityModMessageType.BossRushStage: + int stage = reader.ReadInt32(); + CalamityPlayer.bossRushStage = stage; + break; + case CalamityModMessageType.AdrenalineSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleAdrenaline(reader); + break; + case CalamityModMessageType.TeleportPlayer: + Main.player[reader.ReadInt32()].GetModPlayer().HandleTeleport(reader.ReadInt32(), true, whoAmI); + break; + case CalamityModMessageType.SupremeCal: + int SCalAlive = reader.ReadInt32(); + CalamityGlobalNPC.SCal = SCalAlive; + break; + default: + ErrorLogger.Log("CalamityMod: Unknown Message type: " + msgType); + break; + } + } + #endregion + + public override object Call(params object[] args) + { + return ModSupport.Call(args); + } + } + + enum CalamityModMessageType : byte + { + StressSync, + Ravager, + DoG, + Polterghast, + LORDE, + Providence, + AdrenalineSync, + TeleportPlayer, + BossRushStage, + SupremeCal + } } \ No newline at end of file diff --git a/CalamityPlayer.cs b/CalamityPlayer.cs index aa2bd608ab..7457a4abe1 100644 --- a/CalamityPlayer.cs +++ b/CalamityPlayer.cs @@ -1,7279 +1,7513 @@ -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.Items.Armor; -using CalamityMod.UI; -using Terraria.ModLoader.IO; - -namespace CalamityMod -{ - public class CalamityPlayer : ModPlayer - { - #region InstanceVars - - #region NormalVars - public int soulEssence = 0; - - public static int bossRushStage = 0; - - private const int saveVersion = 0; - - public int modStealthTimer; - - public int hInfernoBoost = 0; - - public int pissWaterBoost = 0; - - public int runCheck = 0; - - public int packetTimer = 0; - - public int sCalDeathCount = 0; - - public int sCalKillCount = 0; - - public int bloodflareHeartTimer = 180; - - public int bloodflareManaTimer = 180; - - public const int hitLimitNormal = 25; - - public const int hitLimitExpert = 20; - - public const int hitLimitRev = 15; - - public const int hitLimitDeath = 10; - - public const int hitLimitArmageddon = 1; - - public float modStealth = 1f; - - public float aquaticBoost = 1f; - - public float shieldInvinc = 5f; - - public int dashMod; - - public int dashTimeMod; - - public const float defEndurance = 0.33f; - - public const int defLifeRegen = 18; - - public const int defLifeRegenTime = 1800; - - public const float defDamage = 1.85f; - - public const int defCrit = 75; - - public bool fab = false; - - public bool drawBossHPBar = true; - - public bool shouldDrawSmallText = true; - - public bool deactivateStupidFuckingBullshit = false; - #endregion - - #region PetStuff - public bool leviPet = false; - - public bool sirenPet = false; - - public bool fox = false; - - public bool chibii = false; - - public bool brimling = false; - #endregion - - #region StressStuff - public const int stressMax = 10000; - - public int stress; - - public int stressCD; - - public bool heartOfDarkness = false; - - public bool draedonsHeart = false; - - public bool draedonsStressGain = false; - - public bool afflicted = false; - - public bool affliction = false; - - public bool afflictedBuff = false; - - public bool stressPills = false; - - public bool laudanum = false; - - public bool stressLevel500 = false; - - public bool rageMode = false; - - public bool despawnProj = false; - #endregion - - #region AdrenalineStuff - 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; - #endregion - - #region PermanentStuff - 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; - #endregion - - #region AccessoryStuff - public bool dodgeScarf = 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 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 aBulwark = 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 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; - #endregion - - #region ArmorSetStuff - 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 int tarraRangedCrits = 0; - - public int tarraRangedCritTimer = 0; - - 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 bloodflareMageCrits = 0; - - public int bloodflareMageCritTimer = 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; - #endregion - - #region DebuffStuff - public bool NOU = 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; - #endregion - - #region BuffStuff - 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; - #endregion - - #region SummonStuff - 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 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 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; - #endregion - - #region BiomeStuff - public bool ZoneCalamity = false; - - public bool ZoneAstral = false; - - public bool ZoneGreatSea = 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; - #endregion - - #region TransformationStuff - 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; - #endregion - #endregion - - #region SavingAndLoading - public override void Initialize() - { - deactivateStupidFuckingBullshit = false; - 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 - }, - { - "bossRushStage", bossRushStage - } - }; - } - - 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"); - bossRushStage = tag.GetInt("bossRushStage"); - } - - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - stress = reader.ReadInt32(); - adrenaline = reader.ReadInt32(); - sCalDeathCount = reader.ReadInt32(); - sCalKillCount = reader.ReadInt32(); - bossRushStage = 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.extraAccessory && (Main.expertMode || Main.gameMenu)) - { - player.extraAccessorySlots = 2; - } - runCheck = 0; - dashMod = 0; - leviPet = false; - sirenPet = false; - fox = false; - chibii = false; - brimling = false; - fab = false; - sirenWaterBuff = false; - abyssalDivingSuitPlates = false; - abyssalDivingSuitCooldown = false; - sirenIce = false; - sirenIceCooldown = false; - heartOfDarkness = false; - draedonsHeart = false; - draedonsStressGain = false; - afflicted = false; - affliction = false; - afflictedBuff = false; - dodgeScarf = false; - elysianAegis = false; - godSlayer = false; - nCore = 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; - ataxiaBolt = false; - ataxiaGeyser = false; - shadeRegen = false; - scarfCooldown = false; - flamethrowerBoost = false; - shadowSpeed = false; - aSpark = false; - aBulwark = false; - dAmulet = false; - fCarapace = false; - gShell = false; - absorber = false; - aAmpoule = false; - pAmulet = false; - auricBoost = false; - fBarrier = false; - aBrain = false; - frostFlare = false; - beeResist = false; - uberBees = false; - projRef = false; - nanotech = false; - eQuiver = false; - daedalusReflect = false; - daedalusSplit = false; - daedalusAbsorb = false; - daedalusShard = false; - reaverSpore = false; - reaverDoubleTap = false; - cryogenSoul = false; - yInsignia = false; - eGauntlet = false; - eTalisman = false; - statisBeltOfCurses = false; - ataxiaFire = false; - ataxiaVolley = false; - ataxiaBlaze = 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; - ironBoots = false; - depthCharm = false; - anechoicPlating = false; - jellyfishNecklace = false; - abyssalAmulet = false; - lumenousAmulet = false; - reaperToothNecklace = false; - aquaticEmblem = false; - darkSunRing = false; - calamityRing = false; - eArtifact = false; - dArtifact = false; - gArtifact = false; - reaverBlast = false; - reaverBurst = false; - astralStarRain = false; - ataxiaMage = 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; - lol = false; - raiderTalisman = false; - sGenerator = false; - sDefense = false; - sRegen = false; - sPower = false; - IBoots = false; - elysianFire = false; - sTracers = false; - eTracers = false; - cTracers = false; - dsSetBonus = false; - NOU = false; - weakPetrification = false; - hAttack = false; - horror = false; - irradiated = false; - bFlames = false; - aFlames = false; - gsInferno = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - eGravity = false; - sMeleeBoost = false; - tFury = false; - vHex = false; - eGrav = false; - warped = false; - cadence = false; - omniscience = false; - zerg = false; - zen = false; - permafrostsConcoction = false; - yPower = false; - aWeapon = false; - tScale = false; - fabsolVodka = false; - marked = false; - cDepth = false; - fishAlert = false; - invincible = false; - shine = false; - anechoicCoating = false; - mushy = false; - molten = false; - enraged = false; - shellBoost = false; - cFreeze = false; - tRegen = 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; - 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; - fungalClump = false; - redDevil = false; - valkyrie = false; - slimeGod = false; - urchin = false; - chaosSpirit = false; - reaverOrb = false; - daedalusCrystal = false; - abyssalDivingSuitPrevious = abyssalDivingSuit; - abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; - sirenBoobsPrevious = sirenBoobs; - sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; - sirenBoobsAltPrevious = sirenBoobsAlt; - sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; - rageMode = false; - adrenalineMode = false; - } - #endregion - - #region UpdateDead - public override void UpdateDead() - { - #region Debuffs - stress = 0; - adrenaline = 0; - adrenalineMaxTimer = 300; - adrenalineDmgDown = 600; - adrenalineDmgMult = 1f; - raiderStack = 0; - fleshTotemCooldown = 0; - astralStarRainCooldown = 0; - tarraMageHealCooldown = 0; - 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; - scarfCooldown = false; - godSlayerCooldown = false; - abyssalDivingSuitCooldown = false; - abyssalDivingSuitPlateHits = 0; - sirenIceCooldown = false; - #endregion - - #region Buffs - sDefense = false; - sRegen = false; - sPower = false; - fab = false; - abyssalDivingSuitPlates = false; - sirenWaterBuff = false; - sirenIce = false; - afflictedBuff = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - sMeleeBoost = false; - tFury = false; - cadence = false; - omniscience = false; - zerg = false; - zen = false; - 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; - revivifyTimer = 0; - #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; - 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; - tarraRangedCrits = 0; - tarraRangedCritTimer = 0; - 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; - bloodflareMageCrits = 0; - bloodflareMageCritTimer = 0; - bloodflareSummon = false; - bloodflareSummonTimer = 0; - xerocSet = false; - IBoots = false; - elysianFire = false; - elysianAegis = false; - elysianGuard = false; - #endregion - - if (CalamityWorld.bossRushActive) - { - if (!CalamityGlobalNPC.AnyLivingPlayers()) - { - CalamityWorld.bossRushActive = false; - 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(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 && !CalamityGlobalNPC.AnyBossNPCS()) - { - player.respawnTimer -= 5; - } - else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert - { - player.respawnTimer--; - } - } - #endregion - - #region BiomeStuff - public override void UpdateBiomeVisuals() - { - 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 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); - bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); - player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); - player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || - (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 = CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300); - //ZoneGreatSea = CalamityWorld.seaTiles > 30; - - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmSteps = y / 4; - int abyssChasmY = (y - abyssChasmSteps) + 100; - 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; - } - } - - //0.4 is the lowest location the rocklayer can be, 0.3 is the highest - ZoneAbyss = (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && - (((double)point.Y > (Main.rockLayer - (double)y * 0.05)) && //rocklayer = (0.4 to 0.3) - 0.04 = 0.36 to 0.26 - !player.lavaWet && - !player.honeyWet && - abyssPosY && - abyssPosX)); - - ZoneAbyssLayer1 = ZoneAbyss && - (double)point.Y <= (Main.rockLayer + (double)y * 0.036); //(0.36 to 0.26) to (0.436 to 0.336) - - ZoneAbyssLayer2 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.036) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.143); //(0.436 to 0.336) to (0.543 to 0.443) - - ZoneAbyssLayer3 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.143) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.262); //(0.543 to 0.443) to (0.662 to 0.562) - - ZoneAbyssLayer4 = ZoneAbyss && - point.Y <= Main.maxTilesY - 200 && - (double)point.Y > (Main.rockLayer + (double)y * 0.262); //(0.662 to 0.562) to just above underworld - - 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; - } - - public override void CopyCustomBiomesTo(Player other) - { - CalamityPlayer modOther = other.GetModPlayer(mod); - modOther.ZoneCalamity = ZoneCalamity; - modOther.ZoneAstral = ZoneAstral; - modOther.ZoneSulphur = ZoneSulphur; - 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; - writer.Write(flags); - } - - 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]; - } - - public override Texture2D GetMapBackgroundImage() - { - /*if (ZoneSulphur) - { - return mod.GetTexture("Backgrounds/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() - { - #region FirstDebuffs - 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)) - { - 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.meleeSpeed -= 0.025f; - 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 (vHex) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 16; - player.blind = true; - player.statDefense -= 30; - player.moveSpeed -= 0.1f; - player.endurance -= 0.3f; - 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 += 10; - } - if (sRegen) - { - player.lifeRegen += 2; - } - if (tarraSet) - { - player.calmed = (tarraMelee ? false : true); - player.lifeMagnet = true; - } - if (aChicken) - { - player.lifeRegen += 2; - player.statDefense += 5; - player.moveSpeed += 0.1f; - } - if (cadence) - { - player.discount = true; - player.lifeMagnet = true; - player.calmed = true; - player.loveStruck = true; - player.lifeRegen += 2; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; - } - if (omniscience) - { - player.detectCreature = true; - player.dangerSense = true; - player.findTreasure = true; - } - if (aWeapon) - { - player.moveSpeed += 0.15f; - } - if (mushy) - { - player.statDefense += 5; - player.lifeRegen += 5; - } - if (molten) - { - player.resistCold = true; - } - if (shellBoost) - { - player.moveSpeed += 0.9f; - } - if (celestialJewel || astralArcanum) - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegen += 8; - player.statDefense += 20; - } - else - { - player.lifeRegen += 2; - } - } - else if (crownJewel) - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegen += 4; - player.statDefense += 10; - } - else - { - player.lifeRegen += 2; - } - } - 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 || player.GetModPlayer().bFlames) - player.lifeRegen += 4; - } - #endregion - #region LastDebuffs - 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) - { - if (player.wingTimeMax < 0) - { - player.wingTimeMax = 0; - } - player.wingTimeMax /= 3; - if (player.wingTimeMax > 400) - { - player.wingTimeMax = 200; - } - } - if (warped) - { - player.velocity.Y *= 1.01f; - } - if (weakPetrification) - { - if (player.mount.Active) - { - player.mount.Dismount(player); - } - } - if (CalamityGlobalNPC.DoGHead > -1) - { - player.velocity.X *= 0.99f; - } - if (CalamityWorld.revenge) - { - if (player.lifeRegenTime > defLifeRegenTime) - { - int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; - player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); - } - if (player.lifeRegen > defLifeRegen) - { - int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; - player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); - } - } - #endregion - } - - #region UpdateLifeRegen - public override void UpdateLifeRegen() - { - bool shinyStoned = player.shinyStone; - float num2 = 0f; - if (player.lifeRegenTime >= 300) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 600) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 900) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 1200) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 1500) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 1800) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 2400) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 3000) - { - num2 += 1f; - } - if (player.lifeRegenTime >= 3600) - { - num2 += 1f; - } - if (player.velocity.X == 0f || player.grappling[0] > 0) - { - num2 *= 1.25f; - } - else - { - num2 *= 0.5f; - } - if (!shinyStoned) - { - if (shadeRegen || draedonsHeart || cFreeze) - { - num2 *= 1.1f; - } - if (draedonsHeart && !shadeRegen && !cFreeze && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (player.lifeRegen < 0) - { - player.lifeRegen /= 2; - } - if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegenTime += 8; //4 - player.lifeRegen += 8; //4 - float num3 = (float)(player.lifeRegenTime - 3000); - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > 30f) - { - num3 = 30f; - } - num2 += num3; - } - float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; - num2 *= num4; - player.lifeRegen += (int)Math.Round((double)num2); - player.lifeRegenCount += player.lifeRegen; - 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; - } - } - } - if (shadeRegen && !draedonsHeart && !cFreeze && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (player.lifeRegen < 0) - { - player.lifeRegen /= 2; - } - if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegenTime += 4; - player.lifeRegen += 4; - float num3 = (float)(player.lifeRegenTime - 3000); - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > 30f) - { - num3 = 30f; - } - num2 += num3; - } - float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; - num2 *= num4; - player.lifeRegen += (int)Math.Round((double)num2); - player.lifeRegenCount += player.lifeRegen; - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default(Color), 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - if (cFreeze && !shadeRegen && !draedonsHeart && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (player.lifeRegen < 0) - { - player.lifeRegen /= 2; - } - if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegenTime += 4; - player.lifeRegen += 4; - float num3 = (float)(player.lifeRegenTime - 3000); - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > 30f) - { - num3 = 30f; - } - num2 += num3; - } - float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; - num2 *= num4; - player.lifeRegen += (int)Math.Round((double)num2); - player.lifeRegenCount += player.lifeRegen; - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - } - if (CalamityWorld.revenge) - { - if (player.lifeRegenTime > defLifeRegenTime) - { - int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; - player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); - } - if (player.lifeRegen > defLifeRegen) - { - int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; - player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); - } - } - } - #endregion - #endregion - - #region HotKeys - public override void ProcessTriggers(TriggersSet triggersSet) - { - 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 (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) - { - if (nPC.FindBuffIndex(mod.BuffType("Enraged")) == -1) - { - 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()) - { - 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 (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 PostUpdateEffects - public override void PostUpdateBuffs() - { - if (NOU) - { - NOULOL(); - } - if (weakPetrification) - { - WeakPetrification(); - } - } - - public override void PostUpdateEquips() - { - if (NOU) - { - NOULOL(); - } - if (weakPetrification) - { - WeakPetrification(); - } - } - - public override void PostUpdateMiscEffects() - { - #region BossRush - if (CalamityWorld.bossRushActive) - { - if (!deactivateStupidFuckingBullshit) - { - deactivateStupidFuckingBullshit = true; - CalamityWorld.bossRushActive = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (NPC.MoonLordCountdown > 0) - { - NPC.MoonLordCountdown = 0; - } - if (!CalamityGlobalNPC.AnyBossNPCS()) - { - if (CalamityWorld.bossRushSpawnCountdown > 0) - { - CalamityWorld.bossRushSpawnCountdown--; - if (CalamityWorld.bossRushSpawnCountdown == 180 && bossRushStage == 26) - { - string key = "Mods.CalamityMod.BossRushTierThreeEndText2"; - 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); - } - } - if (CalamityWorld.bossRushSpawnCountdown == 210 && bossRushStage == 33) - { - string key = "Mods.CalamityMod.BossRushTierFourEndText2"; - 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); - } - } - } - if (CalamityWorld.bossRushSpawnCountdown <= 0) - { - CalamityWorld.bossRushSpawnCountdown = 60; - if (bossRushStage > 25) - { - CalamityWorld.bossRushSpawnCountdown += 120; //3 seconds - } - if (bossRushStage > 32) - { - CalamityWorld.bossRushSpawnCountdown += 180; //6 seconds - } - switch (bossRushStage) - { - case 9: - CalamityWorld.bossRushSpawnCountdown = 240; - break; - case 18: - CalamityWorld.bossRushSpawnCountdown = 300; - break; - case 25: - CalamityWorld.bossRushSpawnCountdown = 360; - break; - case 32: - CalamityWorld.bossRushSpawnCountdown = 420; - break; - default: - break; - } - if (bossRushStage == 13) - { - player.Spawn(); - } - else if (bossRushStage == 36) - { - if (player.FindBuffIndex(mod.BuffType("ExtremeGravity")) > -1) - { - player.ClearBuff(mod.BuffType("ExtremeGravity")); - } - } - if (Main.netMode != 1) - { - Main.PlaySound(SoundID.Roar, player.position, 0); - switch (bossRushStage) - { - case 0: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.QueenBee); - break; - case 1: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.BrainofCthulhu); - break; - case 2: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.KingSlime); - break; - case 3: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.EyeofCthulhu); - break; - case 4: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); - break; - case 5: - NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 51))), (int)(player.position.Y - 150f), NPCID.Golem, 0, 0f, 0f, 0f, 0f, 255); - break; - case 6: - ChangeTime(true); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss2")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss3")); - break; - case 7: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.EaterofWorldsHead); - break; - case 8: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Astrageldon")); - break; - case 9: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); - break; - case 10: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); - break; - case 11: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); - break; - case 12: - NPC.SpawnWOF(player.position); - break; - case 13: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("HiveMind")); - break; - case 14: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronHead); - break; - case 15: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); - break; - case 16: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); - break; - case 17: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - break; - case 18: - int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 2, 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)); - break; - case 19: - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && (Main.npc[doom].type == 493 || Main.npc[doom].type == 422 || Main.npc[doom].type == 507 || - Main.npc[doom].type == 517)) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - 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); - break; - case 20: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); - break; - case 21: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); - break; - case 22: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); - break; - case 23: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); - break; - case 24: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); - break; - case 25: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); - break; - case 26: - 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); - break; - case 27: - NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 101))), (int)(player.position.Y - 250f), NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, 255); - break; - case 28: - NPC.SpawnOnPlayer(player.whoAmI, NPCID.MoonLordCore); - break; - case 29: - ChangeTime(false); - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHead")); - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHeadSpectral")); - break; - case 30: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); - break; - case 31: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); - break; - case 32: - ChangeTime(false); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); - break; - case 33: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Siren")); - break; - case 34: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); - break; - case 35: - ChangeTime(true); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); - break; - case 36: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); - break; - case 37: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); - break; - case 38: - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DevourerofGodsHeadS")); - break; - } - } - } - } - } - else - { - CalamityWorld.bossRushSpawnCountdown = 180; - if (bossRushStage != 0) - { - bossRushStage = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(bossRushStage); - netMessage.Send(); - } - } - } - #endregion - #region LORESTATUR - soulEssence = 0 + - (NPC.downedSlimeKing ? 20 : 0) + //20 - (NPC.downedBoss1 ? 30 : 0) + //50 - (NPC.downedBoss2 ? 50 : 0) + //100 - (NPC.downedBoss3 ? 100 : 0) + //200 - (NPC.downedQueenBee ? 50 : 0) + //250 - (NPC.downedMechBoss1 ? 250 : 0) + //500 - (NPC.downedMechBoss2 ? 300 : 0) + //800 - (NPC.downedMechBoss3 ? 350 : 0) + //1150 - (NPC.downedPlantBoss ? 450 : 0) + //1600 - (NPC.downedGolemBoss ? 500 : 0) + //2100 - (NPC.downedAncientCultist ? 600 : 0) + //2700 - (NPC.downedMoonlord ? 1000 : 0) + //3700 - (CalamityWorld.downedDesertScourge ? 50 : 0) + //3750 - (CalamityWorld.downedCrabulon ? 50 : 0) + //3800 - ((CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator) ? 100 : 0) + //3900 - (CalamityWorld.downedSlimeGod ? 200 : 0) + //4100 - (Main.hardMode ? 200 : 0) + //4300 - (CalamityWorld.downedCryogen ? 250 : 0) + //4550 - (CalamityWorld.downedAquaticScourge ? 300 : 0) + //4850 - (CalamityWorld.downedBrimstoneElemental ? 350 : 0) + //5200 - (CalamityWorld.downedCalamitas ? 400 : 0) + //5600 - (CalamityWorld.downedLeviathan ? 800 : 0) + //6400 - (CalamityWorld.downedAstrageldon ? 400 : 0) + //6800 - (CalamityWorld.downedStarGod ? 700 : 0) + //7500 - (CalamityWorld.downedPlaguebringer ? 800 : 0) + //8300 - (CalamityWorld.downedScavenger ? 800 : 0) + //9100 - (NPC.downedFishron ? 800 : 0) + //9900 - (CalamityWorld.downedGuardians ? 900 : 0) + //10800 - (CalamityWorld.downedProvidence ? 2500 : 0) + //13300 - (CalamityWorld.downedSentinel1 ? 1000 : 0) + //14300 - (CalamityWorld.downedSentinel2 ? 1000 : 0) + //15300 - (CalamityWorld.downedSentinel3 ? 2000 : 0) + //17300 - (CalamityWorld.downedPolterghast ? 2700 : 0) + //20000 - (CalamityWorld.downedDoG ? 4000 : 0) + //24000 - (CalamityWorld.downedBumble ? 1000 : 0) + //25000 - (CalamityWorld.downedYharon ? 5000 : 0) + //30000 - (CalamityWorld.downedSCal ? 7500 : 0); //37500 - #endregion - #region RevengeanceEffects - if (CalamityWorld.revenge && 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 > 120) - { - player.immuneTime = 120; - } - int stressGain = 0; - if (rageMode) - { - stressGain = -2000; - } - else - { - if (draedonsHeart) - { - if (draedonsStressGain) - { - stressGain += 50; - } - } - else if (heartOfDarkness) - { - stressGain += 35; - } - } - stressCD++; - if (stressCD >= 60) - { - stressCD = 0; - stress += stressGain; - if (stress < 0) - { - stress = 0; - } - if (stress >= stressMax) - { - stress = stressMax; - } - } - stressLevel500 = stress >= 9800; - if (stressLevel500 && !hAttack) - { - if (Main.rand.Next(10000) == 0) - { - player.AddBuff(mod.BuffType("HeartAttack"), 18000); - } - } - if (adrenaline >= adrenalineMax) - { - adrenalineMaxTimer--; - if (adrenalineMaxTimer <= 0) - { - adrenalineDmgDown--; - if (adrenalineDmgDown < 0) - adrenalineDmgDown = 0; - adrenalineMaxTimer = 0; - } - } - else if (!adrenalineMode && adrenaline <= 0) - { - adrenalineDmgDown = 600; - adrenalineMaxTimer = 300; - adrenalineDmgMult = 1f; - } - adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 120); - if (adrenalineDmgMult < 0.25f) - adrenalineDmgMult = 0.25f; - int adrenalineGain = 0; - if (adrenalineMode) - { - adrenalineGain = (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) ? -10000 : -2000); - } - else - { - if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > - { - adrenaline = 0; - } - else if (CalamityGlobalNPC.AnyBossNPCS() || CalamityGlobalNPC.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 - } - else - { - adrenaline = 0; - } - } - adrenalineCD++; - if (adrenalineCD >= (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) ? 135 : 60)) - { - adrenalineCD = 0; - adrenaline += adrenalineGain; - if (adrenaline < 0) - { - adrenaline = 0; - } - if (adrenaline >= adrenalineMax) - { - adrenaline = adrenalineMax; - } - } - } - else if (!CalamityWorld.revenge && 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 (CalamityWorld.revenge) - { - player.thrownDamage += 0.05f; - player.rangedDamage += 0.05f; - player.meleeDamage += 0.05f; - player.magicDamage += 0.05f; - player.minionDamage += 0.05f; - } - #endregion - #region StressTiedEffects - if (stressPills) - { - player.statDefense += 5; - player.meleeCrit += 5; - player.meleeDamage += 0.05f; - player.magicCrit += 5; - player.magicDamage += 0.05f; - player.rangedCrit += 5; - player.rangedDamage += 0.05f; - player.thrownCrit += 5; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - } - if (laudanum) - { - player.statDefense += 8; - player.meleeCrit += 6; - player.meleeDamage += 0.06f; - player.magicCrit += 6; - player.magicDamage += 0.06f; - player.rangedCrit += 6; - player.rangedDamage += 0.06f; - player.thrownCrit += 6; - player.thrownDamage += 0.06f; - player.minionDamage += 0.06f; - } - 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 += 50; - } - if (hAttack) - { - if (heartOfDarkness || draedonsHeart) - { - player.thrownDamage += 0.1f; - player.rangedDamage += 0.1f; - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - } - player.lifeRegen += 1; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; - } - if (affliction) - { - player.lifeRegen += CalamityWorld.revenge ? 2 : 1; - player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; - player.statDefense += CalamityWorld.revenge ? 20 : 15; - player.thrownDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.rangedDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.meleeDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.magicDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.minionDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); - } - else if (afflicted) - { - player.lifeRegen += CalamityWorld.revenge ? 2 : 1; - player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; - player.statDefense += CalamityWorld.revenge ? 20 : 15; - player.thrownDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.rangedDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.meleeDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.magicDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.minionDamage += CalamityWorld.revenge ? 0.12f : 0.1f; - player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); - } - if (afflictedBuff) { afflicted = true; } - #endregion - #region MaxLifeAndManaBoosts - player.statLifeMax2 += - (mFruit ? 25 : 0) + - (bOrange ? 25 : 0) + - (eBerry ? 25 : 0) + - (dFruit ? 25 : 0); - if (silvaSet && silvaHitCounter > 0) - { - player.statLifeMax2 -= silvaHitCounter * 100; - if (player.statLifeMax2 < 200) - { - player.statLifeMax2 = 200; - } - } - player.statManaMax2 += - (pHeart ? 50 : 0) + - (eCore ? 50 : 0) + - (cShard ? 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 && NPC.downedMoonlord) { Main.rainTexture = rain3; } - else { Main.rainTexture = rainOriginal; } - if (auricSet) { Main.flyingCarpetTexture = carpetAuric; } - else { Main.flyingCarpetTexture = carpetOriginal; } - } - #endregion - #region MiscEffects - if (Main.myPlayer == player.whoAmI) - { - BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; - } - if (silvaSet || invincible) - { - List debuffList = new List(39) - { - 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, - mod.BuffType("BrimstoneFlames"), - mod.BuffType("BurningBlood"), - mod.BuffType("GlacialState"), - mod.BuffType("GodSlayerInferno"), - mod.BuffType("HolyLight"), - mod.BuffType("Irradiated"), - mod.BuffType("Plague"), - mod.BuffType("BrimstoneFlames"), - mod.BuffType("AbyssalFlames") - }; - foreach (int debuff in debuffList) { player.buffImmune[debuff] = true; } - } - 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) - { - player.breath--; - } - } - } - if (ZoneAbyss) - { - if (abyssalAmulet) { player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 15 : 10); } - player.detectCreature = false; - if (player.chaosState && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && Main.netMode != 1) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("EidolonWyrmHeadHuge")); - } - if (Main.myPlayer == player.whoAmI) //4200 total tiles small world - { - Point point = player.Center.ToTileCoordinates(); - int breathLoss = 2; - int lightStrength = 0 + - ((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1 - (player.arcticDivingGear ? 1 : 0) + //2 - (jellyfishNecklace ? 1 : 0) + //3 - ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //5 - ((shine || lumenousAmulet) ? 2 : 0) + //7 - ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //10 - 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; } - if (!depthCharm) { player.bleed = true; } - player.statDefense -= (anechoicPlating ? 40 : 120); - } - else if (ZoneAbyssLayer3) //2700 to 3200 - { - breathLoss = 18; - if (!lightLevelThree) { player.blind = true; } - if (!lightLevelTwo) { player.headcovered = true; } - if (!depthCharm) { player.bleed = true; } - player.statDefense -= (anechoicPlating ? 20 : 60); - } - else if (ZoneAbyssLayer2) //2100 to 2700 - { - breathLoss = 6; - if (!lightLevelTwo) { player.blind = true; } - if (!depthCharm) { player.bleed = true; } - 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 - (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 - (player.accMerman ? 15.0 : 0.0) + //45 - (victideSet ? 5.0 : 0.0) + //50 - (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //65 - (abyssalDivingSuit ? 15.0 : 0.0); //80 - if (tickMult > 50.0) { tickMult = 50.0; } - tick = (int)((double)tick * tickMult); - abyssBreathCD++; - if (player.gills || player.merman) - { - player.breath -= 3; - } - if (abyssBreathCD >= tick) - { - abyssBreathCD = 0; - player.breath -= breathLoss; - if (cDepth) - { - player.breath -= 1; - } - if (player.breath <= 0) - { - int lifeLoss = 6 + - (player.bleed ? 6 : 0) - - (depthCharm ? 3 : 0); - player.statLife -= lifeLoss; - if (player.statLife <= 0) - { - KillPlayer(); - } - } - } - } - } - else - { - abyssBreathCD = 0; - } - if ((Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) || - (aeroSet && !Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) - { - player.maxFallSpeed = 15f; - } - if (revivifyTimer > 0) { revivifyTimer--; } - if (fleshTotemCooldown > 0) { fleshTotemCooldown--; } - if (astralStarRainCooldown > 0) { astralStarRainCooldown--; } - if (tarraMageHealCooldown > 0) { tarraMageHealCooldown--; } - if (ataxiaDmg > 0) { ataxiaDmg--; } - if (xerocDmg > 0) { xerocDmg--; } - if (godSlayerDmg > 0) { godSlayerDmg--; } - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - silvaCountdown--; - 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 (tarraRanged) - { - if (tarraRangedCritTimer > 0) { tarraRangedCritTimer--; } - if (tarraRangedCritTimer <= 0) - { - if (tarraRangedCrits > 0) { tarraRangedCrits -= 10; } - if (tarraRangedCrits < 0) { tarraRangedCrits = 0; } - tarraRangedCritTimer = 120; - } - } - if (tarraThrowing) - { - if (tarraThrowingCritTimer > 0) { tarraThrowingCritTimer--; } - if (tarraThrowingCrits >= 25) - { - tarraThrowingCrits = 0; - tarraThrowingCritTimer = 1800; - player.immune = true; - player.immuneTime = 300; - } - List debuffList = new List(47) - { - 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, - mod.BuffType("BrimstoneFlames"), - mod.BuffType("BurningBlood"), - mod.BuffType("GlacialState"), - mod.BuffType("GodSlayerInferno"), - mod.BuffType("HolyLight"), - mod.BuffType("Irradiated"), - mod.BuffType("Plague"), - mod.BuffType("BrimstoneFlames"), - mod.BuffType("AbyssalFlames"), - mod.BuffType("CrushDepth"), - mod.BuffType("ExtremeGrav"), - mod.BuffType("ExtremeGravity"), - mod.BuffType("Horror"), - mod.BuffType("MarkedforDeath"), - mod.BuffType("Warped"), - mod.BuffType("WeakPetrification"), - mod.BuffType("VulnerabilityHex") - }; - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = debuffList.Contains(hasBuff); - if (shouldAffect) - { - player.thrownDamage += 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 (bloodflareMage) - { - if (bloodflareMageCritTimer > 0) { bloodflareMageCritTimer--; } - if (bloodflareMageCritTimer <= 0) - { - if (bloodflareMageCrits > 0) { bloodflareMageCrits -= 10; } - if (bloodflareMageCrits < 0) { bloodflareMageCrits = 0; } - bloodflareMageCritTimer = 120; - } - } - if (Main.raining && NPC.downedMoonlord) - { - if (player.ZoneOverworldHeight || player.ZoneSkyHeight) { player.AddBuff(mod.BuffType("Irradiated"), 2); } - } - if (raiderTalisman) { player.thrownDamage += ((float)raiderStack / 50f) * 0.15f; } - if (tarraRangedCrits > 150) { tarraRangedCrits = 150; } - if (tarraRanged) { player.rangedDamage += (float)(tarraRangedCrits / 15); } - if (bloodflareMageCrits > 150) { bloodflareMageCrits = 150; } - if (bloodflareMage) { player.magicDamage += (float)(bloodflareMageCrits / 10); } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage) - { - player.magicCrit += 10; - } - 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.06f; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 3; - player.manaRegenBonus += 2; - } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - player.endurance += 0.07f; - 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.06f; - player.pickSpeed -= 0.5f; - 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 += 4; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 2; - player.lifeRegen += 4; - } - 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, 0.55f, 1.5f, 0.55f); - } - 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; - } - #endregion - #region StandingStillEffects - if (aquaticEmblem) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !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) * 40f); - player.moveSpeed -= (1f - aquaticBoost) * 0.15f; - } - if (auricBoost) - { - if (player.itemAnimation > 0) - { - modStealthTimer = 5; - } - if ((double)player.velocity.X > -0.1 && (double)player.velocity.X < 0.1 && (double)player.velocity.Y > -0.1 && (double)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; - } - } - player.meleeDamage += (1f - modStealth) * 0.2f; - player.meleeCrit += (int)((1f - modStealth) * 20f); - player.rangedDamage += (1f - modStealth) * 0.2f; - player.rangedCrit += (int)((1f - modStealth) * 20f); - player.magicDamage += (1f - modStealth) * 0.2f; - player.magicCrit += (int)((1f - modStealth) * 20f); - player.thrownDamage += (1f - modStealth) * 0.2f; - player.thrownCrit += (int)((1f - modStealth) * 20f); - player.minionDamage += (1f - modStealth) * 0.2f; - if (modStealthTimer > 0) - { - modStealthTimer--; - } - } - else if (pAmulet) - { - if (player.itemAnimation > 0) - { - modStealthTimer = 5; - } - if ((double)player.velocity.X > -0.1 && (double)player.velocity.X < 0.1 && (double)player.velocity.Y > -0.1 && (double)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; - } - } - player.meleeDamage += (1f - modStealth) * 0.25f; - player.meleeCrit += (int)((1f - modStealth) * 25f); - 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); - } - player.rangedDamage += (5f - shieldInvinc) * 0.02f; - player.rangedCrit += (int)((5f - shieldInvinc) * 2f); - player.meleeDamage += (5f - shieldInvinc) * 0.02f; - player.meleeCrit += (int)((5f - shieldInvinc) * 2f); - player.magicDamage += (5f - shieldInvinc) * 0.02f; - player.magicCrit += (int)((5f - shieldInvinc) * 2f); - player.minionDamage += (5f - shieldInvinc) * 0.02f; - player.thrownDamage += (5f - shieldInvinc) * 0.02f; - player.thrownCrit += (int)((5f - shieldInvinc) * 2f); - player.aggro += (int)((5f - shieldInvinc) * 220f); - player.statDefense += (int)((5f - shieldInvinc) * 5f); - 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 SeasonalChecks - if (Main.netMode != 2) - { - if (Main.time == 0.0) - { - runCheck = 0; - } - if (runCheck == 0) - { - CalamityWorld.checkSpring(); - CalamityWorld.checkSummer(); - CalamityWorld.checkFall(); - CalamityWorld.checkWinter(); - runCheck++; - } - } - #endregion - #region OtherBuffs - if (irradiated) - { - player.statDefense -= 5 + - (CalamityWorld.revenge ? 5 : 0); - player.endurance -= 0.05f + - (CalamityWorld.revenge ? 0.05f : 0f); - player.meleeCrit += 5; - player.meleeDamage += 0.05f; - player.magicCrit += 5; - player.magicDamage += 0.05f; - player.rangedCrit += 5; - player.rangedDamage += 0.05f; - player.thrownCrit += 5; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - player.minionKB += 0.5f; - player.moveSpeed += 0.05f; - } - if (rRage) - { - player.meleeCrit += 5; - player.meleeDamage += 0.05f; - player.magicCrit += 5; - player.magicDamage += 0.05f; - player.rangedCrit += 5; - player.rangedDamage += 0.05f; - player.thrownCrit += 5; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - player.meleeSpeed -= 0.05f; - player.moveSpeed += 0.05f; - } - if (xRage) - { - player.thrownDamage += 0.1f; - player.rangedDamage += 0.1f; - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - } - if (xWrath) - { - player.meleeCrit += 10; - player.magicCrit += 10; - player.rangedCrit += 10; - player.thrownCrit += 10; - } - if (godSlayerCooldown) - { - player.thrownDamage += 0.1f; - player.rangedDamage += 0.1f; - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - } - if (graxDefense) - { - player.statDefense += 15; - player.endurance += 0.05f; - player.meleeSpeed -= 0.05f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - } - if (sMeleeBoost) - { - player.meleeSpeed -= 0.05f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - } - if (tFury) - { - player.meleeDamage += 0.3f; - player.meleeCrit += 30; - } - if (yPower) - { - player.endurance += 0.05f; - player.statDefense += 5; - player.meleeCrit += 5; - player.meleeDamage += 0.05f; - player.meleeSpeed -= 0.05f; - player.magicCrit += 5; - player.magicDamage += 0.05f; - player.rangedCrit += 5; - player.rangedDamage += 0.05f; - player.thrownCrit += 5; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - player.minionKB += 1f; - player.moveSpeed += 0.15f; - } - if (tScale) - { - player.endurance += 0.05f; - player.statDefense += 5; - player.kbBuff = true; - } - if (fabsolVodka) - { - player.thrownDamage += 0.1f; - player.rangedDamage += 0.1f; - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - player.statDefense -= 20; - } - if (nanotech && player.inventory[player.selectedItem].thrown) - { - player.endurance += 0.1f; - player.statDefense += 15; - } - if (harpyRing) - { - if (player.wingTimeMax > 0) - { - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); - } - player.moveSpeed += 0.2f; - } - 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 regenBoost = 1 + (integerTypeBoost / 5); - player.endurance += (floatTypeBoost * 0.5f); - player.statDefense += integerTypeBoost; - player.meleeCrit += integerTypeBoost; - player.meleeDamage += floatTypeBoost; - player.meleeSpeed -= (floatTypeBoost * 0.25f); - player.magicCrit += integerTypeBoost; - player.magicDamage += floatTypeBoost; - player.rangedCrit += integerTypeBoost; - player.rangedDamage += floatTypeBoost; - player.thrownCrit += integerTypeBoost; - player.thrownDamage += floatTypeBoost; - player.minionDamage += floatTypeBoost; - player.minionKB += floatTypeBoost; - player.moveSpeed += floatTypeBoost; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; - if (player.lifeRegen < 0) - { - player.lifeRegen += regenBoost; - } - if (player.wingTimeMax > 0) - { - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); - } - } - if (CalamityWorld.defiled) - { - player.statLifeMax2 /= 2; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - } - if (reaperToothNecklace) - { - player.meleeCrit += 25; - player.meleeDamage += 0.25f; - player.magicCrit += 25; - player.magicDamage += 0.25f; - player.rangedCrit += 25; - player.rangedDamage += 0.25f; - player.thrownCrit += 25; - player.thrownDamage += 0.25f; - player.minionDamage += 0.25f; - } - if (coreOfTheBloodGod) - { - if (player.whoAmI == Main.myPlayer && Main.netMode != 1) - { - int drain = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 476, 40, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[drain].usesLocalNPCImmunity = true; - Main.projectile[drain].localNPCHitCooldown = 5; - } - player.endurance += 0.1f; - player.meleeCrit += 12; - player.meleeDamage += 0.12f; - player.magicCrit += 12; - player.magicDamage += 0.12f; - player.rangedCrit += 12; - player.rangedDamage += 0.12f; - player.thrownCrit += 12; - player.thrownDamage += 0.12f; - player.minionDamage += 0.12f; - if (player.statDefense < 100) - { - player.meleeDamage += 0.15f; - player.magicDamage += 0.15f; - player.rangedDamage += 0.15f; - player.thrownDamage += 0.15f; - player.minionDamage += 0.15f; - } - } - else if (bloodflareCore) - { - if (player.whoAmI == Main.myPlayer && Main.netMode != 1) - { - int drain = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 476, 40, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[drain].usesLocalNPCImmunity = true; - Main.projectile[drain].localNPCHitCooldown = 8; - } - if (player.statDefense < 100) - { - player.meleeDamage += 0.15f; - player.magicDamage += 0.15f; - player.rangedDamage += 0.15f; - player.thrownDamage += 0.15f; - player.minionDamage += 0.15f; - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.15f; - player.meleeCrit += 15; - player.meleeDamage += 0.15f; - player.magicCrit += 15; - player.magicDamage += 0.15f; - player.rangedCrit += 15; - player.rangedDamage += 0.15f; - player.thrownCrit += 15; - player.thrownDamage += 0.15f; - player.minionDamage += 0.15f; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.endurance += 0.1f; - player.meleeCrit += 10; - player.meleeDamage += 0.1f; - player.magicCrit += 10; - player.magicDamage += 0.1f; - player.rangedCrit += 10; - player.rangedDamage += 0.1f; - player.thrownCrit += 10; - player.thrownDamage += 0.1f; - player.minionDamage += 0.1f; - } - } - if (godSlayerThrowing) - { - if (player.statLife >= player.statLifeMax2) - { - player.thrownCrit += 15; - player.thrownDamage += 0.15f; - player.thrownVelocity += 0.15f; - } - } - if (tarraSummon) - { - int lifeCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); - float num2 = 300f; - bool flag = lifeCounter % 60 == 0; - int num3 = 300; - 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 (bloodflareThrowing) - { - if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) - { - player.thrownCrit += 5; - player.statDefense += 30; - } - else - { - player.thrownDamage += 0.15f; - } - } - if (bloodflareSummon) - { - if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) - { - player.minionDamage += 0.15f; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.statDefense += 20; - player.lifeRegen += 3; - } - if (bloodflareSummonTimer > 0) { bloodflareSummonTimer--; } - if (Main.netMode != 1 && bloodflareSummonTimer <= 0) - { - bloodflareSummonTimer = 900; - for (int I = 0; I < 3; I++) - { - float ai1 = (float)(I * 120); - int mine = 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); - } - } - } - #endregion - #region DRAndDamageLimits - if (CalamityWorld.revenge) - { - if (player.lifeRegenTime > defLifeRegenTime) - { - int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; - player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); - } - if (player.lifeRegen > defLifeRegen) - { - int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; - player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); - } - if (player.endurance > defEndurance) //0.33 - { - float damageReductionAboveCap = player.endurance - defEndurance; //0.6 - 0.33 = 0.27 - player.endurance = defEndurance + (damageReductionAboveCap * 0.1f); //0.33 + (0.27 * 0.1) = 0.357 - } - if (!dsSetBonus) - { - if (player.meleeDamage > defDamage) - { - float damageAboveCap = player.meleeDamage - defDamage; - player.meleeDamage = defDamage + (damageAboveCap * 0.25f); - } - if (auricSet && silvaMelee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - player.meleeDamage += (float)(multiplier * 0.5); //ranges from 1.5 times to 1 times - } - if (player.rangedDamage > defDamage) - { - float damageAboveCap = player.rangedDamage - defDamage; - player.rangedDamage = defDamage + (damageAboveCap * 0.25f); - } - if (player.magicDamage > defDamage) - { - float damageAboveCap = player.magicDamage - defDamage; - player.magicDamage = defDamage + (damageAboveCap * 0.25f); - } - if (player.thrownDamage > defDamage) - { - float damageAboveCap = player.thrownDamage - defDamage; - player.thrownDamage = defDamage + (damageAboveCap * 0.25f); - } - if (!auricSet) - { - if (player.minionDamage > defDamage) - { - float damageAboveCap = player.minionDamage - defDamage; - player.minionDamage = defDamage + (damageAboveCap * 0.25f); - } - } - if (player.meleeCrit > defCrit) - { - int critAboveCap = player.meleeCrit - defCrit; - player.meleeCrit = defCrit + (int)((double)critAboveCap * 0.1); - } - if (player.rangedCrit > defCrit) - { - int critAboveCap = player.rangedCrit - defCrit; - player.rangedCrit = defCrit + (int)((double)critAboveCap * 0.1); - } - if (player.magicCrit > defCrit) - { - int critAboveCap = player.magicCrit - defCrit; - player.magicCrit = defCrit + (int)((double)critAboveCap * 0.1); - } - if (player.thrownCrit > defCrit) - { - int critAboveCap = player.thrownCrit - defCrit; - player.thrownCrit = defCrit + (int)((double)critAboveCap * 0.1); - } - } - if (rageMode && adrenalineMode) - { - player.thrownDamage += (CalamityWorld.death ? 12f : 3f); - player.rangedDamage += (CalamityWorld.death ? 12f : 3f); - player.meleeDamage += (CalamityWorld.death ? 12f : 3f); - player.magicDamage += (CalamityWorld.death ? 12f : 3f); - } - else if (rageMode) - { - float rageDamageBoost = 0f + - (rageBoostOne ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f) + //4.8 or 1.2 - (rageBoostTwo ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f) + //5.6 or 1.4 - (rageBoostThree ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f); //6.4 or 1.6 - float rageDamage = (CalamityWorld.death ? 4f : 1f) + rageDamageBoost; - player.thrownDamage += rageDamage; - player.rangedDamage += rageDamage; - player.meleeDamage += rageDamage; - player.magicDamage += rageDamage; - } - else if (adrenalineMode) - { - float adrenalineDamageMult = (CalamityWorld.death ? 10f : 2.5f) * adrenalineDmgMult; - player.thrownDamage += adrenalineDamageMult; - player.rangedDamage += adrenalineDamageMult; - player.meleeDamage += adrenalineDamageMult; - player.magicDamage += adrenalineDamageMult; - } - } - if (dArtifact) - { - player.meleeCrit += 15; - player.meleeDamage += 0.15f; - player.magicCrit += 15; - player.magicDamage += 0.15f; - player.rangedCrit += 15; - player.rangedDamage += 0.15f; - player.thrownCrit += 15; - player.thrownDamage += 0.15f; - } - if (eArtifact) - { - player.meleeSpeed -= 0.1f; - player.manaCost *= 0.75f; - player.thrownDamage += 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 && Main.netMode != 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - if (marked || reaperToothNecklace) - { - player.endurance *= 0.5f; - } - if (reaperToothNecklace) - { - player.statDefense /= 2; - } - #endregion - #region DespawnProjectilesWhenRageOrAdrenalineStop - if (player.whoAmI == Main.myPlayer) - { - if ((rageMode || adrenalineMode) && !despawnProj) - { - despawnProj = true; - } - if (!rageMode && !adrenalineMode && despawnProj) - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if ((projectile.active && projectile.owner == Main.myPlayer && - (projectile.friendly || projectile.timeLeft > 300) && - !projectile.hostile && !projectile.minion && projectile.aiStyle != 7 && !projectile.sentry) || - projectile.aiStyle == 36) - { - projectile.Kill(); - } - proj = x; - } - despawnProj = false; - } - } - #endregion - } - - public override void PostUpdateRunSpeeds() - { - #region SpeedBoosts - if (hAttack) - { - if (!Main.dayTime) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - } - if (stressPills || laudanum) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (abyssalDivingSuit) - { - player.runAcceleration *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; - player.maxRunSpeed *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; - } - if (sirenWaterBuff) - { - player.runAcceleration *= 1.15f; - player.maxRunSpeed *= 1.15f; - } - if (frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) - { - player.runAcceleration *= 1.15f; - player.maxRunSpeed *= 1.15f; - } - if (shadowSpeed) - { - player.runAcceleration *= 1.5f; - player.maxRunSpeed *= 1.5f; - } - else if (auricSet) - { - player.runAcceleration *= 1.1f; - player.maxRunSpeed *= 1.1f; - } - else if (silvaSet) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (cTracers) - { - player.runAcceleration *= 1.1f; - player.maxRunSpeed *= 1.1f; - } - else if (eTracers) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (horror) - { - player.runAcceleration *= 0.85f; - player.maxRunSpeed *= 0.85f; - } - if (elysianGuard) - { - player.runAcceleration *= 0.5f; - player.maxRunSpeed *= 0.5f; - } - #endregion - #region DashEffects - if (player.pulley && dashMod > 0) - { - ModDashMovement(); - } - else if (player.grappling[0] == -1 && !player.tongued) - { - if (dashMod > 0) - { - ModHorizontalMovement(); - 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) - { - 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); - 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; - } - } - player.statLife += 150; - player.HealEffect(150); - player.AddBuff(mod.BuffType("GodSlayerCooldown"), 2700); - return false; - } - if (silvaSet && silvaCountdown > 0) - { - if (hasSilvaEffect) - { - silvaHitCounter++; - } - 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++; - } - } - if (CalamityWorld.ironHeart && CalamityGlobalNPC.AnyBossNPCS()) - { - KillPlayer(); - return false; - } - return true; - } - #endregion - - #region UseTimeMult - public override float UseTimeMultiplier(Item item) - { - if (silvaRanged && item.ranged && item.useTime > 3) - { - return (auricSet ? 1.2f : 1.1f); - } - if (player.statLife > (int)((double)player.statLifeMax2 * 0.9) && silvaThrowing && item.thrown && item.useTime > 3) - { - return 1.1f; - } - return 1f; - } - #endregion - - #region MeleeSpeedMult - public override float MeleeSpeedMultiplier(Item item) - { - if (player.meleeSpeed > 1.3f && !eArtifact) - { - return (1.3f / player.meleeSpeed); - } - return 1f; - } - #endregion - - #region GetWeaponDamageAndKB - public override void GetWeaponDamage(Item item, ref int damage) - { - if (dodgeScarf && item.melee && item.shoot == 0) - { - damage = (int)((double)damage * 1.2); - } - if (flamethrowerBoost && item.ranged && item.useAmmo == 23) - { - damage = (int)((double)damage * 1.25); - } - if (item.type == ItemID.TerraBlade) - { - damage = (int)((double)damage * 1.66); - } - } - - public override void GetWeaponKnockback(Item item, ref float knockback) - { - if (pAmulet && item.melee) - { - knockback *= 1f + (1f - modStealth) * 0.5f; - } - if (auricBoost) - { - knockback *= 1f + (1f - modStealth) * 0.5f; - } - } - #endregion - - #region Shoot - public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (eArtifact && item.ranged) - { - speedX *= 1.25f; - speedY *= 1.25f; - } - if (bloodflareMage && item.magic && Main.rand.Next(0, 100) >= 95) //0 - 99 - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * 2.6), 1f, player.whoAmI, 0f, 0f); - } - } - if (bloodflareRanged && item.ranged && Main.rand.Next(0, 100) >= (auricSet ? 98 : 95)) //0 - 99 - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * 1.6), 2f, player.whoAmI, 0f, 0f); - } - } - if (tarraMage && tarraCrits >= 5) - { - 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 (ataxiaBolt && item.ranged && 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 (godSlayerRanged && item.ranged && Main.rand.Next(0, 100) >= 95) //0 - 99 - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * 2.1), 2f, player.whoAmI, 0f, 0f); - } - } - if (ataxiaVolley && item.thrown && 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.25), 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.25), 1.25f, player.whoAmI, 0f, 0f); - } - } - } - if (reaverDoubleTap && item.ranged && Main.rand.Next(0, 100) >= 90) //0 - 99 - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.8), 2f, player.whoAmI, 0f, 0f); - } - } - if (victideSet && (item.ranged || item.melee || item.magic || item.thrown || item.summon) && 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 MeleeEffects - public override void MeleeEffects(Item item, Rectangle hitbox) - { - if (aWeapon && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 && item.melee && !item.noMelee && !item.noUseGraphic) - { - 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 (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 (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 (aChicken) - { - 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 (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 (ataxiaGeyser && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)item.damage * 0.25), 2f, player.whoAmI, 0f, 0f); - } - } - if (target.type == NPCID.TargetDummy) - { - return; - } - if (bloodflareMelee) - { - if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) - { - bloodflareMeleeHits++; - } - if (player.whoAmI == Main.myPlayer) - { - int healAmount = (Main.rand.Next(5) + 1); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } - #endregion - - #region OnHitNPCWithProj - public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) - { - if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("SilvaStun"), 20); - } - if (target.type != NPCID.TargetDummy) - { - if (player.whoAmI == Main.myPlayer && raiderTalisman && raiderStack < 50 && proj.thrown && crit) - { - raiderStack++; - } - if (CalamityWorld.revenge && player.whoAmI == Main.myPlayer) - { - if ((proj.melee && proj.ownerHitCheck) || proj.aiStyle == 15 || (proj.aiStyle == 75 && proj.melee) || - proj.type == mod.ProjectileType("Nebulash") || proj.type == mod.ProjectileType("CosmicDischarge") || - proj.type == mod.ProjectileType("MourningStar")) - { - 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 ModifyHitNPC - public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) - { - if (silvaMelee && Main.rand.Next(4) == 0) - { - damage *= 5; - } - if (target.type != NPCID.TargetDummy) - { - if (CalamityWorld.revenge && player.whoAmI == Main.myPlayer) - { - if (item.shoot == 0 || item.shoot == mod.ProjectileType("NobodyKnows")) - { - 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; - } - } - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) - { - if (player.whoAmI == Main.myPlayer) - { - astralStarRainCooldown = 120; - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = 92; - } - else - { - projectileType = 12; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - } - } - - public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (auricSet && silvaThrowing && proj.thrown && crit && player.statLife > (int)((double)player.statLifeMax2 * 0.9)) - { - damage = (int)((double)damage * 3.5); - } - if (auricSet && silvaMelee && proj.melee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - if (multiplier < 0.4) - { - multiplier = 0.4; - } - damage = (int)(((double)damage * multiplier) * 2.5); //ranges from 2.5 times to 1 times - } - if (godSlayerRanged && crit && proj.ranged) - { - int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap - if (randomChance < 15) - { - randomChance = 15; - } - if (Main.rand.Next(randomChance) == 0) - { - damage *= 2; - } - } - if (tarraMage && crit && proj.magic) - { - tarraCrits++; - } - if (tarraRanged && tarraRangedCrits < 150 && tarraRangedCritTimer <= 105 && crit && proj.ranged) - { - tarraRangedCrits++; - if (tarraRangedCrits > 150) { tarraRangedCrits = 150; } - tarraRangedCritTimer = 120; - } - if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && proj.thrown) - { - tarraThrowingCrits++; - } - if (bloodflareThrowing && proj.thrown && crit) - { - if (player.whoAmI == Main.myPlayer) - { - player.statLife += 1; - player.HealEffect(1); - } - } - if (bloodflareMage && bloodflareMageCrits < 150 && bloodflareMageCritTimer <= 105 && crit && proj.magic) - { - bloodflareMageCrits++; - if (bloodflareMageCrits > 150) { bloodflareMageCrits = 150; } - bloodflareMageCritTimer = 120; - } - if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) - { - damage = (int)((double)damage * 1.5); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.thrown) - { - damage = (int)((double)damage * 1.2); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - { - damage = (int)((double)damage * 1.1); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && proj.minion) - { - damage = (int)((double)damage * 1.15); - } - } - #endregion - - #region ModifyHitByNPC - public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) - { - if (fleshTotem && fleshTotemCooldown <= 0) - { - fleshTotemCooldown = 900; //15 seconds - damage /= 2; - } - if (tarraDefense && tarraMelee) - { - damage /= 2; - } - if (bloodflareMelee && bloodflareFrenzyTimer > 0) - { - damage /= 2; - } - if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) - { - damage /= 2; - } - } - #endregion - - #region ModifyHitByProj - public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) - { - if (cEnergy && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - damage = (int)((double)damage * 0.75); - } - if (beeResist) - { - int type = proj.type; - List beeProjectileList = new List(5) - { - ProjectileID.Stinger, - ProjectileID.HornetStinger, - mod.ProjectileType("PlagueStingerGoliath"), - mod.ProjectileType("PlagueStingerGoliathV2"), - mod.ProjectileType("PlagueExplosion") - }; - bool shouldAffect = beeProjectileList.Contains(type); - if (shouldAffect) { damage = (int)((double)damage * 0.75); } - } - if (Main.hardMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - List hardModeNerfList = new List(10) - { - 472, - 84, - 128, - 129, - 288, - 55, - 264, - 82, - 180, - 240 - }; - bool shouldAffect = hardModeNerfList.Contains(proj.type); - if (shouldAffect) - { - double multiplier = Main.expertMode ? 0.6 : 0.8; - damage = (int)((double)damage * multiplier); - } - } - } - #endregion - - #region OnHit - public override void OnHitByNPC(NPC npc, int damage, bool crit) - { - if (CalamityGlobalNPC.lordeBoss >= 0) - { - player.AddBuff(mod.BuffType("NOU"), 15, true); - } - } - - public override void OnHitByProjectile(Projectile proj, int damage, bool crit) - { - if (CalamityGlobalNPC.lordeBoss >= 0) - { - player.AddBuff(mod.BuffType("NOU"), 15, true); - } - if (proj.type == 257 && proj.hostile && Main.rand.Next(2) == 0 && !player.frozen && !gState) - { - player.AddBuff(mod.BuffType("GlacialState"), 120); - } - if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(10) == 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 (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 (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 < 120) - { - caughtType = mod.ItemType("Floodtide"); - } - if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 120) - { - caughtType = mod.ItemType("AlluringBait"); - } - if (power >= 80) - { - if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.Next(15) == 0 && power < 140) - { - 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 >= 100) - { - if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 160) - { - caughtType = mod.ItemType("AbyssalAmulet"); - } - } - } - } - } - } - } - #endregion - - #region FrameEffects - public override void FrameEffects() - { - 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 (NOU) - { - NOULOL(); - } - if (weakPetrification) - { - WeakPetrification(); - } - } - #endregion - - #region NOULOL - private void NOULOL() - { - player.ResetEffects(); - player.head = -1; - player.body = -1; - player.legs = -1; - player.handon = -1; - player.handoff = -1; - player.back = -1; - player.front = -1; - player.shoe = -1; - player.waist = -1; - player.shield = -1; - player.neck = -1; - player.face = -1; - player.balloon = -1; - NOU = true; - } - - 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; - } - #endregion - - #region HurtMethods - public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) - { - if (CalamityWorld.armageddon) - { - if (CalamityGlobalNPC.AnyBossNPCS()) - { - KillPlayer(); - } - } - if (lol || invincible) - { - return false; - } - if (godSlayerDamage && damage <= 80) - { - 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 - } - if (abyssalDivingSuitPlates) - { - damage = (int)((double)damage * 0.75); - } - if (sirenIce) - { - damage = (int)((double)damage * 0.75); - } - if (auricSet) - { - damage = (int)((double)damage * 0.9); - } - else if (silvaSet) - { - damage = (int)((double)damage * 0.95); - } - if (CalamityWorld.revenge) - { - if (NPC.golemBoss > 0) - { - damage = (int)((double)damage * CalamityGlobalNPC.golemDamageBonus); - } - else if (NPC.AnyNPCs(NPCID.MoonLordCore)) - { - damage = (int)((double)damage * 1.1); - } - else if (NPC.AnyNPCs(NPCID.CultistBoss)) - { - damage = (int)((double)damage * 1.2); - } - } - if (CalamityGlobalNPC.DraedonMayhem == 1) - { - damage = (int)((double)damage * 1.2); - } - if (Main.pumpkinMoon && CalamityWorld.downedDoG) - { - damage = (int)((double)damage * 1.4); - } - else if (Main.snowMoon && CalamityWorld.downedDoG) - { - damage = (int)((double)damage * 1.3); - } - else if (Main.eclipse && CalamityWorld.downedYharon) - { - damage = (int)((double)damage * 1.6); - } - if (dArtifact) - { - damage = (int)((double)damage * 1.25); - } - if (CalamityWorld.bossRushActive) - { - switch (bossRushStage) - { - case 0: - damage = (int)((double)damage * 3.0); //Tier 1 Queen Bee - break; - case 1: - damage = (int)((double)damage * 3.0); //BoC - break; - case 2: - damage = (int)((double)damage * 3.0); //King Slime - break; - case 3: - damage = (int)((double)damage * 4.0); //EoC - break; - case 4: - damage = (int)((double)damage * 2.0); //Prime - break; - case 5: - damage = (int)((double)damage * 1.75); //Golem - break; - case 6: - damage = (int)((double)damage * 1.25); //Guardians - break; - case 7: - damage = (int)((double)damage * 3.5); //EoW - break; - case 8: - damage = (int)((double)damage * 2.0); //Tier 2 Astrageldon - break; - case 9: - damage = (int)((double)damage * 3.0); //Destroyer - break; - case 10: - damage = (int)((double)damage * 3.0); //Twins - break; - case 11: - damage = (int)((double)damage * 1.0); //Birb - break; - case 12: - damage = (int)((double)damage * 3.5); //WoF - break; - case 13: - damage = (int)((double)damage * 4.0); //Hive Mind - break; - case 14: - damage = (int)((double)damage * 4.0); //Skeletron - break; - case 15: - damage = (int)((double)damage * 1.25); //Storm Weaver - break; - case 16: - damage = (int)((double)damage * 2.5); //Tier 3 Aquatic Scourge - break; - case 17: - damage = (int)((double)damage * 4.75); //Desert Scourge - break; - case 18: - damage = (int)((double)damage * 2.5); //Cultist - break; - case 19: - damage = (int)((double)damage * 4.75); //Crabulon - break; - case 20: - damage = (int)((double)damage * 2.5); //Plantera - break; - case 21: - damage = (int)((double)damage * 1.5); //Void - break; - case 22: - damage = (int)((double)damage * 4.75); //Perfs - break; - case 23: - damage = (int)((double)damage * 3.0); //Cryogen - break; - case 24: - damage = (int)((double)damage * 3.25); //Tier 4 Brimstone Elemental - break; - case 25: - damage = (int)((double)damage * 1.75); //Signus - break; - case 26: - damage = (int)((double)damage * 2.5); //Ravager - break; - case 27: - damage = (int)((double)damage * 3.25); //Fishron - break; - case 28: - damage = (int)((double)damage * 2.5); //Moon Lord - break; - case 29: - damage = (int)((double)damage * 2.5); //Astrum Deus - break; - case 30: - damage = (int)((double)damage * 1.75); //Polter - break; - case 31: - damage = (int)((double)damage * 2.5); //Plaguebringer - break; - case 32: - damage = (int)((double)damage * 4.0); //Tier 5 Calamitas - break; - case 33: - damage = (int)((double)damage * 3.5); //Levi and Siren - break; - case 34: - damage = (int)((double)damage * 4.75); //Slime God - break; - case 35: - damage = (int)((double)damage * 2.5); //Providence - break; - case 36: - damage = (int)((double)damage * 1.0); //SCal - break; - case 37: - damage = (int)((double)damage * 1.25); //Yharon - break; - case 38: - damage = (int)((double)damage * 2.0); //DoG - break; - } - } - if (enraged) - { - damage = (int)((double)damage * 1.5); - } - if (CalamityWorld.revenge) - { - if (player.ichor) - { - damage = (int)((double)damage * 1.25); - } - else if (player.onFire2) - { - damage = (int)((double)damage * 1.2); - } - customDamage = true; - float damageMult = CalamityWorld.downedBossAny ? 1.05f : 0.8f; - if (CalamityWorld.death) - { - damageMult = 1.5f; - } - damage = (int)((double)damage * damageMult); - double newDamage = (double)damage - (double)player.statDefense * 0.625; - double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 15.0 : 0.0); //5, 10, 15, 30 - if (newDamage < newDamageLimit) - { - newDamage = newDamageLimit; - } - damage = (int)newDamage; - } - if (bloodPact) - { - if (Main.rand.Next(4) == 0) - { - damage = (int)((double)damage * 3.0); - } - } - if (revivifyTimer > 0) - { - int healAmt = damage / 10; - 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 / 16; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - int newDamageLimit = 300; - if (damage < newDamageLimit) - { - damage = newDamageLimit; - } - } - return true; - } - - public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) - { - modStealth = 1f; - if (player.whoAmI == Main.myPlayer && rageMode) - { - stress = 0; - if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) { player.ClearBuff(mod.BuffType("RageMode")); } - } - if (player.whoAmI == Main.myPlayer && !adrenalineMode && adrenaline != adrenalineMax) - { - adrenaline = 0; - } - if (player.whoAmI == Main.myPlayer && gShell && !player.panic) - { - player.AddBuff(mod.BuffType("ShellBoost"), 300); - } - if (player.whoAmI == Main.myPlayer && 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 (player.whoAmI == Main.myPlayer && 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 && player.whoAmI == Main.myPlayer) - { - if (Main.rand.Next(4) == 0) - { - player.AddBuff(mod.BuffType("TarraLifeRegen"), Main.rand.Next(120, 360)); - } - } - if (player.whoAmI == Main.myPlayer && xerocSet) - { - player.AddBuff(mod.BuffType("XerocRage"), 240); - player.AddBuff(mod.BuffType("XerocWrath"), 240); - } - else if (player.whoAmI == Main.myPlayer && reaverBlast) - { - player.AddBuff(mod.BuffType("ReaverRage"), 180); - } - if ((fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) && Main.myPlayer == player.whoAmI) - { - 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 && Main.myPlayer == player.whoAmI) - { - 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 < 200; 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) - { - bool hardMode = Main.hardMode; - if (player.whoAmI == Main.myPlayer) - { - if (CalamityWorld.revenge) - { - int stressGain = (int)((double)damage * 10); - int stressMaxGain = 2500; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - 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 (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) - { - 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 = 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 ? 40 : 10; - 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; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); - int spore2 = 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"), 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() - { - player.lastDeathPostion = player.Center; - player.lastDeathTime = DateTime.Now; - player.showLastDeath = true; - bool specialDeath = CalamityWorld.ironHeart && CalamityGlobalNPC.AnyBossNPCS(); - 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 == 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(); - } - } - } - 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(); - } - } - } - } - if (player.dashDelay > 0) - { - return; - } - if (player.dashDelay < 0) - { - float num7 = 12f; - float num8 = 0.992f; - float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); - float num10 = 0.96f; - 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; - } - } - num7 = 14f; - num8 = 0.985f; - num10 = 0.94f; - } - 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 = 16f; //14 - num8 = 0.985f; - num10 = 0.94f; - } - 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 = 18f; //14 - num8 = 0.985f; - num10 = 0.94f; - } - 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 = 16.9f * (float)num16; //16.9 - 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 = 21.9f * (float)num23; //21.9 14*1.564 - 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 = 25f * (float)num23; //21.9 16*1.564 - 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 = 28.2f * (float)num23; //18*1.564 - 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; - } - } - } - } - } - - private void OnDodge() - { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) - { - player.AddBuff(mod.BuffType("ScarfMeleeBoost"), Main.rand.Next(480, 561)); - player.AddBuff(mod.BuffType("ScarfCooldown"), ((player.chaosState && CalamityWorld.revenge) ? 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 (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); - } - } - } - } - #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); - } - }); - - public override void ModifyDrawLayers(List list) - { - MiscEffectsBack.visible = true; - list.Insert(0, MiscEffectsBack); - if (fab) { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } - } - - public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo edi) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Player drawPlayer = edi.drawPlayer; - if (drawPlayer.mount != null && drawPlayer.GetModPlayer(mod).fab) { drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); } - }); - - 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) - { - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - r *= 0.07f; - g *= 0.15f; - b *= 0.01f; - fullBright = true; - } - if (gState || cDepth) - { - 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) - { - 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); - } - 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); - } - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - #endregion - - #region PacketStuff - 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); - } - } - - 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); - } - } - - public override void OnEnterWorld(Player player) - { - if (Main.netMode == 1) - { - StressPacket(false); - AdrenalinePacket(false); - } - } - #endregion - - #region ChangeTime - public void ChangeTime(bool day) - { - if (day) - { - Main.time = 0.0; - Main.dayTime = true; - } - else - { - Main.time = 0.0; - Main.dayTime = false; - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - #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.Items.Armor; +using CalamityMod.UI; +using Terraria.ModLoader.IO; + +namespace CalamityMod +{ + public class CalamityPlayer : ModPlayer + { + #region InstanceVars + + #region NormalVars + public int soulEssence = 0; + + public static int bossRushStage = 0; + + private const int saveVersion = 0; + + public int modStealthTimer; + + public int hInfernoBoost = 0; + + public int pissWaterBoost = 0; + + public int runCheck = 0; + + public int packetTimer = 0; + + public int sCalDeathCount = 0; + + public int sCalKillCount = 0; + + public int bloodflareHeartTimer = 180; + + public int bloodflareManaTimer = 180; + + public const int hitLimitNormal = 25; + + public const int hitLimitExpert = 20; + + public const int hitLimitRev = 15; + + public const int hitLimitDeath = 10; + + public const int hitLimitArmageddon = 1; + + public float modStealth = 1f; + + public float aquaticBoost = 1f; + + public float shieldInvinc = 5f; + + public int dashMod; + + public int dashTimeMod; + + public const float defEndurance = 0.33f; + + public const int defLifeRegen = 18; + + public const int defLifeRegenTime = 1800; + + public const float defDamage = 1.85f; + + public const int defCrit = 75; + + public bool fab = false; + + public bool drawBossHPBar = true; + + public bool shouldDrawSmallText = true; + + public bool deactivateStupidFuckingBullshit = false; + #endregion + + #region PetStuff + public bool leviPet = false; + + public bool sirenPet = false; + + public bool fox = false; + + public bool chibii = false; + + public bool brimling = false; + #endregion + + #region StressStuff + public const int stressMax = 10000; + + public int stress; + + public int stressCD; + + public bool heartOfDarkness = false; + + public bool draedonsHeart = false; + + public bool draedonsStressGain = false; + + public bool afflicted = false; + + public bool affliction = false; + + public bool afflictedBuff = false; + + public bool stressPills = false; + + public bool laudanum = false; + + public bool stressLevel500 = false; + + public bool rageMode = false; + + public bool despawnProj = false; + #endregion + + #region AdrenalineStuff + 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; + #endregion + + #region PermanentStuff + 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; + #endregion + + #region AccessoryStuff + public bool dodgeScarf = 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 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 aBulwark = 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 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; + #endregion + + #region ArmorSetStuff + 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 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; + #endregion + + #region DebuffStuff + public bool NOU = 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; + #endregion + + #region BuffStuff + 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; + + 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; + #endregion + + #region SummonStuff + 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 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; + #endregion + + #region BiomeStuff + public bool ZoneCalamity = false; + + public bool ZoneAstral = false; + + public bool ZoneGreatSea = 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; + #endregion + + #region TransformationStuff + 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; + #endregion + #endregion + + #region SavingAndLoading + public override void Initialize() + { + deactivateStupidFuckingBullshit = false; + 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 + }, + { + "bossRushStage", bossRushStage + } + }; + } + + 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"); + bossRushStage = tag.GetInt("bossRushStage"); + } + + public override void LoadLegacy(BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + stress = reader.ReadInt32(); + adrenaline = reader.ReadInt32(); + sCalDeathCount = reader.ReadInt32(); + sCalKillCount = reader.ReadInt32(); + bossRushStage = 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.extraAccessory && (Main.expertMode || Main.gameMenu)) + { + player.extraAccessorySlots = 2; + } + runCheck = 0; + dashMod = 0; + leviPet = false; + sirenPet = false; + fox = false; + chibii = false; + brimling = false; + fab = false; + sirenWaterBuff = false; + abyssalDivingSuitPlates = false; + abyssalDivingSuitCooldown = false; + sirenIce = false; + sirenIceCooldown = false; + heartOfDarkness = false; + draedonsHeart = false; + draedonsStressGain = false; + afflicted = false; + affliction = false; + afflictedBuff = false; + dodgeScarf = false; + elysianAegis = false; + godSlayer = false; + nCore = 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; + ataxiaBolt = false; + ataxiaGeyser = false; + shadeRegen = false; + scarfCooldown = false; + flamethrowerBoost = false; + shadowSpeed = false; + aSpark = false; + aBulwark = false; + dAmulet = false; + fCarapace = false; + gShell = false; + absorber = false; + aAmpoule = false; + pAmulet = false; + auricBoost = false; + fBarrier = false; + aBrain = false; + frostFlare = false; + beeResist = false; + uberBees = false; + projRef = false; + nanotech = false; + eQuiver = false; + daedalusReflect = false; + daedalusSplit = false; + daedalusAbsorb = false; + daedalusShard = false; + reaverSpore = false; + reaverDoubleTap = false; + cryogenSoul = false; + yInsignia = false; + eGauntlet = false; + eTalisman = false; + statisBeltOfCurses = false; + ataxiaFire = false; + ataxiaVolley = false; + ataxiaBlaze = 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; + ironBoots = false; + depthCharm = false; + anechoicPlating = false; + jellyfishNecklace = false; + abyssalAmulet = false; + lumenousAmulet = false; + reaperToothNecklace = false; + aquaticEmblem = false; + darkSunRing = false; + calamityRing = false; + eArtifact = false; + dArtifact = false; + gArtifact = false; + reaverBlast = false; + reaverBurst = false; + astralStarRain = false; + ataxiaMage = 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; + lol = false; + raiderTalisman = false; + sGenerator = false; + sDefense = false; + sRegen = false; + sPower = false; + IBoots = false; + elysianFire = false; + sTracers = false; + eTracers = false; + cTracers = false; + dsSetBonus = false; + NOU = false; + weakPetrification = false; + hAttack = false; + horror = false; + irradiated = false; + bFlames = false; + aFlames = false; + gsInferno = false; + pFlames = false; + hFlames = false; + hInferno = false; + gState = false; + bBlood = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + eGravity = false; + sMeleeBoost = false; + tFury = false; + vHex = false; + eGrav = false; + warped = false; + cadence = false; + omniscience = false; + zerg = false; + zen = false; + permafrostsConcoction = 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; + yPower = false; + aWeapon = false; + tScale = false; + fabsolVodka = false; + marked = false; + cDepth = false; + fishAlert = false; + invincible = false; + shine = false; + anechoicCoating = false; + mushy = false; + molten = false; + enraged = false; + shellBoost = false; + cFreeze = false; + tRegen = 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; + 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; + abyssalDivingSuitPrevious = abyssalDivingSuit; + abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; + sirenBoobsPrevious = sirenBoobs; + sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; + sirenBoobsAltPrevious = sirenBoobsAlt; + sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; + rageMode = false; + adrenalineMode = false; + } + #endregion + + #region UpdateDead + public override void UpdateDead() + { + #region Debuffs + stress = 0; + adrenaline = 0; + adrenalineMaxTimer = 300; + adrenalineDmgDown = 600; + adrenalineDmgMult = 1f; + raiderStack = 0; + fleshTotemCooldown = 0; + astralStarRainCooldown = 0; + tarraMageHealCooldown = 0; + 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; + scarfCooldown = false; + godSlayerCooldown = false; + abyssalDivingSuitCooldown = false; + abyssalDivingSuitPlateHits = 0; + sirenIceCooldown = false; + #endregion + + #region Buffs + sDefense = false; + sRegen = false; + sPower = false; + fab = false; + abyssalDivingSuitPlates = false; + sirenWaterBuff = false; + sirenIce = false; + afflictedBuff = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + sMeleeBoost = false; + tFury = false; + cadence = false; + omniscience = false; + zerg = false; + zen = false; + 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; + revivifyTimer = 0; + #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; + 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; + 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(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 && !CalamityGlobalNPC.AnyBossNPCS()) + { + player.respawnTimer -= 5; + } + else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert + { + player.respawnTimer--; + } + } + #endregion + + #region BiomeStuff + public override void UpdateBiomeVisuals() + { + 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 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); + bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); + player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); + player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || + (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 = CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300); + //ZoneGreatSea = CalamityWorld.seaTiles > 30; + + 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 = (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; + } + } + + //0.4 is the lowest location the rocklayer can be, 0.3 is the highest + ZoneAbyss = (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && + (((double)point.Y > ((Main.rockLayer - (double)y * 0.05) /*+ 35*/)) && //rocklayer = (0.4 to 0.3) - 0.04 = 0.36 to 0.26 + !player.lavaWet && + !player.honeyWet && + abyssPosY && + abyssPosX)); + + ZoneAbyssLayer1 = ZoneAbyss && + (double)point.Y <= (Main.rockLayer + (double)y * 0.03); //(0.36 to 0.26) to (0.436 to 0.336) + + ZoneAbyssLayer2 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.03) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.13); //(0.436 to 0.336) to (0.543 to 0.443) + + ZoneAbyssLayer3 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.13) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.23); //(0.543 to 0.443) to (0.662 to 0.562) + + ZoneAbyssLayer4 = ZoneAbyss && + point.Y <= Main.maxTilesY - 200 && + (double)point.Y > (Main.rockLayer + (double)y * 0.23); //(0.662 to 0.562) to just above underworld + + 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; + } + + public override void CopyCustomBiomesTo(Player other) + { + CalamityPlayer modOther = other.GetModPlayer(mod); + modOther.ZoneCalamity = ZoneCalamity; + modOther.ZoneAstral = ZoneAstral; + modOther.ZoneSulphur = ZoneSulphur; + 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; + writer.Write(flags); + } + + 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]; + } + + 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() + { + #region FirstDebuffs + 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)) + { + 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.meleeSpeed -= 0.025f; + 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 (vHex) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 16; + player.blind = true; + player.statDefense -= 30; + player.moveSpeed -= 0.1f; + player.endurance -= 0.3f; + 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 += 10; + } + if (sRegen) + { + player.lifeRegen += 2; + } + if (tarraSet) + { + player.calmed = (tarraMelee ? false : true); + player.lifeMagnet = true; + } + if (aChicken) + { + player.lifeRegen += 2; + player.statDefense += 5; + player.moveSpeed += 0.1f; + } + if (cadence) + { + player.discount = true; + player.lifeMagnet = true; + player.calmed = true; + player.loveStruck = true; + player.lifeRegen += 2; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; + } + if (omniscience) + { + player.detectCreature = true; + player.dangerSense = true; + player.findTreasure = true; + } + if (aWeapon) + { + player.moveSpeed += 0.15f; + } + if (mushy) + { + player.statDefense += 5; + player.lifeRegen += 5; + } + 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 += 8; + 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.lifeRegen += 1; + player.statDefense += 20; + } + else + { + if (player.lifeRegen < 0) + { + if (player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegen += 4; + player.statDefense += 10; + } + else + { + player.lifeRegen += 2; + } + } + } + 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; + } + #endregion + #region LastDebuffs + 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) + { + if (player.wingTimeMax < 0) + { + player.wingTimeMax = 0; + } + player.wingTimeMax /= 3; + if (player.wingTimeMax > 400) + { + player.wingTimeMax = 200; + } + } + if (warped || caribbeanRum) + { + player.velocity.Y *= 1.01f; + } + if (weakPetrification) + { + if (player.mount.Active) + { + player.mount.Dismount(player); + } + } + if (CalamityGlobalNPC.DoGHead > -1) + { + player.velocity.X *= 0.99f; + } + if (CalamityWorld.revenge) + { + if (player.lifeRegenTime > defLifeRegenTime) + { + int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; + player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); + } + if (player.lifeRegen > defLifeRegen) + { + int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; + player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); + } + } + #endregion + } + + #region UpdateLifeRegen + public override void UpdateLifeRegen() + { + bool shinyStoned = player.shinyStone; + float num2 = 0f; + if (player.lifeRegenTime >= 300) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 600) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 900) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 1200) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 1500) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 1800) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 2400) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 3000) + { + num2 += 1f; + } + if (player.lifeRegenTime >= 3600) + { + num2 += 1f; + } + if (player.velocity.X == 0f || player.grappling[0] > 0) + { + num2 *= 1.25f; + } + else + { + num2 *= 0.5f; + } + if (!shinyStoned) + { + if (shadeRegen || draedonsHeart || cFreeze) + { + num2 *= 1.1f; + } + if (draedonsHeart && !shadeRegen && !cFreeze && + (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (player.lifeRegen < 0) + { + player.lifeRegen /= 2; + } + if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegenTime += 8; //4 + player.lifeRegen += 8; //4 + float num3 = (float)(player.lifeRegenTime - 3000); + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > 30f) + { + num3 = 30f; + } + num2 += num3; + } + float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; + num2 *= num4; + player.lifeRegen += (int)Math.Round((double)num2); + player.lifeRegenCount += player.lifeRegen; + 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; + } + } + } + if (shadeRegen && !draedonsHeart && !cFreeze && + (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (player.lifeRegen < 0) + { + player.lifeRegen /= 2; + } + if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegenTime += 4; + player.lifeRegen += 4; + float num3 = (float)(player.lifeRegenTime - 3000); + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > 30f) + { + num3 = 30f; + } + num2 += num3; + } + float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; + num2 *= num4; + player.lifeRegen += (int)Math.Round((double)num2); + player.lifeRegenCount += player.lifeRegen; + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default(Color), 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + if (cFreeze && !shadeRegen && !draedonsHeart && + (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (player.lifeRegen < 0) + { + player.lifeRegen /= 2; + } + if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegenTime += 4; + player.lifeRegen += 4; + float num3 = (float)(player.lifeRegenTime - 3000); + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > 30f) + { + num3 = 30f; + } + num2 += num3; + } + float num4 = (float)player.statLifeMax2 / 400f * 0.85f + 0.15f; + num2 *= num4; + player.lifeRegen += (int)Math.Round((double)num2); + player.lifeRegenCount += player.lifeRegen; + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + } + if (CalamityWorld.revenge) + { + if (player.lifeRegenTime > defLifeRegenTime) + { + int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; + player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); + } + if (player.lifeRegen > defLifeRegen) + { + int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; + player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); + } + } + } + #endregion + #endregion + + #region HotKeys + public override void ProcessTriggers(TriggersSet triggersSet) + { + 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 (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) + { + if (nPC.FindBuffIndex(mod.BuffType("Enraged")) == -1) + { + 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()) + { + 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 (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 PostUpdateEffects + public override void PostUpdateBuffs() + { + if (NOU) + { + NOULOL(); + } + if (weakPetrification) + { + WeakPetrification(); + } + } + + public override void PostUpdateEquips() + { + if (NOU) + { + NOULOL(); + } + if (weakPetrification) + { + WeakPetrification(); + } + } + + public override void PostUpdateMiscEffects() + { + #region BossRush + if (!deactivateStupidFuckingBullshit) + { + deactivateStupidFuckingBullshit = true; + CalamityWorld.bossRushActive = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (CalamityWorld.bossRushActive) + { + if (NPC.MoonLordCountdown > 0) + { + NPC.MoonLordCountdown = 0; + } + if (!CalamityGlobalNPC.AnyBossNPCS()) + { + if (CalamityWorld.bossRushSpawnCountdown > 0) + { + CalamityWorld.bossRushSpawnCountdown--; + if (CalamityWorld.bossRushSpawnCountdown == 180 && bossRushStage == 26) + { + string key = "Mods.CalamityMod.BossRushTierThreeEndText2"; + 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); + } + } + if (CalamityWorld.bossRushSpawnCountdown == 210 && bossRushStage == 33) + { + string key = "Mods.CalamityMod.BossRushTierFourEndText2"; + 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); + } + } + } + if (CalamityWorld.bossRushSpawnCountdown <= 0) + { + CalamityWorld.bossRushSpawnCountdown = 60; + if (bossRushStage > 25) + { + CalamityWorld.bossRushSpawnCountdown += 120; //3 seconds + } + if (bossRushStage > 32) + { + CalamityWorld.bossRushSpawnCountdown += 180; //6 seconds + } + switch (bossRushStage) + { + case 9: + CalamityWorld.bossRushSpawnCountdown = 240; + break; + case 18: + CalamityWorld.bossRushSpawnCountdown = 300; + break; + case 25: + CalamityWorld.bossRushSpawnCountdown = 360; + break; + case 32: + CalamityWorld.bossRushSpawnCountdown = 420; + break; + default: + break; + } + if (bossRushStage == 13) + { + player.Spawn(); + } + else if (bossRushStage == 36) + { + if (player.FindBuffIndex(mod.BuffType("ExtremeGravity")) > -1) + { + player.ClearBuff(mod.BuffType("ExtremeGravity")); + } + } + if (Main.netMode != 1) + { + Main.PlaySound(SoundID.Roar, player.position, 0); + switch (bossRushStage) + { + case 0: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.QueenBee); + break; + case 1: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.BrainofCthulhu); + break; + case 2: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.KingSlime); + break; + case 3: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.EyeofCthulhu); + break; + case 4: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); + break; + case 5: + NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 51))), (int)(player.position.Y - 150f), NPCID.Golem, 0, 0f, 0f, 0f, 0f, 255); + break; + case 6: + ChangeTime(true); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss2")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss3")); + break; + case 7: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.EaterofWorldsHead); + break; + case 8: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Astrageldon")); + break; + case 9: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); + break; + case 10: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); + break; + case 11: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); + break; + case 12: + NPC.SpawnWOF(player.position); + break; + case 13: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("HiveMind")); + break; + case 14: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronHead); + break; + case 15: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); + break; + case 16: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); + break; + case 17: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + break; + case 18: + int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 2, 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)); + break; + case 19: + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && (Main.npc[doom].type == 493 || Main.npc[doom].type == 422 || Main.npc[doom].type == 507 || + Main.npc[doom].type == 517)) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + 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); + break; + case 20: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); + break; + case 21: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); + break; + case 22: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); + break; + case 23: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); + break; + case 24: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); + break; + case 25: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); + break; + case 26: + 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); + break; + case 27: + NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 101))), (int)(player.position.Y - 250f), NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, 255); + break; + case 28: + NPC.SpawnOnPlayer(player.whoAmI, NPCID.MoonLordCore); + break; + case 29: + ChangeTime(false); + for (int x = 0; x < 10; x++) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHead")); + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHeadSpectral")); + break; + case 30: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); + break; + case 31: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); + break; + case 32: + ChangeTime(false); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); + break; + case 33: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Siren")); + break; + case 34: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); + break; + case 35: + ChangeTime(true); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); + break; + case 36: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); + break; + case 37: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); + break; + case 38: + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DevourerofGodsHeadS")); + break; + } + } + } + } + } + else + { + CalamityWorld.bossRushSpawnCountdown = 180; + if (bossRushStage != 0) + { + bossRushStage = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(bossRushStage); + netMessage.Send(); + } + } + } + #endregion + #region LORESTATUR + soulEssence = 0 + + (NPC.downedSlimeKing ? 20 : 0) + //20 + (NPC.downedBoss1 ? 30 : 0) + //50 + (NPC.downedBoss2 ? 50 : 0) + //100 + (NPC.downedBoss3 ? 100 : 0) + //200 + (NPC.downedQueenBee ? 50 : 0) + //250 + (NPC.downedMechBoss1 ? 250 : 0) + //500 + (NPC.downedMechBoss2 ? 300 : 0) + //800 + (NPC.downedMechBoss3 ? 350 : 0) + //1150 + (NPC.downedPlantBoss ? 450 : 0) + //1600 + (NPC.downedGolemBoss ? 500 : 0) + //2100 + (NPC.downedAncientCultist ? 600 : 0) + //2700 + (NPC.downedMoonlord ? 1000 : 0) + //3700 + (CalamityWorld.downedDesertScourge ? 50 : 0) + //3750 + (CalamityWorld.downedCrabulon ? 50 : 0) + //3800 + ((CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator) ? 100 : 0) + //3900 + (CalamityWorld.downedSlimeGod ? 200 : 0) + //4100 + (Main.hardMode ? 200 : 0) + //4300 + (CalamityWorld.downedCryogen ? 250 : 0) + //4550 + (CalamityWorld.downedAquaticScourge ? 300 : 0) + //4850 + (CalamityWorld.downedBrimstoneElemental ? 350 : 0) + //5200 + (CalamityWorld.downedCalamitas ? 400 : 0) + //5600 + (CalamityWorld.downedLeviathan ? 800 : 0) + //6400 + (CalamityWorld.downedAstrageldon ? 400 : 0) + //6800 + (CalamityWorld.downedStarGod ? 700 : 0) + //7500 + (CalamityWorld.downedPlaguebringer ? 800 : 0) + //8300 + (CalamityWorld.downedScavenger ? 800 : 0) + //9100 + (NPC.downedFishron ? 800 : 0) + //9900 + (CalamityWorld.downedGuardians ? 900 : 0) + //10800 + (CalamityWorld.downedProvidence ? 2500 : 0) + //13300 + (CalamityWorld.downedSentinel1 ? 1000 : 0) + //14300 + (CalamityWorld.downedSentinel2 ? 1000 : 0) + //15300 + (CalamityWorld.downedSentinel3 ? 2000 : 0) + //17300 + (CalamityWorld.downedPolterghast ? 2700 : 0) + //20000 + (CalamityWorld.downedDoG ? 4000 : 0) + //24000 + (CalamityWorld.downedBumble ? 1000 : 0) + //25000 + (CalamityWorld.downedYharon ? 5000 : 0) + //30000 + (CalamityWorld.downedSCal ? 7500 : 0); //37500 + #endregion + #region RevengeanceEffects + if (CalamityWorld.revenge && 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 > 120) + { + player.immuneTime = 120; + } + int stressGain = 0; + if (rageMode) + { + stressGain = -2000; + } + else + { + if (draedonsHeart) + { + if (draedonsStressGain) + { + stressGain += 50; + } + } + else if (heartOfDarkness) + { + stressGain += 35; + } + } + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += stressGain; + if (stress < 0) + { + stress = 0; + } + if (stress >= stressMax) + { + stress = stressMax; + } + } + stressLevel500 = stress >= 9800; + if (stressLevel500 && !hAttack) + { + if (Main.rand.Next(10000) == 0) + { + player.AddBuff(mod.BuffType("HeartAttack"), 18000); + } + } + if (adrenaline >= adrenalineMax) + { + adrenalineMaxTimer--; + if (adrenalineMaxTimer <= 0) + { + adrenalineDmgDown--; + if (adrenalineDmgDown < 0) + adrenalineDmgDown = 0; + adrenalineMaxTimer = 0; + } + } + else if (!adrenalineMode && adrenaline <= 0) + { + adrenalineDmgDown = 600; + adrenalineMaxTimer = 300; + adrenalineDmgMult = 1f; + } + adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 120); + if (adrenalineDmgMult < 0.25f) + adrenalineDmgMult = 0.25f; + int adrenalineGain = 0; + if (adrenalineMode) + { + adrenalineGain = (CalamityGlobalNPC.SCal > -1 ? -10000 : -2000); + } + else + { + if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > + { + adrenaline = 0; + } + else if (CalamityGlobalNPC.AnyBossNPCS() || CalamityGlobalNPC.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 + } + else + { + adrenaline = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= (CalamityGlobalNPC.SCal > -1 ? 135 : 60)) + { + adrenalineCD = 0; + adrenaline += adrenalineGain; + if (adrenaline < 0) + { + adrenaline = 0; + } + if (adrenaline >= adrenalineMax) + { + adrenaline = adrenalineMax; + } + } + } + else if (!CalamityWorld.revenge && 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 (CalamityWorld.revenge) + { + player.thrownDamage += 0.05f; + player.rangedDamage += 0.05f; + player.meleeDamage += 0.05f; + player.magicDamage += 0.05f; + player.minionDamage += 0.05f; + } + #endregion + #region StressTiedEffects + if (stressPills) + { + player.statDefense += 5; + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + } + if (laudanum) + { + player.statDefense += 8; + player.meleeCrit += 6; + player.meleeDamage += 0.06f; + player.magicCrit += 6; + player.magicDamage += 0.06f; + player.rangedCrit += 6; + player.rangedDamage += 0.06f; + player.thrownCrit += 6; + player.thrownDamage += 0.06f; + player.minionDamage += 0.06f; + } + 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 += 50; + } + if (hAttack) + { + if (heartOfDarkness || draedonsHeart) + { + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + } + player.lifeRegen += 1; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; + } + if (affliction) + { + player.lifeRegen += CalamityWorld.revenge ? 2 : 1; + player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; + player.statDefense += CalamityWorld.revenge ? 20 : 15; + player.thrownDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.rangedDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.meleeDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.magicDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.minionDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); + } + else if (afflicted) + { + player.lifeRegen += CalamityWorld.revenge ? 2 : 1; + player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; + player.statDefense += CalamityWorld.revenge ? 20 : 15; + player.thrownDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.rangedDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.meleeDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.magicDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.minionDamage += CalamityWorld.revenge ? 0.12f : 0.1f; + player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); + } + if (afflictedBuff) { afflicted = true; } + #endregion + #region MaxLifeAndManaBoosts + player.statLifeMax2 += + (mFruit ? 25 : 0) + + (bOrange ? 25 : 0) + + (eBerry ? 25 : 0) + + (dFruit ? 25 : 0); + if (silvaSet && silvaHitCounter > 0) + { + player.statLifeMax2 -= silvaHitCounter * 100; + if (player.statLifeMax2 < 200) + { + player.statLifeMax2 = 200; + } + } + 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 && NPC.downedMoonlord) { Main.rainTexture = rain3; } + else { Main.rainTexture = rainOriginal; } + if (auricSet) { Main.flyingCarpetTexture = carpetAuric; } + else { Main.flyingCarpetTexture = carpetOriginal; } + } + #endregion + #region MiscEffects + if (Main.myPlayer == player.whoAmI) + { + BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; + } + if (silvaSet || invincible || margarita) + { + foreach (int debuff in CalamityMod.debuffList) { player.buffImmune[debuff] = true; } + } + 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) + { + player.breath--; + } + } + } + if (ZoneAbyss) + { + if (abyssalAmulet) { player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 15 : 10); } + player.detectCreature = false; + if (player.chaosState && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && Main.netMode != 1) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("EidolonWyrmHeadHuge")); + } + if (Main.myPlayer == player.whoAmI) //4200 total tiles small world + { + Point point = player.Center.ToTileCoordinates(); + int breathLoss = 2; + int lightStrength = 0 + + ((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1 + (player.arcticDivingGear ? 1 : 0) + //2 + (jellyfishNecklace ? 1 : 0) + //3 + ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //5 + ((shine || lumenousAmulet) ? 2 : 0) + //7 + ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //10 + 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; } + if (!depthCharm) { player.bleed = true; } + player.statDefense -= (anechoicPlating ? 40 : 120); + } + else if (ZoneAbyssLayer3) //2700 to 3200 + { + breathLoss = 18; + if (!lightLevelThree) { player.blind = true; } + if (!lightLevelTwo) { player.headcovered = true; } + if (!depthCharm) { player.bleed = true; } + player.statDefense -= (anechoicPlating ? 20 : 60); + } + else if (ZoneAbyssLayer2) //2100 to 2700 + { + breathLoss = 6; + if (!lightLevelTwo) { player.blind = true; } + if (!depthCharm) { player.bleed = true; } + 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 + (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 + (player.accMerman ? 15.0 : 0.0) + //45 + (victideSet ? 5.0 : 0.0) + //50 + (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //65 + (abyssalDivingSuit ? 15.0 : 0.0); //80 + if (tickMult > 50.0) { tickMult = 50.0; } + tick = (int)((double)tick * tickMult); + abyssBreathCD++; + if (player.gills || player.merman) + { + player.breath -= 3; + } + if (abyssBreathCD >= tick) + { + abyssBreathCD = 0; + player.breath -= breathLoss; + if (cDepth) + { + player.breath -= 1; + } + if (player.breath <= 0) + { + int lifeLoss = 6 + + (player.bleed ? 6 : 0) - + (depthCharm ? 3 : 0); + player.statLife -= lifeLoss; + if (player.statLife <= 0) + { + KillPlayer(); + } + } + } + } + } + else + { + abyssBreathCD = 0; + } + if ((Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) || + (aeroSet && !Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) + { + player.maxFallSpeed = 15f; + } + if (revivifyTimer > 0) { revivifyTimer--; } + if (fleshTotemCooldown > 0) { fleshTotemCooldown--; } + if (astralStarRainCooldown > 0) { astralStarRainCooldown--; } + if (tarraMageHealCooldown > 0) { tarraMageHealCooldown--; } + if (ataxiaDmg > 0) { ataxiaDmg--; } + if (xerocDmg > 0) { xerocDmg--; } + if (godSlayerDmg > 0) { godSlayerDmg--; } + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + silvaCountdown--; + 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) + { + player.thrownDamage += 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 && NPC.downedMoonlord) + { + if (player.ZoneOverworldHeight || player.ZoneSkyHeight) { player.AddBuff(mod.BuffType("Irradiated"), 2); } + } + if (raiderTalisman) { player.thrownDamage += ((float)raiderStack / 250f) * 0.15f; } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage) + { + player.magicCrit += 10; + } + 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 += 3; + 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.5f; + 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 += 3; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + } + player.lifeRegenTime += 1; + player.lifeRegen += 3; + } + 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, 0.55f, 1.5f, 0.55f); + } + 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; + } + #endregion + #region StandingStillEffects + if (aquaticEmblem) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !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) * 40f); + player.moveSpeed -= (1f - aquaticBoost) * 0.15f; + } + if (auricBoost) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)player.velocity.X > -0.1 && (double)player.velocity.X < 0.1 && (double)player.velocity.Y > -0.1 && (double)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; + } + } + player.meleeDamage += (1f - modStealth) * 0.2f; + player.meleeCrit += (int)((1f - modStealth) * 20f); + player.rangedDamage += (1f - modStealth) * 0.2f; + player.rangedCrit += (int)((1f - modStealth) * 20f); + player.magicDamage += (1f - modStealth) * 0.2f; + player.magicCrit += (int)((1f - modStealth) * 20f); + player.thrownDamage += (1f - modStealth) * 0.2f; + player.thrownCrit += (int)((1f - modStealth) * 20f); + player.minionDamage += (1f - modStealth) * 0.2f; + if (modStealthTimer > 0) + { + modStealthTimer--; + } + } + else if (pAmulet) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)player.velocity.X > -0.1 && (double)player.velocity.X < 0.1 && (double)player.velocity.Y > -0.1 && (double)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; + } + } + player.meleeDamage += (1f - modStealth) * 0.25f; + player.meleeCrit += (int)((1f - modStealth) * 25f); + 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); + } + player.rangedDamage += (5f - shieldInvinc) * 0.02f; + player.rangedCrit += (int)((5f - shieldInvinc) * 2f); + player.meleeDamage += (5f - shieldInvinc) * 0.02f; + player.meleeCrit += (int)((5f - shieldInvinc) * 2f); + player.magicDamage += (5f - shieldInvinc) * 0.02f; + player.magicCrit += (int)((5f - shieldInvinc) * 2f); + player.minionDamage += (5f - shieldInvinc) * 0.02f; + player.thrownDamage += (5f - shieldInvinc) * 0.02f; + player.thrownCrit += (int)((5f - shieldInvinc) * 2f); + player.aggro += (int)((5f - shieldInvinc) * 220f); + player.statDefense += (int)((5f - shieldInvinc) * 5f); + 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 SeasonalChecks + if (Main.netMode != 2) + { + if (Main.time == 0.0) + { + runCheck = 0; + } + if (runCheck == 0) + { + CalamityWorld.checkSpring(); + CalamityWorld.checkSummer(); + CalamityWorld.checkFall(); + CalamityWorld.checkWinter(); + runCheck++; + } + } + #endregion + #region OtherBuffs + if (irradiated) + { + player.statDefense -= 5 + + (CalamityWorld.revenge ? 5 : 0); + player.endurance -= 0.05f + + (CalamityWorld.revenge ? 0.05f : 0f); + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + player.minionKB += 0.5f; + player.moveSpeed += 0.05f; + } + if (rRage) + { + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + player.meleeSpeed -= 0.05f; + player.moveSpeed += 0.05f; + } + if (xRage) + { + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + } + if (xWrath) + { + player.meleeCrit += 10; + player.magicCrit += 10; + player.rangedCrit += 10; + player.thrownCrit += 10; + } + if (godSlayerCooldown) + { + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + } + if (graxDefense) + { + player.statDefense += 15; + player.endurance += 0.05f; + player.meleeSpeed -= 0.05f; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + } + if (sMeleeBoost) + { + player.meleeSpeed -= 0.05f; + player.meleeDamage += 0.1f; + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + player.meleeCrit += 10; + player.magicCrit += 10; + player.rangedCrit += 10; + player.thrownCrit += 10; + } + if (tFury) + { + player.meleeDamage += 0.3f; + player.meleeCrit += 30; + } + if (yPower) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.meleeSpeed -= 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + player.minionKB += 1f; + player.moveSpeed += 0.15f; + } + if (tScale) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.kbBuff = true; + } + if (fabsolVodka) + { + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + player.statDefense -= 20; + } + if (vodka) + { + player.lifeRegen -= 2; + player.statDefense -= 4; + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + } + if (redWine) + { + player.lifeRegen -= 2; + } + if (grapeBeer) + { + player.lifeRegen -= 1; + player.statDefense -= 2; + player.moveSpeed -= 0.05f; + } + if (moonshine) + { + player.lifeRegen -= 2; + player.statDefense += 10; + player.endurance += 0.05f; + } + if (rum) + { + player.lifeRegen += 2; + player.moveSpeed += 0.1f; + player.statDefense -= 8; + } + if (fireball) + { + player.lifeRegen -= 3; + } + if (whiskey) + { + player.statDefense -= 8; + player.meleeCrit += 3; + player.meleeDamage += 0.03f; + player.magicCrit += 3; + player.magicDamage += 0.03f; + player.rangedCrit += 3; + player.rangedDamage += 0.03f; + player.thrownCrit += 3; + player.thrownDamage += 0.03f; + player.minionDamage += 0.03f; + } + if (everclear) + { + player.lifeRegen -= 20; + player.statDefense -= 40; + player.meleeCrit += 20; + player.meleeDamage += 0.2f; + player.magicCrit += 20; + player.magicDamage += 0.2f; + player.rangedCrit += 20; + player.rangedDamage += 0.2f; + player.thrownCrit += 20; + player.thrownDamage += 0.2f; + player.minionDamage += 0.2f; + } + if (bloodyMary) + { + player.lifeRegen -= 3; + if (Main.bloodMoon) + { + player.statDefense -= 6; + player.meleeCrit += 15; + player.meleeDamage += 0.15f; + player.meleeSpeed -= 0.15f; + player.magicCrit += 15; + player.magicDamage += 0.15f; + player.rangedCrit += 15; + player.rangedDamage += 0.15f; + player.thrownCrit += 15; + player.thrownDamage += 0.15f; + player.minionDamage += 0.15f; + player.moveSpeed += 0.15f; + } + } + if (tequila) + { + player.lifeRegen -= 2; + if (Main.dayTime) + { + player.statDefense += 5; + player.meleeCrit += 3; + player.meleeDamage += 0.03f; + player.magicCrit += 3; + player.magicDamage += 0.03f; + player.rangedCrit += 3; + player.rangedDamage += 0.03f; + player.thrownCrit += 3; + player.thrownDamage += 0.03f; + player.minionDamage += 0.03f; + player.endurance += 0.03f; + } + } + if (tequilaSunrise) + { + player.lifeRegen -= 3; + if (Main.dayTime) + { + player.statDefense += 15; + player.meleeCrit += 9; + player.meleeDamage += 0.09f; + player.magicCrit += 9; + player.magicDamage += 0.09f; + player.rangedCrit += 9; + player.rangedDamage += 0.09f; + player.thrownCrit += 9; + player.thrownDamage += 0.09f; + player.minionDamage += 0.09f; + player.endurance += 0.09f; + } + } + if (screwdriver) + { + player.lifeRegen -= 3; + } + if (caribbeanRum) + { + player.lifeRegen += 2; + player.moveSpeed += 0.2f; + player.statDefense -= 12; + } + if (cinnamonRoll) + { + player.statDefense -= 12; + player.manaRegenDelay--; + player.manaRegenBonus += 10; + } + if (margarita) + { + player.lifeRegen -= 3; + player.statDefense -= 6; + } + if (starBeamRye) + { + player.lifeRegen -= 3; + player.statDefense -= 6; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.manaCost *= 0.9f; + } + if (moscowMule) + { + player.lifeRegen -= 3; + player.meleeCrit += 12; + player.meleeDamage += 0.12f; + player.magicCrit += 12; + player.magicDamage += 0.12f; + player.rangedCrit += 12; + player.rangedDamage += 0.12f; + player.thrownCrit += 12; + player.thrownDamage += 0.12f; + player.minionDamage += 0.12f; + } + if (whiteWine) + { + player.lifeRegen -= 3; + player.statDefense -= 6; + player.magicDamage += 0.1f; + } + if (evergreenGin) + { + player.lifeRegen -= 3; + player.endurance += 0.05f; + } + if (nanotech && player.inventory[player.selectedItem].thrown) + { + player.endurance += 0.1f; + player.statDefense += 15; + } + if (harpyRing) + { + if (player.wingTimeMax > 0) + { + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + } + player.moveSpeed += 0.2f; + } + 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 regenBoost = 1 + (integerTypeBoost / 5); + float damageBoost = floatTypeBoost * 0.5f; + player.endurance += (floatTypeBoost * 0.25f); + player.statDefense += integerTypeBoost; + player.meleeCrit += integerTypeBoost; + player.meleeDamage += damageBoost; + player.meleeSpeed -= (floatTypeBoost * 0.25f); + player.magicCrit += integerTypeBoost; + player.magicDamage += damageBoost; + player.rangedCrit += integerTypeBoost; + player.rangedDamage += damageBoost; + player.thrownCrit += integerTypeBoost; + player.thrownDamage += damageBoost; + player.minionDamage += damageBoost; + 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 (CalamityWorld.defiled) + { + player.statLifeMax2 /= 2; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + } + if (reaperToothNecklace) + { + player.meleeCrit += 25; + player.meleeDamage += 0.25f; + player.magicCrit += 25; + player.magicDamage += 0.25f; + player.rangedCrit += 25; + player.rangedDamage += 0.25f; + player.thrownCrit += 25; + player.thrownDamage += 0.25f; + player.minionDamage += 0.25f; + } + if (coreOfTheBloodGod) + { + if (Main.netMode != 1) + { + int drain = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 476, 40, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[drain].usesLocalNPCImmunity = true; + Main.projectile[drain].localNPCHitCooldown = 5; + } + player.endurance += 0.05f; + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + if (player.statDefense < 100) + { + player.meleeDamage += 0.15f; + player.magicDamage += 0.15f; + player.rangedDamage += 0.15f; + player.thrownDamage += 0.15f; + player.minionDamage += 0.15f; + } + } + else if (bloodflareCore) + { + if (Main.netMode != 1) + { + int drain = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 476, 40, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[drain].usesLocalNPCImmunity = true; + Main.projectile[drain].localNPCHitCooldown = 8; + } + if (player.statDefense < 100) + { + player.meleeDamage += 0.15f; + player.magicDamage += 0.15f; + player.rangedDamage += 0.15f; + player.thrownDamage += 0.15f; + player.minionDamage += 0.15f; + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.1f; + player.meleeCrit += 15; + player.meleeDamage += 0.15f; + player.magicCrit += 15; + player.magicDamage += 0.15f; + player.rangedCrit += 15; + player.rangedDamage += 0.15f; + player.thrownCrit += 15; + player.thrownDamage += 0.15f; + player.minionDamage += 0.15f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.endurance += 0.05f; + player.meleeCrit += 10; + player.meleeDamage += 0.1f; + player.magicCrit += 10; + player.magicDamage += 0.1f; + player.rangedCrit += 10; + player.rangedDamage += 0.1f; + player.thrownCrit += 10; + player.thrownDamage += 0.1f; + player.minionDamage += 0.1f; + } + } + if (godSlayerThrowing) + { + if (player.statLife >= player.statLifeMax2) + { + player.thrownCrit += 15; + player.thrownDamage += 0.15f; + player.thrownVelocity += 0.15f; + } + } + if (tarraSummon) + { + int lifeCounter = 0; + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); + 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 (bloodflareThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) + { + player.thrownCrit += 5; + player.statDefense += 30; + } + else + { + player.thrownDamage += 0.15f; + } + } + if (bloodflareSummon) + { + if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) + { + player.minionDamage += 0.15f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 20; + player.lifeRegen += 3; + } + if (bloodflareSummonTimer > 0) { bloodflareSummonTimer--; } + if (Main.netMode != 1 && bloodflareSummonTimer <= 0) + { + bloodflareSummonTimer = 900; + for (int I = 0; I < 3; I++) + { + float ai1 = (float)(I * 120); + int mine = 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); + } + } + } + #endregion + #region DRAndDamageLimits + if (CalamityWorld.revenge) + { + if (player.lifeRegenTime > defLifeRegenTime) + { + int lifeRegenAboveCap = player.lifeRegenTime - defLifeRegenTime; + player.lifeRegenTime = defLifeRegenTime + (int)((double)lifeRegenAboveCap * 0.25); + } + if (player.lifeRegen > defLifeRegen) + { + int lifeRegenAboveCap = player.lifeRegen - defLifeRegen; + player.lifeRegen = defLifeRegen + (int)((double)lifeRegenAboveCap * 0.25); + } + if (player.endurance > defEndurance) //0.33 + { + float damageReductionAboveCap = player.endurance - defEndurance; //0.6 - 0.33 = 0.27 + player.endurance = defEndurance + (damageReductionAboveCap * 0.1f); //0.33 + (0.27 * 0.1) = 0.357 + } + if (!dsSetBonus) + { + if (player.meleeDamage > defDamage) + { + float damageAboveCap = player.meleeDamage - defDamage; + player.meleeDamage = defDamage + (damageAboveCap * 0.25f); + } + if (auricSet && silvaMelee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + player.meleeDamage += (float)(multiplier * 0.5); //ranges from 1.5 times to 1 times + } + if (player.rangedDamage > defDamage) + { + float damageAboveCap = player.rangedDamage - defDamage; + player.rangedDamage = defDamage + (damageAboveCap * 0.25f); + } + if (player.magicDamage > defDamage) + { + float damageAboveCap = player.magicDamage - defDamage; + player.magicDamage = defDamage + (damageAboveCap * 0.25f); + } + if (player.thrownDamage > defDamage) + { + float damageAboveCap = player.thrownDamage - defDamage; + player.thrownDamage = defDamage + (damageAboveCap * 0.25f); + } + if (!auricSet) + { + if (player.minionDamage > defDamage) + { + float damageAboveCap = player.minionDamage - defDamage; + player.minionDamage = defDamage + (damageAboveCap * 0.25f); + } + } + if (player.meleeCrit > defCrit) + { + int critAboveCap = player.meleeCrit - defCrit; + player.meleeCrit = defCrit + (int)((double)critAboveCap * 0.1); + } + if (player.rangedCrit > defCrit) + { + int critAboveCap = player.rangedCrit - defCrit; + player.rangedCrit = defCrit + (int)((double)critAboveCap * 0.1); + } + if (player.magicCrit > defCrit) + { + int critAboveCap = player.magicCrit - defCrit; + player.magicCrit = defCrit + (int)((double)critAboveCap * 0.1); + } + if (player.thrownCrit > defCrit) + { + int critAboveCap = player.thrownCrit - defCrit; + player.thrownCrit = defCrit + (int)((double)critAboveCap * 0.1); + } + } + if (rageMode && adrenalineMode) + { + player.thrownDamage += (CalamityWorld.death ? 12f : 3f); + player.rangedDamage += (CalamityWorld.death ? 12f : 3f); + player.meleeDamage += (CalamityWorld.death ? 12f : 3f); + player.magicDamage += (CalamityWorld.death ? 12f : 3f); + } + else if (rageMode) + { + float rageDamageBoost = 0f + + (rageBoostOne ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f) + //4.8 or 1.2 + (rageBoostTwo ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f) + //5.6 or 1.4 + (rageBoostThree ? (CalamityWorld.death ? 0.8f : 0.2f) : 0f); //6.4 or 1.6 + float rageDamage = (CalamityWorld.death ? 4f : 1f) + rageDamageBoost; + player.thrownDamage += rageDamage; + player.rangedDamage += rageDamage; + player.meleeDamage += rageDamage; + player.magicDamage += rageDamage; + } + else if (adrenalineMode) + { + float adrenalineDamageMult = (CalamityWorld.death ? 10f : 2.5f) * adrenalineDmgMult; + player.thrownDamage += adrenalineDamageMult; + player.rangedDamage += adrenalineDamageMult; + player.meleeDamage += adrenalineDamageMult; + player.magicDamage += adrenalineDamageMult; + } + } + if (dArtifact) + { + player.meleeCrit += 15; + player.meleeDamage += 0.15f; + player.magicCrit += 15; + player.magicDamage += 0.15f; + player.rangedCrit += 15; + player.rangedDamage += 0.15f; + player.thrownCrit += 15; + player.thrownDamage += 0.15f; + } + if (eArtifact) + { + player.meleeSpeed -= 0.1f; + player.manaCost *= 0.85f; + player.thrownDamage += 0.1f; + 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 && Main.netMode != 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + if (marked || reaperToothNecklace) + { + player.endurance *= 0.5f; + } + if (reaperToothNecklace) + { + player.statDefense /= 2; + } + #endregion + #region DespawnProjectilesWhenRageOrAdrenalineStop + if (player.whoAmI == Main.myPlayer) + { + if ((rageMode || adrenalineMode) && !despawnProj) + { + despawnProj = true; + } + if (!rageMode && !adrenalineMode && despawnProj) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if ((projectile.active && projectile.owner == Main.myPlayer && + (projectile.friendly || projectile.timeLeft > 300) && + !projectile.hostile && !projectile.minion && projectile.aiStyle != 7 && !projectile.sentry && + projectile.type != mod.ProjectileType("HolyBurnOrb") && + projectile.type != mod.ProjectileType("HolyLight") && + projectile.type != mod.ProjectileType("ProvidenceCrystal")) || + projectile.aiStyle == 36) + { + projectile.Kill(); + } + proj = x; + } + despawnProj = false; + } + } + #endregion + } + + public override void PostUpdateRunSpeeds() + { + #region SpeedBoosts + if (hAttack) + { + if (!Main.dayTime) + { + player.runAcceleration *= 1.05f; + player.maxRunSpeed *= 1.05f; + } + } + if (stressPills || laudanum) + { + player.runAcceleration *= 1.05f; + player.maxRunSpeed *= 1.05f; + } + if (abyssalDivingSuit) + { + player.runAcceleration *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; + player.maxRunSpeed *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; + } + if (sirenWaterBuff) + { + player.runAcceleration *= 1.15f; + player.maxRunSpeed *= 1.15f; + } + if (frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) + { + player.runAcceleration *= 1.15f; + player.maxRunSpeed *= 1.15f; + } + if (shadowSpeed) + { + player.runAcceleration *= 1.5f; + player.maxRunSpeed *= 1.5f; + } + else if (auricSet) + { + player.runAcceleration *= 1.1f; + player.maxRunSpeed *= 1.1f; + } + else if (silvaSet) + { + player.runAcceleration *= 1.05f; + player.maxRunSpeed *= 1.05f; + } + if (cTracers) + { + player.runAcceleration *= 1.1f; + player.maxRunSpeed *= 1.1f; + } + else if (eTracers) + { + player.runAcceleration *= 1.05f; + player.maxRunSpeed *= 1.05f; + } + if (horror) + { + player.runAcceleration *= 0.85f; + player.maxRunSpeed *= 0.85f; + } + if (elysianGuard) + { + player.runAcceleration *= 0.5f; + player.maxRunSpeed *= 0.5f; + } + #endregion + #region DashEffects + if (player.pulley && dashMod > 0) + { + ModDashMovement(); + } + else if (player.grappling[0] == -1 && !player.tongued) + { + if (dashMod > 0 && !player.mount.Active) + { + ModHorizontalMovement(); + 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) + { + 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); + 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; + } + } + player.statLife += 150; + player.HealEffect(150); + player.AddBuff(mod.BuffType("GodSlayerCooldown"), 2700); + return false; + } + if (silvaSet && silvaCountdown > 0) + { + if (hasSilvaEffect) + { + silvaHitCounter++; + } + 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 (CalamityGlobalNPC.SCal > -1) + { + if (sCalDeathCount < 51) + { + sCalDeathCount++; + } + } + if (CalamityWorld.ironHeart && CalamityGlobalNPC.AnyBossNPCS()) + { + KillPlayer(); + return false; + } + return true; + } + #endregion + + #region UseTimeMult + public override float UseTimeMultiplier(Item item) + { + if (silvaRanged && item.ranged && item.useTime > 3) + { + return (auricSet ? 1.2f : 1.1f); + } + if (player.statLife > (int)((double)player.statLifeMax2 * 0.9) && silvaThrowing && item.thrown && item.useTime > 3) + { + return 1.1f; + } + return 1f; + } + #endregion + + #region MeleeSpeedMult + public override float MeleeSpeedMultiplier(Item item) + { + if (player.meleeSpeed > 1.3f) + { + return (1.3f / player.meleeSpeed); + } + return 1f; + } + #endregion + + #region GetWeaponDamageAndKB + public override void GetWeaponDamage(Item item, ref int damage) + { + if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) + { + damage = (int)((double)damage * 1.1); + } + if (cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) + { + damage = (int)((double)damage * 1.15); + } + if (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type)) + { + damage = (int)((double)damage * 1.15); + } + if (dodgeScarf && item.melee && item.shoot == 0) + { + damage = (int)((double)damage * 1.2); + } + if (flamethrowerBoost && item.ranged && item.useAmmo == 23) + { + damage = (int)((double)damage * 1.25); + } + if (item.type == ItemID.TerraBlade) + { + damage = (int)((double)damage * 1.66); + } + } + + public override void GetWeaponKnockback(Item item, ref float knockback) + { + if (pAmulet && item.melee) + { + knockback *= 1f + (1f - modStealth) * 0.5f; + } + if (auricBoost) + { + knockback *= 1f + (1f - modStealth) * 0.5f; + } + if (whiskey) + { + knockback += 0.03f; + } + if (tequila && Main.dayTime) + { + knockback += 0.03f; + } + if (moscowMule) + { + knockback += 0.12f; + } + } + #endregion + + #region Shoot + public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (eArtifact && item.ranged) + { + speedX *= 1.25f; + speedY *= 1.25f; + } + if (bloodflareMage && item.magic && Main.rand.Next(0, 100) >= 95) //0 - 99 + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * 2.6), 1f, player.whoAmI, 0f, 0f); + } + } + if (bloodflareRanged && item.ranged && Main.rand.Next(0, 100) >= (auricSet ? 98 : 95)) //0 - 99 + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * 1.6), 2f, player.whoAmI, 0f, 0f); + } + } + if (tarraMage && tarraCrits >= 5) + { + 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 (ataxiaBolt && item.ranged && 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 (godSlayerRanged && item.ranged && Main.rand.Next(0, 100) >= 95) //0 - 99 + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * 2.1), 2f, player.whoAmI, 0f, 0f); + } + } + if (ataxiaVolley && item.thrown && 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.25), 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.25), 1.25f, player.whoAmI, 0f, 0f); + } + } + } + if (reaverDoubleTap && item.ranged && Main.rand.Next(0, 100) >= 90) //0 - 99 + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.8), 2f, player.whoAmI, 0f, 0f); + } + } + if (victideSet && (item.ranged || item.melee || item.magic || item.thrown || item.summon) && 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 MeleeEffects + public override void MeleeEffects(Item item, Rectangle hitbox) + { + if (aWeapon && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 && item.melee && !item.noMelee && !item.noUseGraphic) + { + 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 (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 (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 (aChicken) + { + 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 (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 (ataxiaGeyser && item.melee && !item.noMelee && !item.noUseGraphic) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)item.damage * 0.15), 2f, player.whoAmI, 0f, 0f); + } + } + if (target.type == NPCID.TargetDummy) + { + return; + } + if (bloodflareMelee) + { + if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) + { + bloodflareMeleeHits++; + } + if (player.whoAmI == Main.myPlayer) + { + int healAmount = (Main.rand.Next(5) + 1); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } + #endregion + + #region OnHitNPCWithProj + public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) + { + if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("SilvaStun"), 20); + } + if (target.type != NPCID.TargetDummy) + { + if (player.whoAmI == Main.myPlayer && raiderTalisman && raiderStack < 250 && proj.thrown && crit) + { + raiderStack++; + } + if (CalamityWorld.revenge && player.whoAmI == Main.myPlayer) + { + if ((proj.melee && proj.ownerHitCheck) || proj.aiStyle == 15 || (proj.aiStyle == 75 && proj.melee) || + proj.type == mod.ProjectileType("Nebulash") || proj.type == mod.ProjectileType("CosmicDischarge") || + proj.type == mod.ProjectileType("MourningStar")) + { + 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 ModifyHitNPC + public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) + { + if (silvaMelee && Main.rand.Next(4) == 0) + { + damage *= 5; + } + if (target.type != NPCID.TargetDummy) + { + if (CalamityWorld.revenge && player.whoAmI == Main.myPlayer) + { + if (item.shoot == 0 || item.shoot == mod.ProjectileType("NobodyKnows")) + { + 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; + } + } + } + } + if (astralStarRain && crit && astralStarRainCooldown <= 0) + { + if (player.whoAmI == Main.myPlayer) + { + astralStarRainCooldown = 120; + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 25; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = 92; + } + else + { + projectileType = 12; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + } + } + + public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (auricSet && silvaThrowing && proj.thrown && crit && player.statLife > (int)((double)player.statLifeMax2 * 0.9)) + { + damage = (int)((double)damage * 3.5); + } + if (auricSet && silvaMelee && proj.melee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + if (multiplier < 0.4) + { + multiplier = 0.4; + } + damage = (int)(((double)damage * multiplier) * 2.5); //ranges from 2.5 times to 1 times + } + if (godSlayerRanged && crit && proj.ranged) + { + int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap + if (randomChance < 15) + { + randomChance = 15; + } + if (Main.rand.Next(randomChance) == 0) + { + damage *= 2; + } + } + if (tarraMage && crit && proj.magic) + { + tarraCrits++; + } + if (tarraRanged && crit && proj.ranged && Main.netMode != 1) + { + 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 (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && proj.thrown) + { + tarraThrowingCrits++; + } + if (bloodflareThrowing && proj.thrown && crit) + { + if (player.whoAmI == Main.myPlayer) + { + player.statLife += 1; + player.HealEffect(1); + } + } + if (bloodflareMage && crit && proj.magic && Main.netMode != 1) + { + int num251 = Main.rand.Next(1, 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; + int fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), + value15.X, value15.Y, 85, (int)((double)damage * 2.0), 0f, player.whoAmI, 0f, 0f); + Main.projectile[fire].ranged = false; + Main.projectile[fire].netUpdate = true; + } + } + if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) + { + damage = (int)((double)damage * 1.5); + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.thrown) + { + damage = (int)((double)damage * 1.2); + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) + { + damage = (int)((double)damage * 1.1); + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && proj.minion) + { + damage = (int)((double)damage * 1.15); + } + } + #endregion + + #region ModifyHitByNPC + public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) + { + if (fleshTotem && fleshTotemCooldown <= 0) + { + fleshTotemCooldown = 900; //15 seconds + damage /= 2; + } + if (tarraDefense && tarraMelee) + { + damage /= 2; + } + if (bloodflareMelee && bloodflareFrenzyTimer > 0) + { + damage /= 2; + } + if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) + { + damage /= 2; + } + } + #endregion + + #region ModifyHitByProj + public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) + { + if (cEnergy && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + damage = (int)((double)damage * 0.75); + } + if (beeResist) + { + if (CalamityMod.beeProjectileList.Contains(proj.type)) { damage = (int)((double)damage * 0.75); } + } + if (Main.hardMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + if (CalamityMod.hardModeNerfList.Contains(proj.type)) + { + double multiplier = Main.expertMode ? 0.6 : 0.8; + damage = (int)((double)damage * multiplier); + } + } + } + #endregion + + #region OnHit + public override void OnHitByNPC(NPC npc, int damage, bool crit) + { + if (CalamityGlobalNPC.lordeBoss >= 0) + { + player.AddBuff(mod.BuffType("NOU"), 15, true); + } + } + + public override void OnHitByProjectile(Projectile proj, int damage, bool crit) + { + if (CalamityGlobalNPC.lordeBoss >= 0) + { + player.AddBuff(mod.BuffType("NOU"), 15, true); + } + if (proj.type == 257 && proj.hostile && Main.rand.Next(2) == 0 && !player.frozen && !gState) + { + player.AddBuff(mod.BuffType("GlacialState"), 120); + } + if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(10) == 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 (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 (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 < 120) + { + caughtType = mod.ItemType("Floodtide"); + } + if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 120) + { + caughtType = mod.ItemType("AlluringBait"); + } + if (power >= 80) + { + if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.Next(15) == 0 && power < 140) + { + 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 >= 100) + { + if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 160) + { + caughtType = mod.ItemType("AbyssalAmulet"); + } + } + } + } + } + } + } + #endregion + + #region FrameEffects + public override void FrameEffects() + { + 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 (NOU) + { + NOULOL(); + } + if (weakPetrification) + { + WeakPetrification(); + } + } + #endregion + + #region NOULOL + private void NOULOL() + { + player.ResetEffects(); + player.head = -1; + player.body = -1; + player.legs = -1; + player.handon = -1; + player.handoff = -1; + player.back = -1; + player.front = -1; + player.shoe = -1; + player.waist = -1; + player.shield = -1; + player.neck = -1; + player.face = -1; + player.balloon = -1; + NOU = true; + } + + 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; + } + #endregion + + #region HurtMethods + public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + { + if (CalamityWorld.armageddon) + { + if (CalamityGlobalNPC.AnyBossNPCS()) + { + KillPlayer(); + } + } + if (lol || invincible) + { + return false; + } + if (godSlayerReflect && Main.rand.Next(50) == 0) + { + return false; + } + if (CalamityGlobalNPC.DraedonMayhem) + { + damage = (int)((double)damage * 1.2); + } + if (Main.pumpkinMoon && CalamityWorld.downedDoG) + { + damage = (int)((double)damage * 1.4); + } + else if (Main.snowMoon && CalamityWorld.downedDoG) + { + damage = (int)((double)damage * 1.3); + } + else if (Main.eclipse && CalamityWorld.downedYharon) + { + damage = (int)((double)damage * 1.6); + } + if (dArtifact) + { + damage = (int)((double)damage * 1.25); + } + if (CalamityWorld.bossRushActive) + { + switch (bossRushStage) + { + case 0: + damage = (int)((double)damage * 3.0); //Tier 1 Queen Bee + break; + case 1: + damage = (int)((double)damage * 3.0); //BoC + break; + case 2: + damage = (int)((double)damage * 3.0); //King Slime + break; + case 3: + damage = (int)((double)damage * 4.0); //EoC + break; + case 4: + damage = (int)((double)damage * 2.0); //Prime + break; + case 5: + damage = (int)((double)damage * 1.75); //Golem + break; + case 6: + damage = (int)((double)damage * 1.25); //Guardians + break; + case 7: + damage = (int)((double)damage * 3.5); //EoW + break; + case 8: + damage = (int)((double)damage * 2.0); //Tier 2 Astrageldon + break; + case 9: + damage = (int)((double)damage * 3.0); //Destroyer + break; + case 10: + damage = (int)((double)damage * 3.0); //Twins + break; + case 11: + damage = (int)((double)damage * 1.0); //Birb + break; + case 12: + damage = (int)((double)damage * 3.5); //WoF + break; + case 13: + damage = (int)((double)damage * 4.0); //Hive Mind + break; + case 14: + damage = (int)((double)damage * 4.0); //Skeletron + break; + case 15: + damage = (int)((double)damage * 1.25); //Storm Weaver + break; + case 16: + damage = (int)((double)damage * 2.5); //Tier 3 Aquatic Scourge + break; + case 17: + damage = (int)((double)damage * 4.75); //Desert Scourge + break; + case 18: + damage = (int)((double)damage * 2.5); //Cultist + break; + case 19: + damage = (int)((double)damage * 4.75); //Crabulon + break; + case 20: + damage = (int)((double)damage * 2.5); //Plantera + break; + case 21: + damage = (int)((double)damage * 1.5); //Void + break; + case 22: + damage = (int)((double)damage * 4.75); //Perfs + break; + case 23: + damage = (int)((double)damage * 3.0); //Cryogen + break; + case 24: + damage = (int)((double)damage * 3.25); //Tier 4 Brimstone Elemental + break; + case 25: + damage = (int)((double)damage * 1.75); //Signus + break; + case 26: + damage = (int)((double)damage * 2.5); //Ravager + break; + case 27: + damage = (int)((double)damage * 3.25); //Fishron + break; + case 28: + damage = (int)((double)damage * 2.5); //Moon Lord + break; + case 29: + damage = (int)((double)damage * 2.5); //Astrum Deus + break; + case 30: + damage = (int)((double)damage * 1.75); //Polter + break; + case 31: + damage = (int)((double)damage * 2.5); //Plaguebringer + break; + case 32: + damage = (int)((double)damage * 4.0); //Tier 5 Calamitas + break; + case 33: + damage = (int)((double)damage * 3.5); //Levi and Siren + break; + case 34: + damage = (int)((double)damage * 4.75); //Slime God + break; + case 35: + damage = (int)((double)damage * 2.5); //Providence + break; + case 36: + damage = (int)((double)damage * 1.0); //SCal + break; + case 37: + damage = (int)((double)damage * 1.25); //Yharon + break; + case 38: + damage = (int)((double)damage * 2.0); //DoG + break; + } + } + if (enraged) + { + damage = (int)((double)damage * 1.5); + } + if (CalamityWorld.revenge) + { + if (NPC.golemBoss > 0) + { + damage = (int)((double)damage * CalamityGlobalNPC.golemDamageBonus); + } + else if (NPC.AnyNPCs(NPCID.MoonLordCore)) + { + damage = (int)((double)damage * 1.1); + } + else if (NPC.AnyNPCs(NPCID.CultistBoss)) + { + damage = (int)((double)damage * 1.2); + } + if (player.ichor) + { + damage = (int)((double)damage * 1.25); + } + else if (player.onFire2) + { + damage = (int)((double)damage * 1.2); + } + customDamage = true; + float damageMult = CalamityWorld.downedBossAny ? 1.05f : 0.8f; + if (CalamityWorld.death) + { + damageMult = 1.5f; + } + damage = (int)((double)damage * damageMult); + double newDamage = (double)damage - (double)player.statDefense * 0.625; + double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 15.0 : 0.0); //5, 10, 15, 30 + if (newDamage < newDamageLimit) + { + newDamage = newDamageLimit; + } + damage = (int)newDamage; + } + if (bloodPact) + { + if (Main.rand.Next(4) == 0) + { + damage = (int)((double)damage * 3.0); + } + } + if (godSlayerDamage && damage <= 80) + { + damage = 1; + } + if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + playSound = false; + 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 + } + if (abyssalDivingSuitPlates) + { + damage = (int)((double)damage * 0.75); + } + if (sirenIce) + { + damage = (int)((double)damage * 0.75); + } + if (auricSet) + { + damage = (int)((double)damage * 0.9); + } + else if (silvaSet) + { + damage = (int)((double)damage * 0.95); + } + if (revivifyTimer > 0) + { + int healAmt = damage / 10; + 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 / 16; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + if (CalamityGlobalNPC.SCal > -1) + { + int newDamageLimit = 300; + if (damage < newDamageLimit) + { + damage = newDamageLimit; + } + } + return true; + } + + public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + { + modStealth = 1f; + if (player.whoAmI == Main.myPlayer && rageMode) + { + stress = 0; + if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) { player.ClearBuff(mod.BuffType("RageMode")); } + } + if (player.whoAmI == Main.myPlayer && !adrenalineMode && adrenaline != adrenalineMax) + { + adrenaline = 0; + } + if (player.whoAmI == Main.myPlayer && gShell && !player.panic) + { + player.AddBuff(mod.BuffType("ShellBoost"), 300); + } + if (player.whoAmI == Main.myPlayer && 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 (player.whoAmI == Main.myPlayer && 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 && player.whoAmI == Main.myPlayer) + { + if (Main.rand.Next(4) == 0) + { + player.AddBuff(mod.BuffType("TarraLifeRegen"), Main.rand.Next(120, 360)); + } + } + if (player.whoAmI == Main.myPlayer && xerocSet) + { + player.AddBuff(mod.BuffType("XerocRage"), 240); + player.AddBuff(mod.BuffType("XerocWrath"), 240); + } + else if (player.whoAmI == Main.myPlayer && reaverBlast) + { + player.AddBuff(mod.BuffType("ReaverRage"), 180); + } + if ((fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) && Main.myPlayer == player.whoAmI) + { + 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 && Main.myPlayer == player.whoAmI) + { + 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 (CalamityGlobalNPC.SCal > -1 && 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 (CalamityWorld.revenge) + { + int stressGain = (int)((double)damage * 10); + int stressMaxGain = 2500; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + 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 (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) + { + 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 = 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 ? 40 : 10; + 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; + int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); + int spore2 = 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"), 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() + { + player.lastDeathPostion = player.Center; + player.lastDeathTime = DateTime.Now; + player.showLastDeath = true; + bool specialDeath = CalamityWorld.ironHeart && CalamityGlobalNPC.AnyBossNPCS(); + 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 == 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.992f; + float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); + float num10 = 0.96f; + 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; + } + } + num7 = 14f; + num8 = 0.985f; + num10 = 0.94f; + } + 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 = 16f; //14 + num8 = 0.985f; + num10 = 0.94f; + } + 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 = 18f; //14 + num8 = 0.985f; + num10 = 0.94f; + } + 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 = 16.9f * (float)num16; //16.9 + 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 = 21.9f * (float)num23; //21.9 14*1.564 + 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 = 25f * (float)num23; //21.9 16*1.564 + 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 = 28.2f * (float)num23; //18*1.564 + 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; + } + } + } + } + } + + private void OnDodge() + { + if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) + { + player.AddBuff(mod.BuffType("ScarfMeleeBoost"), Main.rand.Next(480, 561)); + player.AddBuff(mod.BuffType("ScarfCooldown"), ((player.chaosState && CalamityWorld.revenge) ? 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 (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); + } + } + } + } + #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); + } + }); + + public override void ModifyDrawLayers(List list) + { + MiscEffectsBack.visible = true; + list.Insert(0, MiscEffectsBack); + if (fab) { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } + } + + public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo edi) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Player drawPlayer = edi.drawPlayer; + if (drawPlayer.mount != null && drawPlayer.GetModPlayer(mod).fab) { drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); } + }); + + 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) + { + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + r *= 0.07f; + g *= 0.15f; + b *= 0.01f; + fullBright = true; + } + if (gState || cDepth) + { + 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) + { + 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); + } + 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); + } + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + #endregion + + #region PacketStuff + 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); + } + } + + 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); + } + } + + public override void OnEnterWorld(Player player) + { + if (Main.netMode == 1) + { + StressPacket(false); + AdrenalinePacket(false); + } + } + #endregion + + #region ChangeTime + public void ChangeTime(bool day) + { + if (day) + { + Main.time = 0.0; + Main.dayTime = true; + } + else + { + Main.time = 0.0; + Main.dayTime = false; + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + #endregion + } +} diff --git a/CalamityWorld.cs b/CalamityWorld.cs index a99550a347..5bb8fd1d26 100644 --- a/CalamityWorld.cs +++ b/CalamityWorld.cs @@ -1,1822 +1,1861 @@ -using System; -using System.IO; -using System.Linq; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.Graphics.Effects; -using Terraria.GameContent.Generation; -using Terraria.IO; -using Terraria.Localization; -using Terraria.GameContent.Events; -using Terraria.ModLoader.IO; -using CalamityMod.Tiles; -using CalamityMod.NPCs; -using CalamityMod.World.Planets; - -namespace CalamityMod -{ - public class CalamityWorld : ModWorld - { - #region InstanceVars - - #region NormalVars - public static bool bossRushActive = false; - - public static int bossRushSpawnCountdown = 180; - - private const int ExpandWorldBy = 200; - - private const int saveVersion = 0; - - private static int fehX = 0; - - private static int fehY = 0; - - private static int fuhX = 0; - - private static int fuhY = 0; - - private static int numAbyssIslands = 0; - - private static int[] AbyssIslandX = new int[20]; - - private static int[] AbyssIslandY = new int[20]; - - private static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - - private static bool genIcePyramid = true; - - private static int[] SChestX = new int[10]; - - private static int[] SChestY = new int[10]; - - private static bool genHellHut = true; - - private static bool genSandHut = true; - - private static bool genEvilHut = true; - - private static bool genPureHut = true; //forest - - private static bool genIceHut = true; - - private static bool genMushroomHut = true; - - private static bool genGraniteHut = true; - - private static bool genMarbleHut = true; - - private static bool genSwordHut = true; - - public static int calamityTiles = 0; - - public static int astralTiles = 0; - - public static int seaTiles = 0; - - public static int sulphurTiles = 0; - - public static int abyssTiles = 0; - - public static bool abyssSide = false; - - public static bool spring = false; - - public static bool summer = false; - - public static bool fall = false; - - public static bool winter = false; - - public static bool downedDesertScourge = false; - - public static bool downedAquaticScourge = false; - - public static bool downedHiveMind = false; - - public static bool downedPerforator = false; - - public static bool downedSlimeGod = false; - - public static bool downedCryogen = false; - - public static bool downedBrimstoneElemental = false; - - public static bool downedCalamitas = false; - - public static bool downedLeviathan = false; - - public static bool downedDoG = false; - - public static bool downedPlaguebringer = false; - - public static bool downedYharon = false; - - public static bool buffedEclipse = false; - - public static bool downedProvidence = false; - - public static bool downedGuardians = false; - - public static bool downedSentinel1 = false; - - public static bool downedSentinel2 = false; - - public static bool downedSentinel3 = false; - - public static bool downedSCal = false; - - public static bool downedBumble = false; - - public static bool downedCrabulon = false; - - public static bool downedBetsy = false; - - public static bool downedScavenger = false; - - public static bool downedWhar = false; //boss 2 - - public static bool downedSkullHead = false; //boss 3 - - public static bool downedUgly = false; //Wall - - public static bool downedSkeletor = false; //Skele of tron Prime - - public static bool downedPlantThing = false; //planter - - public static bool downedGolemBaby = false; //Baby - - public static bool downedMoonDude = false; //Moon guy - - public static bool downedBossAny = false; //Any boss - - public static bool spawnedHardBoss = false; //Hardmode boss spawned - - public static bool demonMode = false; - - public static bool onionMode = false; - - public static bool revenge = false; - - public static bool death = false; - - public static bool defiled = false; - - public static bool armageddon = false; - - public static bool downedStarGod = false; - - public static bool downedAstrageldon = false; - - public static bool spawnAstralMeteor = false; - - public static bool spawnAstralMeteor2 = false; - - public static bool spawnAstralMeteor3 = false; - - public static bool downedPolterghast = false; - - public static bool downedLORDE = false; - - public static bool downedBuffedMothron = false; - - public static bool ironHeart = false; - #endregion - - #endregion - - #region Initialize - public override void Initialize() - { - CalamityPlayer.bossRushStage = 0; - CalamityGlobalNPC.golemDamageBonus = 1.0; - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - CalamityGlobalNPC.holyBoss = -1; - CalamityGlobalNPC.doughnutBoss = -1; - CalamityGlobalNPC.voidBoss = -1; - CalamityGlobalNPC.energyFlame = -1; - CalamityGlobalNPC.hiveMind = -1; - CalamityGlobalNPC.hiveMind2 = -1; - CalamityGlobalNPC.scavenger = -1; - CalamityGlobalNPC.DoGHead = -1; - CalamityGlobalNPC.ghostBoss = -1; - CalamityGlobalNPC.laserEye = -1; - CalamityGlobalNPC.fireEye = -1; - CalamityGlobalNPC.brimstoneElemental = -1; - bossRushActive = false; - bossRushSpawnCountdown = 180; - abyssSide = false; - downedDesertScourge = false; - downedAquaticScourge = false; - downedHiveMind = false; - downedPerforator = false; - downedSlimeGod = false; - downedCryogen = false; - downedBrimstoneElemental = false; - downedCalamitas = false; - downedLeviathan = false; - downedDoG = false; - downedPlaguebringer = false; - downedGuardians = false; - downedProvidence = false; - downedSentinel1 = false; - downedSentinel2 = false; - downedSentinel3 = false; - downedYharon = false; - buffedEclipse = false; - downedSCal = false; - downedBumble = false; - downedCrabulon = false; - downedBetsy = false; - downedScavenger = false; - downedWhar = false; - downedSkullHead = false; - downedUgly = false; - downedSkeletor = false; - downedPlantThing = false; - downedGolemBaby = false; - downedMoonDude = false; - downedBossAny = false; - spawnedHardBoss = false; - demonMode = false; - onionMode = false; - revenge = false; - downedStarGod = false; - downedAstrageldon = false; - spawnAstralMeteor = false; - spawnAstralMeteor2 = false; - spawnAstralMeteor3 = false; - downedPolterghast = false; - downedLORDE = false; - downedBuffedMothron = false; - death = false; - defiled = false; - armageddon = false; - ironHeart = false; - } - #endregion - - #region Save - public override TagCompound Save() - { - var downed = new List(); - if (downedDesertScourge) downed.Add("desertScourge"); - if (downedAquaticScourge) downed.Add("aquaticScourge"); - if (downedHiveMind) downed.Add("hiveMind"); - if (downedPerforator) downed.Add("perforator"); - if (downedSlimeGod) downed.Add("slimeGod"); - if (downedCryogen) downed.Add("cryogen"); - if (downedBrimstoneElemental) downed.Add("brimstoneElemental"); - if (downedCalamitas) downed.Add("calamitas"); - if (downedLeviathan) downed.Add("leviathan"); - if (downedDoG) downed.Add("devourerOfGods"); - if (downedPlaguebringer) downed.Add("plaguebringerGoliath"); - if (downedGuardians) downed.Add("guardians"); - if (downedProvidence) downed.Add("providence"); - if (downedSentinel1) downed.Add("ceaselessVoid"); - if (downedSentinel2) downed.Add("stormWeaver"); - if (downedSentinel3) downed.Add("signus"); - if (downedYharon) downed.Add("yharon"); - if (buffedEclipse) downed.Add("eclipse"); - if (downedSCal) downed.Add("supremeCalamitas"); - if (downedBumble) downed.Add("bumblebirb"); - if (downedCrabulon) downed.Add("crabulon"); - if (downedBetsy) downed.Add("betsy"); - if (downedScavenger) downed.Add("scavenger"); - if (downedWhar) downed.Add("boss2"); - if (downedSkullHead) downed.Add("boss3"); - if (downedUgly) downed.Add("wall"); - if (downedSkeletor) downed.Add("skeletronPrime"); - if (downedPlantThing) downed.Add("planter"); - if (downedGolemBaby) downed.Add("baby"); - if (downedMoonDude) downed.Add("moonDude"); - if (downedBossAny) downed.Add("anyBoss"); - if (demonMode) downed.Add("demonMode"); - if (onionMode) downed.Add("onionMode"); - if (revenge) downed.Add("revenge"); - if (downedStarGod) downed.Add("starGod"); - if (downedAstrageldon) downed.Add("astrageldon"); - if (spawnAstralMeteor) downed.Add("astralMeteor"); - if (spawnAstralMeteor2) downed.Add("astralMeteor2"); - if (spawnAstralMeteor3) downed.Add("astralMeteor3"); - if (spawnedHardBoss) downed.Add("hardBoss"); - if (downedPolterghast) downed.Add("polterghast"); - if (downedLORDE) downed.Add("lorde"); - if (downedBuffedMothron) downed.Add("moth"); - if (death) downed.Add("death"); - if (defiled) downed.Add("defiled"); - if (armageddon) downed.Add("armageddon"); - if (ironHeart) downed.Add("ironHeart"); - if (abyssSide) downed.Add("abyssSide"); - if (bossRushActive) downed.Add("bossRushActive"); - - return new TagCompound - { - { - "downed", downed - } - }; - } - #endregion - - #region Load - public override void Load(TagCompound tag) - { - var downed = tag.GetList("downed"); - downedDesertScourge = downed.Contains("desertScourge"); - downedAquaticScourge = downed.Contains("aquaticScourge"); - downedHiveMind = downed.Contains("hiveMind"); - downedPerforator = downed.Contains("perforator"); - downedSlimeGod = downed.Contains("slimeGod"); - downedCryogen = downed.Contains("cryogen"); - downedBrimstoneElemental = downed.Contains("brimstoneElemental"); - downedCalamitas = downed.Contains("calamitas"); - downedLeviathan = downed.Contains("leviathan"); - downedDoG = downed.Contains("devourerOfGods"); - downedPlaguebringer = downed.Contains("plaguebringerGoliath"); - downedGuardians = downed.Contains("guardians"); - downedProvidence = downed.Contains("providence"); - downedSentinel1 = downed.Contains("ceaselessVoid"); - downedSentinel2 = downed.Contains("stormWeaver"); - downedSentinel3 = downed.Contains("signus"); - downedYharon = downed.Contains("yharon"); - buffedEclipse = downed.Contains("eclipse"); - downedSCal = downed.Contains("supremeCalamitas"); - downedBumble = downed.Contains("bumblebirb"); - downedCrabulon = downed.Contains("crabulon"); - downedBetsy = downed.Contains("betsy"); - downedScavenger = downed.Contains("scavenger"); - downedWhar = downed.Contains("boss2"); - downedSkullHead = downed.Contains("boss3"); - downedUgly = downed.Contains("wall"); - downedSkeletor = downed.Contains("skeletronPrime"); - downedPlantThing = downed.Contains("planter"); - downedGolemBaby = downed.Contains("baby"); - downedMoonDude = downed.Contains("moonDude"); - downedBossAny = downed.Contains("anyBoss"); - demonMode = downed.Contains("demonMode"); - onionMode = downed.Contains("onionMode"); - revenge = downed.Contains("revenge"); - downedStarGod = downed.Contains("starGod"); - downedAstrageldon = downed.Contains("astrageldon"); - spawnAstralMeteor = downed.Contains("astralMeteor"); - spawnAstralMeteor2 = downed.Contains("astralMeteor2"); - spawnAstralMeteor3 = downed.Contains("astralMeteor3"); - spawnedHardBoss = downed.Contains("hardBoss"); - downedPolterghast = downed.Contains("polterghast"); - downedLORDE = downed.Contains("lorde"); - downedBuffedMothron = downed.Contains("moth"); - death = downed.Contains("death"); - defiled = downed.Contains("defiled"); - armageddon = downed.Contains("armageddon"); - ironHeart = downed.Contains("ironHeart"); - abyssSide = downed.Contains("abyssSide"); - bossRushActive = downed.Contains("bossRushActive"); - } - #endregion - - #region LoadLegacy - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; - - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - downedWhar = flags3[5]; - downedSkullHead = flags3[6]; - downedUgly = flags3[7]; - - BitsByte flags4 = reader.ReadByte(); - downedSkeletor = flags4[0]; - downedPlantThing = flags4[1]; - downedGolemBaby = flags4[2]; - downedMoonDude = flags4[3]; - downedBossAny = flags4[4]; - demonMode = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; - - BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - spawnAstralMeteor = flags5[1]; - spawnAstralMeteor2 = flags5[2]; - spawnAstralMeteor3 = flags5[3]; - spawnedHardBoss = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedLORDE = flags5[7]; - - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; - armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; - ironHeart = flags6[7]; - - BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; - } - else - { - ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); - } - } - #endregion - - #region NetSend - public override void NetSend(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = downedDesertScourge; - flags[1] = downedHiveMind; - flags[2] = downedPerforator; - flags[3] = downedSlimeGod; - flags[4] = downedCryogen; - flags[5] = downedBrimstoneElemental; - flags[6] = downedCalamitas; - flags[7] = downedLeviathan; - - BitsByte flags2 = new BitsByte(); - flags2[0] = downedDoG; - flags2[1] = downedPlaguebringer; - flags2[2] = downedGuardians; - flags2[3] = downedProvidence; - flags2[4] = downedSentinel1; - flags2[5] = downedSentinel2; - flags2[6] = downedSentinel3; - flags2[7] = downedYharon; - - BitsByte flags3 = new BitsByte(); - flags3[0] = downedSCal; - flags3[1] = downedBumble; - flags3[2] = downedCrabulon; - flags3[3] = downedBetsy; - flags3[4] = downedScavenger; - flags3[5] = downedWhar; - flags3[6] = downedSkullHead; - flags3[7] = downedUgly; - - BitsByte flags4 = new BitsByte(); - flags4[0] = downedSkeletor; - flags4[1] = downedPlantThing; - flags4[2] = downedGolemBaby; - flags4[3] = downedMoonDude; - flags4[4] = downedBossAny; - flags4[5] = demonMode; - flags4[6] = onionMode; - flags4[7] = revenge; - - BitsByte flags5 = new BitsByte(); - flags5[0] = downedStarGod; - flags5[1] = spawnAstralMeteor; - flags5[2] = spawnAstralMeteor2; - flags5[3] = spawnAstralMeteor3; - flags5[4] = spawnedHardBoss; - flags5[5] = downedPolterghast; - flags5[6] = death; - flags5[7] = downedLORDE; - - BitsByte flags6 = new BitsByte(); - flags6[0] = abyssSide; - flags6[1] = downedAquaticScourge; - flags6[2] = downedAstrageldon; - flags6[3] = buffedEclipse; - flags6[4] = armageddon; - flags6[5] = defiled; - flags6[6] = downedBuffedMothron; - flags6[7] = ironHeart; - - BitsByte flags7 = new BitsByte(); - flags7[0] = bossRushActive; - - writer.Write(flags); - writer.Write(flags2); - writer.Write(flags3); - writer.Write(flags4); - writer.Write(flags5); - writer.Write(flags6); - writer.Write(flags7); - } - #endregion - - #region NetReceive - public override void NetReceive(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; - - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - downedWhar = flags3[5]; - downedSkullHead = flags3[6]; - downedUgly = flags3[7]; - - BitsByte flags4 = reader.ReadByte(); - downedSkeletor = flags4[0]; - downedPlantThing = flags4[1]; - downedGolemBaby = flags4[2]; - downedMoonDude = flags4[3]; - downedBossAny = flags4[4]; - demonMode = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; - - BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - spawnAstralMeteor = flags5[1]; - spawnAstralMeteor2 = flags5[2]; - spawnAstralMeteor3 = flags5[3]; - spawnedHardBoss = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedLORDE = flags5[7]; - - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; - armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; - ironHeart = flags6[7]; - - BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; - } - #endregion - - #region Tiles - public override void ResetNearbyTileEffects() - { - calamityTiles = 0; - astralTiles = 0; - seaTiles = 0; - sulphurTiles = 0; - abyssTiles = 0; - } - - public override void TileCountsAvailable(int[] tileCounts) - { - calamityTiles = tileCounts[mod.TileType("CharredOre")] + tileCounts[mod.TileType("BrimstoneSlag")]; - seaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("SeaPrism")]; - abyssTiles = tileCounts[mod.TileType("AbyssGravel")]; - sulphurTiles = tileCounts[mod.TileType("SulphurousSand")]; - - #region Astral Stuff +using System; +using System.IO; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.Graphics.Effects; +using Terraria.GameContent.Generation; +using Terraria.IO; +using Terraria.Localization; +using Terraria.GameContent.Events; +using Terraria.ModLoader.IO; +using CalamityMod.Tiles; +using CalamityMod.NPCs; +using CalamityMod.World.Planets; + +namespace CalamityMod +{ + public class CalamityWorld : ModWorld + { + #region InstanceVars + + #region NormalVars + public static bool bossRushActive = false; + + public static int bossRushSpawnCountdown = 180; + + private const int ExpandWorldBy = 200; + + private const int saveVersion = 0; + + private static int fehX = 0; + + private static int fehY = 0; + + private static int fuhX = 0; + + private static int fuhY = 0; + + private static int numAbyssIslands = 0; + + private static int[] AbyssIslandX = new int[20]; + + private static int[] AbyssIslandY = new int[20]; + + private static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + private static bool genIcePyramid = true; + + private static int[] SChestX = new int[10]; + + private static int[] SChestY = new int[10]; + + private static bool genHellHut = true; + + private static bool genSandHut = true; + + private static bool genEvilHut = true; + + private static bool genPureHut = true; //forest + + private static bool genIceHut = true; + + private static bool genMushroomHut = true; + + private static bool genGraniteHut = true; + + private static bool genMarbleHut = true; + + private static bool genSwordHut = true; + + private static bool genAbyssHut = true; + + public static int calamityTiles = 0; + + public static int astralTiles = 0; + + public static int seaTiles = 0; + + public static int sulphurTiles = 0; + + public static int abyssTiles = 0; + + public static bool abyssSide = false; + + public static bool spring = false; + + public static bool summer = false; + + public static bool fall = false; + + public static bool winter = false; + + public static bool downedDesertScourge = false; + + public static bool downedAquaticScourge = false; + + public static bool downedHiveMind = false; + + public static bool downedPerforator = false; + + public static bool downedSlimeGod = false; + + public static bool downedCryogen = false; + + public static bool downedBrimstoneElemental = false; + + public static bool downedCalamitas = false; + + public static bool downedLeviathan = false; + + public static bool downedDoG = false; + + public static bool downedPlaguebringer = false; + + public static bool downedYharon = false; + + public static bool buffedEclipse = false; + + public static bool downedProvidence = false; + + public static bool downedGuardians = false; + + public static bool downedSentinel1 = false; + + public static bool downedSentinel2 = false; + + public static bool downedSentinel3 = false; + + public static bool downedSCal = false; + + public static bool downedBumble = false; + + public static bool downedCrabulon = false; + + public static bool downedBetsy = false; + + public static bool downedScavenger = false; + + public static bool downedWhar = false; //boss 2 + + public static bool downedSkullHead = false; //boss 3 + + public static bool downedUgly = false; //Wall + + public static bool downedSkeletor = false; //Skele of tron Prime + + public static bool downedPlantThing = false; //planter + + public static bool downedGolemBaby = false; //Baby + + public static bool downedMoonDude = false; //Moon guy + + public static bool downedBossAny = false; //Any boss + + public static bool spawnedHardBoss = false; //Hardmode boss spawned + + public static bool demonMode = false; + + public static bool onionMode = false; + + public static bool revenge = false; + + public static bool death = false; + + public static bool defiled = false; + + public static bool armageddon = false; + + public static bool downedStarGod = false; + + public static bool downedAstrageldon = false; + + public static bool spawnAstralMeteor = false; + + public static bool spawnAstralMeteor2 = false; + + public static bool spawnAstralMeteor3 = false; + + public static bool downedPolterghast = false; + + public static bool downedLORDE = false; + + public static bool downedBuffedMothron = false; + + public static bool ironHeart = false; + #endregion + + #endregion + + #region Initialize + public override void Initialize() + { + CalamityPlayer.bossRushStage = 0; + CalamityGlobalNPC.golemDamageBonus = 1.0; + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + CalamityGlobalNPC.holyBoss = -1; + CalamityGlobalNPC.doughnutBoss = -1; + CalamityGlobalNPC.voidBoss = -1; + CalamityGlobalNPC.energyFlame = -1; + CalamityGlobalNPC.hiveMind = -1; + CalamityGlobalNPC.hiveMind2 = -1; + CalamityGlobalNPC.scavenger = -1; + CalamityGlobalNPC.DoGHead = -1; + CalamityGlobalNPC.ghostBoss = -1; + CalamityGlobalNPC.laserEye = -1; + CalamityGlobalNPC.fireEye = -1; + CalamityGlobalNPC.brimstoneElemental = -1; + bossRushActive = false; + bossRushSpawnCountdown = 180; + abyssSide = false; + downedDesertScourge = false; + downedAquaticScourge = false; + downedHiveMind = false; + downedPerforator = false; + downedSlimeGod = false; + downedCryogen = false; + downedBrimstoneElemental = false; + downedCalamitas = false; + downedLeviathan = false; + downedDoG = false; + downedPlaguebringer = false; + downedGuardians = false; + downedProvidence = false; + downedSentinel1 = false; + downedSentinel2 = false; + downedSentinel3 = false; + downedYharon = false; + buffedEclipse = false; + downedSCal = false; + downedBumble = false; + downedCrabulon = false; + downedBetsy = false; + downedScavenger = false; + downedWhar = false; + downedSkullHead = false; + downedUgly = false; + downedSkeletor = false; + downedPlantThing = false; + downedGolemBaby = false; + downedMoonDude = false; + downedBossAny = false; + spawnedHardBoss = false; + demonMode = false; + onionMode = false; + revenge = false; + downedStarGod = false; + downedAstrageldon = false; + spawnAstralMeteor = false; + spawnAstralMeteor2 = false; + spawnAstralMeteor3 = false; + downedPolterghast = false; + downedLORDE = false; + downedBuffedMothron = false; + death = false; + defiled = false; + armageddon = false; + ironHeart = false; + } + #endregion + + #region Save + public override TagCompound Save() + { + var downed = new List(); + if (downedDesertScourge) downed.Add("desertScourge"); + if (downedAquaticScourge) downed.Add("aquaticScourge"); + if (downedHiveMind) downed.Add("hiveMind"); + if (downedPerforator) downed.Add("perforator"); + if (downedSlimeGod) downed.Add("slimeGod"); + if (downedCryogen) downed.Add("cryogen"); + if (downedBrimstoneElemental) downed.Add("brimstoneElemental"); + if (downedCalamitas) downed.Add("calamitas"); + if (downedLeviathan) downed.Add("leviathan"); + if (downedDoG) downed.Add("devourerOfGods"); + if (downedPlaguebringer) downed.Add("plaguebringerGoliath"); + if (downedGuardians) downed.Add("guardians"); + if (downedProvidence) downed.Add("providence"); + if (downedSentinel1) downed.Add("ceaselessVoid"); + if (downedSentinel2) downed.Add("stormWeaver"); + if (downedSentinel3) downed.Add("signus"); + if (downedYharon) downed.Add("yharon"); + if (buffedEclipse) downed.Add("eclipse"); + if (downedSCal) downed.Add("supremeCalamitas"); + if (downedBumble) downed.Add("bumblebirb"); + if (downedCrabulon) downed.Add("crabulon"); + if (downedBetsy) downed.Add("betsy"); + if (downedScavenger) downed.Add("scavenger"); + if (downedWhar) downed.Add("boss2"); + if (downedSkullHead) downed.Add("boss3"); + if (downedUgly) downed.Add("wall"); + if (downedSkeletor) downed.Add("skeletronPrime"); + if (downedPlantThing) downed.Add("planter"); + if (downedGolemBaby) downed.Add("baby"); + if (downedMoonDude) downed.Add("moonDude"); + if (downedBossAny) downed.Add("anyBoss"); + if (demonMode) downed.Add("demonMode"); + if (onionMode) downed.Add("onionMode"); + if (revenge) downed.Add("revenge"); + if (downedStarGod) downed.Add("starGod"); + if (downedAstrageldon) downed.Add("astrageldon"); + if (spawnAstralMeteor) downed.Add("astralMeteor"); + if (spawnAstralMeteor2) downed.Add("astralMeteor2"); + if (spawnAstralMeteor3) downed.Add("astralMeteor3"); + if (spawnedHardBoss) downed.Add("hardBoss"); + if (downedPolterghast) downed.Add("polterghast"); + if (downedLORDE) downed.Add("lorde"); + if (downedBuffedMothron) downed.Add("moth"); + if (death) downed.Add("death"); + if (defiled) downed.Add("defiled"); + if (armageddon) downed.Add("armageddon"); + if (ironHeart) downed.Add("ironHeart"); + if (abyssSide) downed.Add("abyssSide"); + if (bossRushActive) downed.Add("bossRushActive"); + + return new TagCompound + { + { + "downed", downed + } + }; + } + #endregion + + #region Load + public override void Load(TagCompound tag) + { + var downed = tag.GetList("downed"); + downedDesertScourge = downed.Contains("desertScourge"); + downedAquaticScourge = downed.Contains("aquaticScourge"); + downedHiveMind = downed.Contains("hiveMind"); + downedPerforator = downed.Contains("perforator"); + downedSlimeGod = downed.Contains("slimeGod"); + downedCryogen = downed.Contains("cryogen"); + downedBrimstoneElemental = downed.Contains("brimstoneElemental"); + downedCalamitas = downed.Contains("calamitas"); + downedLeviathan = downed.Contains("leviathan"); + downedDoG = downed.Contains("devourerOfGods"); + downedPlaguebringer = downed.Contains("plaguebringerGoliath"); + downedGuardians = downed.Contains("guardians"); + downedProvidence = downed.Contains("providence"); + downedSentinel1 = downed.Contains("ceaselessVoid"); + downedSentinel2 = downed.Contains("stormWeaver"); + downedSentinel3 = downed.Contains("signus"); + downedYharon = downed.Contains("yharon"); + buffedEclipse = downed.Contains("eclipse"); + downedSCal = downed.Contains("supremeCalamitas"); + downedBumble = downed.Contains("bumblebirb"); + downedCrabulon = downed.Contains("crabulon"); + downedBetsy = downed.Contains("betsy"); + downedScavenger = downed.Contains("scavenger"); + downedWhar = downed.Contains("boss2"); + downedSkullHead = downed.Contains("boss3"); + downedUgly = downed.Contains("wall"); + downedSkeletor = downed.Contains("skeletronPrime"); + downedPlantThing = downed.Contains("planter"); + downedGolemBaby = downed.Contains("baby"); + downedMoonDude = downed.Contains("moonDude"); + downedBossAny = downed.Contains("anyBoss"); + demonMode = downed.Contains("demonMode"); + onionMode = downed.Contains("onionMode"); + revenge = downed.Contains("revenge"); + downedStarGod = downed.Contains("starGod"); + downedAstrageldon = downed.Contains("astrageldon"); + spawnAstralMeteor = downed.Contains("astralMeteor"); + spawnAstralMeteor2 = downed.Contains("astralMeteor2"); + spawnAstralMeteor3 = downed.Contains("astralMeteor3"); + spawnedHardBoss = downed.Contains("hardBoss"); + downedPolterghast = downed.Contains("polterghast"); + downedLORDE = downed.Contains("lorde"); + downedBuffedMothron = downed.Contains("moth"); + death = downed.Contains("death"); + defiled = downed.Contains("defiled"); + armageddon = downed.Contains("armageddon"); + ironHeart = downed.Contains("ironHeart"); + abyssSide = downed.Contains("abyssSide"); + bossRushActive = downed.Contains("bossRushActive"); + } + #endregion + + #region LoadLegacy + public override void LoadLegacy(BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + downedDesertScourge = flags[0]; + downedHiveMind = flags[1]; + downedPerforator = flags[2]; + downedSlimeGod = flags[3]; + downedCryogen = flags[4]; + downedBrimstoneElemental = flags[5]; + downedCalamitas = flags[6]; + downedLeviathan = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + downedDoG = flags2[0]; + downedPlaguebringer = flags2[1]; + downedGuardians = flags2[2]; + downedProvidence = flags2[3]; + downedSentinel1 = flags2[4]; + downedSentinel2 = flags2[5]; + downedSentinel3 = flags2[6]; + downedYharon = flags2[7]; + + BitsByte flags3 = reader.ReadByte(); + downedSCal = flags3[0]; + downedBumble = flags3[1]; + downedCrabulon = flags3[2]; + downedBetsy = flags3[3]; + downedScavenger = flags3[4]; + downedWhar = flags3[5]; + downedSkullHead = flags3[6]; + downedUgly = flags3[7]; + + BitsByte flags4 = reader.ReadByte(); + downedSkeletor = flags4[0]; + downedPlantThing = flags4[1]; + downedGolemBaby = flags4[2]; + downedMoonDude = flags4[3]; + downedBossAny = flags4[4]; + demonMode = flags4[5]; + onionMode = flags4[6]; + revenge = flags4[7]; + + BitsByte flags5 = reader.ReadByte(); + downedStarGod = flags5[0]; + spawnAstralMeteor = flags5[1]; + spawnAstralMeteor2 = flags5[2]; + spawnAstralMeteor3 = flags5[3]; + spawnedHardBoss = flags5[4]; + downedPolterghast = flags5[5]; + death = flags5[6]; + downedLORDE = flags5[7]; + + BitsByte flags6 = reader.ReadByte(); + abyssSide = flags6[0]; + downedAquaticScourge = flags6[1]; + downedAstrageldon = flags6[2]; + buffedEclipse = flags6[3]; + armageddon = flags6[4]; + defiled = flags6[5]; + downedBuffedMothron = flags6[6]; + ironHeart = flags6[7]; + + BitsByte flags7 = reader.ReadByte(); + bossRushActive = flags7[0]; + } + else + { + ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); + } + } + #endregion + + #region NetSend + public override void NetSend(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = downedDesertScourge; + flags[1] = downedHiveMind; + flags[2] = downedPerforator; + flags[3] = downedSlimeGod; + flags[4] = downedCryogen; + flags[5] = downedBrimstoneElemental; + flags[6] = downedCalamitas; + flags[7] = downedLeviathan; + + BitsByte flags2 = new BitsByte(); + flags2[0] = downedDoG; + flags2[1] = downedPlaguebringer; + flags2[2] = downedGuardians; + flags2[3] = downedProvidence; + flags2[4] = downedSentinel1; + flags2[5] = downedSentinel2; + flags2[6] = downedSentinel3; + flags2[7] = downedYharon; + + BitsByte flags3 = new BitsByte(); + flags3[0] = downedSCal; + flags3[1] = downedBumble; + flags3[2] = downedCrabulon; + flags3[3] = downedBetsy; + flags3[4] = downedScavenger; + flags3[5] = downedWhar; + flags3[6] = downedSkullHead; + flags3[7] = downedUgly; + + BitsByte flags4 = new BitsByte(); + flags4[0] = downedSkeletor; + flags4[1] = downedPlantThing; + flags4[2] = downedGolemBaby; + flags4[3] = downedMoonDude; + flags4[4] = downedBossAny; + flags4[5] = demonMode; + flags4[6] = onionMode; + flags4[7] = revenge; + + BitsByte flags5 = new BitsByte(); + flags5[0] = downedStarGod; + flags5[1] = spawnAstralMeteor; + flags5[2] = spawnAstralMeteor2; + flags5[3] = spawnAstralMeteor3; + flags5[4] = spawnedHardBoss; + flags5[5] = downedPolterghast; + flags5[6] = death; + flags5[7] = downedLORDE; + + BitsByte flags6 = new BitsByte(); + flags6[0] = abyssSide; + flags6[1] = downedAquaticScourge; + flags6[2] = downedAstrageldon; + flags6[3] = buffedEclipse; + flags6[4] = armageddon; + flags6[5] = defiled; + flags6[6] = downedBuffedMothron; + flags6[7] = ironHeart; + + BitsByte flags7 = new BitsByte(); + flags7[0] = bossRushActive; + + writer.Write(flags); + writer.Write(flags2); + writer.Write(flags3); + writer.Write(flags4); + writer.Write(flags5); + writer.Write(flags6); + writer.Write(flags7); + } + #endregion + + #region NetReceive + public override void NetReceive(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + downedDesertScourge = flags[0]; + downedHiveMind = flags[1]; + downedPerforator = flags[2]; + downedSlimeGod = flags[3]; + downedCryogen = flags[4]; + downedBrimstoneElemental = flags[5]; + downedCalamitas = flags[6]; + downedLeviathan = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + downedDoG = flags2[0]; + downedPlaguebringer = flags2[1]; + downedGuardians = flags2[2]; + downedProvidence = flags2[3]; + downedSentinel1 = flags2[4]; + downedSentinel2 = flags2[5]; + downedSentinel3 = flags2[6]; + downedYharon = flags2[7]; + + BitsByte flags3 = reader.ReadByte(); + downedSCal = flags3[0]; + downedBumble = flags3[1]; + downedCrabulon = flags3[2]; + downedBetsy = flags3[3]; + downedScavenger = flags3[4]; + downedWhar = flags3[5]; + downedSkullHead = flags3[6]; + downedUgly = flags3[7]; + + BitsByte flags4 = reader.ReadByte(); + downedSkeletor = flags4[0]; + downedPlantThing = flags4[1]; + downedGolemBaby = flags4[2]; + downedMoonDude = flags4[3]; + downedBossAny = flags4[4]; + demonMode = flags4[5]; + onionMode = flags4[6]; + revenge = flags4[7]; + + BitsByte flags5 = reader.ReadByte(); + downedStarGod = flags5[0]; + spawnAstralMeteor = flags5[1]; + spawnAstralMeteor2 = flags5[2]; + spawnAstralMeteor3 = flags5[3]; + spawnedHardBoss = flags5[4]; + downedPolterghast = flags5[5]; + death = flags5[6]; + downedLORDE = flags5[7]; + + BitsByte flags6 = reader.ReadByte(); + abyssSide = flags6[0]; + downedAquaticScourge = flags6[1]; + downedAstrageldon = flags6[2]; + buffedEclipse = flags6[3]; + armageddon = flags6[4]; + defiled = flags6[5]; + downedBuffedMothron = flags6[6]; + ironHeart = flags6[7]; + + BitsByte flags7 = reader.ReadByte(); + bossRushActive = flags7[0]; + } + #endregion + + #region Tiles + public override void ResetNearbyTileEffects() + { + calamityTiles = 0; + astralTiles = 0; + seaTiles = 0; + sulphurTiles = 0; + abyssTiles = 0; + } + + public override void TileCountsAvailable(int[] tileCounts) + { + calamityTiles = tileCounts[mod.TileType("CharredOre")] + tileCounts[mod.TileType("BrimstoneSlag")]; + seaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("SeaPrism")]; + abyssTiles = tileCounts[mod.TileType("AbyssGravel")]; + sulphurTiles = tileCounts[mod.TileType("SulphurousSand")]; + + #region Astral Stuff int astralDesertTiles = tileCounts[mod.TileType("AstralSand")] + tileCounts[mod.TileType("AstralSandstone")] + tileCounts[mod.TileType("HardenedAstralSand")]; int astralSnowTiles = tileCounts[mod.TileType("AstralIce")]; Main.sandTiles += astralDesertTiles; Main.snowTiles += astralSnowTiles; - astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[mod.TileType("AstralDirt")] + tileCounts[mod.TileType("AstralStone")] + tileCounts[mod.TileType("AstralGrass")]+ tileCounts[mod.TileType("AstralOre")]; - #endregion - } - #endregion - - #region PreWorldGen - public override void PreWorldGen() - { - CalamityWorld.numAbyssIslands = 0; - CalamityWorld.genIcePyramid = true; - CalamityWorld.genHellHut = true; - CalamityWorld.genSandHut = true; - CalamityWorld.genEvilHut = true; - CalamityWorld.genPureHut = true; - CalamityWorld.genIceHut = true; - CalamityWorld.genMushroomHut = true; - CalamityWorld.genGraniteHut = true; - CalamityWorld.genMarbleHut = true; - } - #endregion - - #region ModifyWorldGenTasks - public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) - { - int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); - if (ShiniesIndex != -1) - { - tasks.Insert(ShiniesIndex + 1, new PassLegacy("CalamityOres", delegate (GenerationProgress progress) - { - progress.Message = "Ice Tomb"; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - #region IceTomb - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) - { - int tilesX = WorldGen.genRand.Next(0, generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, x); - int tilesY2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .5f)); - if ((Main.tile[tilesX, tilesY2].type == 147 || Main.tile[tilesX, tilesY2].type == 161) && CalamityWorld.genIcePyramid) - { - CalamityWorld.genIcePyramid = false; - IcePyramid(tilesX, tilesY2); - } - if ((Main.tile[tilesX2, tilesY2].type == 147 || Main.tile[tilesX2, tilesY2].type == 161) && CalamityWorld.genIcePyramid) - { - CalamityWorld.genIcePyramid = false; - IcePyramid(tilesX2, tilesY2); - } - } - #endregion - #region EvilIslandGen - int xIslandGen = WorldGen.crimson ? - WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.4)) : - WorldGen.genRand.Next((int)((double)x * 0.6), (int)((double)x * 0.9)); - int yIslandGen = WorldGen.genRand.Next(90, 151); - yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); - int tileXLookup = xIslandGen; - if (WorldGen.crimson) - { - while (Main.tile[tileXLookup, yIslandGen].active()) - { - tileXLookup++; - } - } - else - { - while (Main.tile[tileXLookup, yIslandGen].active()) - { - tileXLookup--; - } - } - xIslandGen = tileXLookup; - CalamityWorld.fehX = xIslandGen; - CalamityWorld.fehY = yIslandGen; - EvilIsland(xIslandGen, yIslandGen); - EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); - #endregion - })); - } - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) - { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) - { - progress.Message = "Sulphur Beach"; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - if (WorldGen.dungeonX < genLimit) { abyssSide = true; } - int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - if (abyssSide) - { - for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + 240; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand > abyssChasmX + 225) - { - if (tile.active() && - tile.type == 53 && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - else if (abyssIndexSand > abyssChasmX + 210) - { - if (tile.active() && - tile.type == 53 && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tile.type == 53) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - } - } - } - else - { - for (int abyssIndexSand = abyssChasmX - 240; abyssIndexSand < x; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand < abyssChasmX - 225) - { - if (tile.active() && - tile.type == 53 && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - else if (abyssIndexSand < abyssChasmX - 210) - { - if (tile.active() && - tile.type == 53 && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tile.type == 53) - { - tile.type = (ushort)mod.TileType("SulphurousSand"); - } - else if (tile.active() && - tile.type == 323) - { - tile.active(false); - } - } - } - } - } - })); - } - int CragIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); - if (CragIndex != -1) - { - tasks.Insert(CragIndex + 1, new PassLegacy("HellCrag", delegate(GenerationProgress progress) - { - progress.Message = "Brimstone Crag, Abyss, and Structures"; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - int rockLayer = (int)Main.rockLayer; - #region AbyssGen - int abyssChasmSteps = y / 4; - int abyssChasmY = (y - abyssChasmSteps) + 100; // (y / 12) - int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - bool tenebrisSide = true; - if (abyssChasmX < genLimit) { tenebrisSide = false; } - if (abyssSide) - { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - if (abyssIndex > abyssChasmX + 75) - { - if (WorldGen.genRand.Next(4) == 0) - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else if (abyssIndex > abyssChasmX + 70) - { - if (WorldGen.genRand.Next(2) == 0) - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.type = (ushort)mod.TileType("AbyssGravel"); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - } - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - } - } - } - else - { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - if (abyssIndex < abyssChasmX - 75) - { - if (WorldGen.genRand.Next(4) == 0) - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else if (abyssIndex < abyssChasmX - 70) - { - if (WorldGen.genRand.Next(2) == 0) - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - else - { - if (tile.active() && - tile.type != 227 && //dye plants - tile.type != 323 && //trees - tile.type != 53 && //sand - tile.type != 21 && //chests - tile.type != 81 && //coral - tile.type != 324 && //seashells and starfish - tile.type != (ushort)mod.TileType("SulphurousSand")) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.type = (ushort)mod.TileType("AbyssGravel"); - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - } - } - else if (!tile.active() && - abyssIndex2 > rockLayer) - { - tile.active(true); - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) - { - tile.type = (ushort)mod.TileType("Voidstone"); - tile.wall = (byte)mod.WallType("VoidstoneWallUnsafe"); - } - else - { - tile.wall = (byte)mod.WallType("AbyssGravelWall"); - tile.type = (ushort)mod.TileType("AbyssGravel"); - } - } - } - } - } - } - ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, abyssChasmSteps, true); - int maxAbyssIslands = 11; - if (y > 1500) { maxAbyssIslands = 15; if (y > 2100) { maxAbyssIslands = 19; } } - int islandLocationOffset = 30; - int islandLocationY = rockLayer; - for (int islands = 0; islands < maxAbyssIslands; islands++) - { - int islandLocationX = abyssChasmX; - int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 - bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); - CalamityWorld.AbyssIslandY[CalamityWorld.numAbyssIslands] = islandLocationY; - switch (randomIsland) - { - case 0: - AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - break; - case 1: - AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX += 30; - break; - case 2: - AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX -= 30; - break; - case 3: - AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX += 25; - break; - case 4: - AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX -= 25; - break; - } - CalamityWorld.AbyssIslandX[CalamityWorld.numAbyssIslands] = islandLocationX; - CalamityWorld.numAbyssIslands++; - islandLocationY += islandLocationOffset; - } - CalamityWorld.AbyssItemArray = ShuffleArray(CalamityWorld.AbyssItemArray); - for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 - { - AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], - CalamityWorld.AbyssIslandY[abyssHouse], - CalamityWorld.AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 - CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); - } - if (abyssSide) - { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - if (!Main.tile[abyssIndex, abyssIndex2].active()) - { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) - { - if (WorldGen.genRand.Next(5) == 0) - { - int style = WorldGen.genRand.Next(13, 16); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) - { - if (WorldGen.genRand.Next(3) == 0) - { - int style = WorldGen.genRand.Next(25, 28); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - } - } - } - } - else - { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - if (!Main.tile[abyssIndex, abyssIndex2].active()) - { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) - { - if (WorldGen.genRand.Next(5) == 0) - { - int style = WorldGen.genRand.Next(13, 16); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) - { - if (WorldGen.genRand.Next(3) == 0) - { - int style = WorldGen.genRand.Next(25, 28); - WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - } - } - } - } - #endregion - #region Shrines - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) - { - int tilesX = WorldGen.genRand.Next(0, generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, x); - int tilesX3 = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); - int tilesX4 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.6)); - int tilesX5 = WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)); - int tilesY3 = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); - int tilesY4 = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - int tilesY5 = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); - int tilesY6 = y - 50; - if ((Main.tile[tilesX3, tilesY3].type == 0 || Main.tile[tilesX3, tilesY3].type == 1) && CalamityWorld.genPureHut) - { - CalamityWorld.genPureHut = false; - SpecialHut((ushort)39, (ushort)0, (byte)6, 0, tilesX3, tilesY3); //red brick, dirt, red brick wall - } - if ((Main.tile[tilesX4, tilesY3].type == 0 || Main.tile[tilesX4, tilesY3].type == 1) && CalamityWorld.genPureHut) - { - CalamityWorld.genPureHut = false; - SpecialHut((ushort)39, (ushort)0, (byte)6, 0, tilesX4, tilesY3); - } - if (Main.tile[tilesX, tilesY3].type == (ushort)(WorldGen.crimson ? 203 : 25) && CalamityWorld.genEvilHut) - { - CalamityWorld.genEvilHut = false; - SpecialHut((ushort)(WorldGen.crimson ? 347 : 140), (ushort)(WorldGen.crimson ? 203 : 25), (byte)(WorldGen.crimson ? 174 : 33), 1, tilesX, tilesY3); //crimstone brick, crimstone, crimstone brick wall - } - if (Main.tile[tilesX2, tilesY3].type == (ushort)(WorldGen.crimson ? 203 : 25) && CalamityWorld.genEvilHut) - { - CalamityWorld.genEvilHut = false; - SpecialHut((ushort)(WorldGen.crimson ? 347 : 140), (ushort)(WorldGen.crimson ? 203 : 25), (byte)(WorldGen.crimson ? 174 : 33), 1, tilesX2, tilesY3); - } - if (Main.tile[tilesX3, tilesY5].type == 1 && CalamityWorld.genHellHut) - { - CalamityWorld.genHellHut = false; - SpecialHut((ushort)75, (ushort)56, (byte)20, 2, tilesX3, tilesY5); //obsidian brick, obsidian, obsidian brick wall - } - if (Main.tile[tilesX4, tilesY5].type == 1 && CalamityWorld.genHellHut) - { - CalamityWorld.genHellHut = false; - SpecialHut((ushort)75, (ushort)56, (byte)20, 2, tilesX4, tilesY5); - } - if (Main.tile[tilesX, tilesY4].type == 161 && CalamityWorld.genIceHut) - { - CalamityWorld.genIceHut = false; - SpecialHut((ushort)206, (ushort)161, (byte)84, 3, tilesX, tilesY4); //ice brick, ice, ice brick wall - } - if (Main.tile[tilesX2, tilesY4].type == 161 && CalamityWorld.genIceHut) - { - CalamityWorld.genIceHut = false; - SpecialHut((ushort)206, (ushort)161, (byte)84, 3, tilesX2, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == 404 && CalamityWorld.genSandHut) - { - CalamityWorld.genSandHut = false; - SpecialHut((ushort)404, (ushort)396, (byte)223, 4, tilesX, tilesY4); //fossil, sand, fossil wall - } - if (Main.tile[tilesX2, tilesY4].type == 404 && CalamityWorld.genSandHut) - { - CalamityWorld.genSandHut = false; - SpecialHut((ushort)404, (ushort)396, (byte)223, 4, tilesX2, tilesY4); - } - if (Main.tile[tilesX3, tilesY4].type == 59 && CalamityWorld.genMushroomHut) - { - CalamityWorld.genMushroomHut = false; - SpecialHut((ushort)190, (ushort)59, (byte)74, 5, tilesX3, tilesY4); //mushroom block, mud, mushroom wall - } - if (Main.tile[tilesX4, tilesY4].type == 59 && CalamityWorld.genMushroomHut) - { - CalamityWorld.genMushroomHut = false; - SpecialHut((ushort)190, (ushort)59, (byte)74, 5, tilesX4, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == 368 && CalamityWorld.genGraniteHut) - { - CalamityWorld.genGraniteHut = false; - SpecialHut((ushort)369, (ushort)368, (byte)181, 6, tilesX, tilesY4); //granite brick, granite, granite brick wall - } - if (Main.tile[tilesX2, tilesY4].type == 368 && CalamityWorld.genGraniteHut) - { - CalamityWorld.genGraniteHut = false; - SpecialHut((ushort)369, (ushort)368, (byte)181, 6, tilesX2, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == 367 && CalamityWorld.genMarbleHut) - { - CalamityWorld.genMarbleHut = false; - SpecialHut((ushort)357, (ushort)367, (byte)179, 7, tilesX, tilesY4); //marble brick, marble, marble brick wall - } - if (Main.tile[tilesX2, tilesY4].type == 367 && CalamityWorld.genMarbleHut) - { - CalamityWorld.genMarbleHut = false; - SpecialHut((ushort)357, (ushort)367, (byte)179, 7, tilesX2, tilesY4); - } - if (CalamityWorld.genSwordHut) - { - CalamityWorld.genSwordHut = false; - SpecialHut((ushort)76, (ushort)58, (byte)177, 8, tilesX5, tilesY6); - } - } - #endregion - #region Crag - int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); - int yUnderworldGen = y - 100; - CalamityWorld.fuhX = xUnderworldGen; - CalamityWorld.fuhY = yUnderworldGen; - UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - ChasmGenerator(CalamityWorld.fuhX - 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); - ChasmGenerator(CalamityWorld.fuhX + 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); - UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - UnderworldIslandHouse(CalamityWorld.fuhX, CalamityWorld.fuhY + 30, 1323); - UnderworldIslandHouse(CalamityWorld.fuhX - 22, CalamityWorld.fuhY + 15, 1322); - UnderworldIslandHouse(CalamityWorld.fuhX + 22, CalamityWorld.fuhY + 15, 535); - UnderworldIslandHouse(CalamityWorld.fuhX - 50, CalamityWorld.fuhY - 30, 112); - UnderworldIslandHouse(CalamityWorld.fuhX + 50, CalamityWorld.fuhY - 30, 906); - UnderworldIslandHouse(CalamityWorld.fuhX - 150, CalamityWorld.fuhY - 30, 218); - UnderworldIslandHouse(CalamityWorld.fuhX + 150, CalamityWorld.fuhY - 30, 3019); - UnderworldIslandHouse(CalamityWorld.fuhX - 180, CalamityWorld.fuhY - 20, 274); - UnderworldIslandHouse(CalamityWorld.fuhX + 180, CalamityWorld.fuhY - 20, 220); - #endregion - })); - } - //RE-ENABLE IF YOU WANT QUICK TESTING FOR WORLD GEN C: - //RemoveMostTasks(tasks); - - tasks.Add(new PassLegacy("Expand World", ExpandWorld)); - //EVERYTHING THAT WILL SPAWN IN EXPANDED HEIGHT AREA MUST BE DONE AFTER THIS SO: - tasks.Add(new PassLegacy("Planetoid Test", Planetoids)); - - //FIX THE POTS BEING A PROBLEM USING A CUSTOM FIX - int pots = tasks.FindIndex(task => task.Name == "Pots"); - if (pots != -1) - { - tasks.RemoveAt(pots); - tasks.Insert(pots, new PassLegacy("Pots", PotFix)); - } - } - #endregion - - #region SafeTileFrame - public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) - { - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) continue; - if (x == i && y == j) WorldGen.TileFrame(i, j, resetFrame, false); - else WorldGen.TileFrame(x, y, false, false); - } - } - } - #endregion - - #region ShuffleArray - public static int[] ShuffleArray(int[] array) - { - Random random = new Random(); - for (int index = array.Length; index > 0; index--) - { - int j = random.Next(index); - int k = array[j]; - array[j] = array[index - 1]; - array[index - 1] = k; - } - return array; - } - #endregion - - #region Seasons - public static void checkSpring() - { - DateTime now = DateTime.Now; - int day = now.Day; - int month = now.Month; - if (month >= 3 && month <= 6) - { - if (month == 3 && day >= 20) - { - spring = true; - return; - } - if (month == 4) - { - spring = true; - return; - } - if (month == 5) - { - spring = true; - return; - } - if (month == 6 && day <= 20) - { - spring = true; - return; - } - } - spring = false; - } - - public static void checkSummer() - { - DateTime now = DateTime.Now; - int day = now.Day; - int month = now.Month; - if (month >= 6 && month <= 9) - { - if (month == 6 && day >= 21) - { - summer = true; - return; - } - if (month == 7) - { - summer = true; - return; - } - if (month == 8) - { - summer = true; - return; - } - if (month == 9 && day <= 21) - { - summer = true; - return; - } - } - summer = false; - } - - public static void checkFall() - { - DateTime now = DateTime.Now; - int day = now.Day; - int month = now.Month; - if (month >= 9 && month <= 12) - { - if (month == 9 && day >= 22) - { - fall = true; - return; - } - if (month == 10) - { - fall = true; - return; - } - if (month == 11) - { - fall = true; - return; - } - if (month == 12 && day <= 20) - { - fall = true; - return; - } - } - fall = false; - } - - public static void checkWinter() - { - DateTime now = DateTime.Now; - int day = now.Day; - int month = now.Month; - if (month == 12 || (month >= 1 && month <= 3)) - { - if (month == 12 && day >= 21) - { - winter = true; - return; - } - if (month == 1) - { - winter = true; - return; - } - if (month == 2) - { - winter = true; - return; - } - if (month == 3 && day <= 19) - { - winter = true; - return; - } - } - winter = false; - } - #endregion - - #region OreSpawn - public static void spawnOre(int type, double frequency, float depth, float depthLimit) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool genCenter = false; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - if (type == mod.TileType("ExodiumOre")) - { - genCenter = true; - depthLimit = 0.14f; - if (y > 1500) { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } - } - if (Main.netMode != 1) - { - for (int k = 0; k < (int)((double)(x * y) * frequency); k++) - { - int tilesX = WorldGen.genRand.Next(0, (genCenter ? genLimit : generateBack)); - int tilesX2 = WorldGen.genRand.Next((genCenter ? genLimit : generateForward), x); - int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); - if (type == mod.TileType("AuricOre")) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - } - else if (type == mod.TileType("UelibloomOre")) - { - if (Main.tile[tilesX, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("PerennialOre")) - { - if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 0 || Main.tile[tilesX2, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("CryonicOre")) - { - if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 147 || Main.tile[tilesX2, tilesY].type == 161 || Main.tile[tilesX2, tilesY].type == 163 || Main.tile[tilesX2, tilesY].type == 164 || Main.tile[tilesX2, tilesY].type == 200) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - } - } - #endregion - - #region AstralMeteor - public static bool checkAstralMeteor() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = 0; - float num2 = (float)(Main.maxTilesX / 4200); - int num3 = (int)(200f * num2); //Small = 201 Medium = 305 Large = 401 - for (int j = 5; j < Main.maxTilesX - 5; j++) - { - int num4 = 5; - while ((double)num4 < Main.worldSurface) - { - if (Main.tile[j, num4].active() && Main.tile[j, num4].type == mod.TileType("AstralOre")) - { - num++; - if (num > num3) - { - return false; - } - } - num4++; - } - } - return true; - } - - public static void dropAstralMeteor() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool flag = true; - if (Main.netMode == 1) - { - return; - } - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active) - { - flag = false; - break; - } - } - if (!checkAstralMeteor()) - { - return; - } - float num5 = 600f; - while (!flag) - { - float num6 = (float)Main.maxTilesX * 0.08f; - int num7 = Main.rand.Next(150, Main.maxTilesX - 150); - while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6) - { - num7 = Main.rand.Next(150, Main.maxTilesX - 150); - } - int k = (int)(Main.worldSurface * 0.3); - while (k < Main.maxTilesY) - { - if (Main.tile[num7, k].active() && Main.tileSolid[(int)Main.tile[num7, k].type]) - { - int num8 = 0; - int num9 = 15; - for (int l = num7 - num9; l < num7 + num9; l++) - { - for (int m = k - num9; m < k + num9; m++) - { - if (WorldGen.SolidTile(l, m)) - { - num8++; - if (Main.tile[l, m].type == 189 || Main.tile[l, m].type == 202) - { - num8 -= 100; - } - } - else if (Main.tile[l, m].liquid > 0) - { - num8--; - } - } - } - if ((float)num8 < num5) - { - num5 -= 0.5f; - break; - } - flag = CalamityWorld.astralMeteor(num7, k); - if (flag) - { - break; - } - break; - } - else - { - k++; - } - } - if (num5 < 100f) - { - return; - } - } - } - - public static bool astralMeteor(int i, int j) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (i < 50 || i > Main.maxTilesX - 50) - { - return false; - } - if (j < 50 || j > Main.maxTilesY - 50) - { - return false; - } - int num = 35; - Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); - for (int k = 0; k < 255; k++) - { - if (Main.player[k].active) - { - Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); - if (rectangle.Intersects(value)) - { - return false; - } - } - } - for (int l = 0; l < 200; l++) - { - if (Main.npc[l].active) - { - Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); - if (rectangle.Intersects(value2)) - { - return false; - } - } - } - for (int m = i - num; m < i + num; m++) - { - for (int n = j - num; n < j + num; n++) - { - if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) - { - return false; - } - } - } - num = WorldGen.genRand.Next(17, 23); - for (int num2 = i - num; num2 < i + num; num2++) - { - for (int num3 = j - num; num3 < j + num; num3++) - { - if (num3 > j + Main.rand.Next(-2, 3) - 5) - { - float num4 = (float)Math.Abs(i - num2); - float num5 = (float)Math.Abs(j - num3); - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - if ((double)num6 < (double)num * 0.9 + (double)Main.rand.Next(-4, 5)) - { - if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) - { - Main.tile[num2, num3].active(false); - } - Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); - } - } - } - } - num = WorldGen.genRand.Next(8, 14); - for (int num7 = i - num; num7 < i + num; num7++) - { - for (int num8 = j - num; num8 < j + num; num8++) - { - if (num8 > j + Main.rand.Next(-2, 3) - 4) - { - float num9 = (float)Math.Abs(i - num7); - float num10 = (float)Math.Abs(j - num8); - float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); - if ((double)num11 < (double)num * 0.8 + (double)Main.rand.Next(-3, 4)) - { - Main.tile[num7, num8].active(false); - } - } - } - } - num = WorldGen.genRand.Next(25, 35); - for (int num12 = i - num; num12 < i + num; num12++) - { - for (int num13 = j - num; num13 < j + num; num13++) - { - float num14 = (float)Math.Abs(i - num12); - float num15 = (float)Math.Abs(j - num13); - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if ((double)num16 < (double)num * 0.7) - { - if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) - { - WorldGen.KillTile(num12, num13, false, false, false); - } - Main.tile[num12, num13].liquid = 0; - } - if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) - { - if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - } - WorldGen.SquareTileFrame(num12, num13, true); - WorldGen.SquareWallFrame(num12, num13, true); - } - } - num = WorldGen.genRand.Next(23, 32); - for (int num17 = i - num; num17 < i + num; num17++) - { - for (int num18 = j - num; num18 < j + num; num18++) - { - if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && Main.rand.Next(10) == 0) - { - float num19 = (float)Math.Abs(i - num17); - float num20 = (float)Math.Abs(j - num18); - float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); - if ((double)num21 < (double)num * 0.8) - { - if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) - { - WorldGen.KillTile(num17, num18, false, false, false); - } - Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num17, num18, true); - } - } - } - } - num = WorldGen.genRand.Next(30, 38); - for (int num22 = i - num; num22 < i + num; num22++) - { - for (int num23 = j - num; num23 < j + num; num23++) - { - if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && Main.rand.Next(20) == 0) - { - float num24 = (float)Math.Abs(i - num22); - float num25 = (float)Math.Abs(j - num23); - float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); - if ((double)num26 < (double)num * 0.85) - { - if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) - { - WorldGen.KillTile(num22, num23, false, false, false); - } - Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num22, num23, true); - } - } - } - } - if (Main.netMode != 1) - { - NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); - - DoAstralConversion(new Point(i, j)); - } - return true; - } - - - + astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[mod.TileType("AstralDirt")] + tileCounts[mod.TileType("AstralStone")] + tileCounts[mod.TileType("AstralGrass")] + tileCounts[mod.TileType("AstralOre")]; + #endregion + } + #endregion + + #region PreWorldGen + public override void PreWorldGen() + { + CalamityWorld.numAbyssIslands = 0; + CalamityWorld.genIcePyramid = true; + CalamityWorld.genHellHut = true; + CalamityWorld.genSandHut = true; + CalamityWorld.genEvilHut = true; + CalamityWorld.genPureHut = true; + CalamityWorld.genIceHut = true; + CalamityWorld.genMushroomHut = true; + CalamityWorld.genGraniteHut = true; + CalamityWorld.genMarbleHut = true; + } + #endregion + + #region ModifyWorldGenTasks + public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) + { + int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); + if (ShiniesIndex != -1) + { + tasks.Insert(ShiniesIndex + 1, new PassLegacy("CalamityOres", delegate (GenerationProgress progress) + { + progress.Message = "Ice Tomb"; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int generateBack = genLimit - 80; //Small = 2020 + int generateForward = genLimit + 80; //Small = 2180 + #region IceTomb + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) + { + int tilesX = WorldGen.genRand.Next(0, generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, x); + int tilesY2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .5f)); + if ((Main.tile[tilesX, tilesY2].type == 147 || Main.tile[tilesX, tilesY2].type == 161) && CalamityWorld.genIcePyramid) + { + CalamityWorld.genIcePyramid = false; + IcePyramid(tilesX, tilesY2); + } + if ((Main.tile[tilesX2, tilesY2].type == 147 || Main.tile[tilesX2, tilesY2].type == 161) && CalamityWorld.genIcePyramid) + { + CalamityWorld.genIcePyramid = false; + IcePyramid(tilesX2, tilesY2); + } + } + #endregion + #region EvilIslandGen + int xIslandGen = WorldGen.crimson ? + WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.4)) : + WorldGen.genRand.Next((int)((double)x * 0.6), (int)((double)x * 0.9)); + int yIslandGen = WorldGen.genRand.Next(90, 151); + yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); + int tileXLookup = xIslandGen; + if (WorldGen.crimson) + { + while (Main.tile[tileXLookup, yIslandGen].active()) + { + tileXLookup++; + } + } + else + { + while (Main.tile[tileXLookup, yIslandGen].active()) + { + tileXLookup--; + } + } + xIslandGen = tileXLookup; + CalamityWorld.fehX = xIslandGen; + CalamityWorld.fehY = yIslandGen; + EvilIsland(xIslandGen, yIslandGen); + EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); + #endregion + })); + } + int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (SulphurIndex != -1) + { + tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) + { + progress.Message = "Sulphur Beach"; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + if (WorldGen.dungeonX < genLimit) { abyssSide = true; } + int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 + if (abyssSide) + { + for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + 240; abyssIndexSand++) + { + for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) + { + Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); + if (abyssIndexSand > abyssChasmX + 225) + { + if (tile.active() && + tile.type == 53 && + WorldGen.genRand.Next(4) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + else if (abyssIndexSand > abyssChasmX + 210) + { + if (tile.active() && + tile.type == 53 && + WorldGen.genRand.Next(2) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + else + { + if (tile.active() && + tile.type == 53) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + } + } + } + else + { + for (int abyssIndexSand = abyssChasmX - 240; abyssIndexSand < x; abyssIndexSand++) + { + for (int abyssIndexSand2 = 0; abyssIndexSand2 < y - 200; abyssIndexSand2++) + { + Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); + if (abyssIndexSand < abyssChasmX - 225) + { + if (tile.active() && + tile.type == 53 && + WorldGen.genRand.Next(4) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + else if (abyssIndexSand < abyssChasmX - 210) + { + if (tile.active() && + tile.type == 53 && + WorldGen.genRand.Next(2) == 0) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + else + { + if (tile.active() && + tile.type == 53) + { + tile.type = (ushort)mod.TileType("SulphurousSand"); + } + else if (tile.active() && + tile.type == 323) + { + tile.active(false); + } + } + } + } + } + })); + } + int CragIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); + if (CragIndex != -1) + { + tasks.Insert(CragIndex + 1, new PassLegacy("HellCrag", delegate(GenerationProgress progress) + { + progress.Message = "Brimstone Crag, Abyss, and Structures"; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int generateBack = genLimit - 80; //Small = 2020 + int generateForward = genLimit + 80; //Small = 2180 + int rockLayer = (int)Main.rockLayer; + #region AbyssGen + int abyssChasmSteps = y / 4; + int abyssChasmY = (y - abyssChasmSteps) + 100; // (y / 12) + int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 + bool tenebrisSide = true; + if (abyssChasmX < genLimit) { tenebrisSide = false; } + if (abyssSide) + { + for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + if (abyssIndex > abyssChasmX + 75) + { + if (WorldGen.genRand.Next(4) == 0) + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else if (abyssIndex > abyssChasmX + 70) + { + if (WorldGen.genRand.Next(2) == 0) + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.type = (ushort)mod.TileType("AbyssGravel"); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + } + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + if (abyssIndex < abyssChasmX - 75) + { + if (WorldGen.genRand.Next(4) == 0) + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else if (abyssIndex < abyssChasmX - 70) + { + if (WorldGen.genRand.Next(2) == 0) + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + else + { + if (tile.active() && + tile.type != 227 && //dye plants + tile.type != 323 && //trees + tile.type != 53 && //sand + tile.type != 21 && //chests + tile.type != 81 && //coral + tile.type != 324 && //seashells and starfish + tile.type != (ushort)mod.TileType("SulphurousSand")) + { + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.type = (ushort)mod.TileType("AbyssGravel"); + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + } + } + else if (!tile.active() && + abyssIndex2 > rockLayer) + { + tile.active(true); + if (abyssIndex2 > (rockLayer + y * 0.262)) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) + { + tile.type = (ushort)mod.TileType("Voidstone"); + tile.wall = (ushort)mod.WallType("VoidstoneWallUnsafe"); + } + else + { + tile.wall = (ushort)mod.WallType("AbyssGravelWall"); + tile.type = (ushort)mod.TileType("AbyssGravel"); + } + } + } + } + } + } + ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, abyssChasmSteps, true); + int maxAbyssIslands = 11; + if (y > 1500) { maxAbyssIslands = 16; if (y > 2100) { maxAbyssIslands = 20; } } + int islandLocationOffset = 30; + int islandLocationY = rockLayer; + if (CalamityWorld.genAbyssHut) + { + int shrineDepthBoost = 60; + if (y > 1500) { shrineDepthBoost = 120; if (y > 2100) { shrineDepthBoost = 240; } } + CalamityWorld.genAbyssHut = false; + SpecialHut((ushort)mod.TileType("SmoothVoidstone"), (ushort)mod.TileType("Voidstone"), + (ushort)mod.WallType("VoidstoneWallUnsafe"), 9, abyssChasmX, (islandLocationY + (30 * maxAbyssIslands) + shrineDepthBoost)); + } + for (int islands = 0; islands < maxAbyssIslands; islands++) + { + int islandLocationX = abyssChasmX; + int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 + bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); + CalamityWorld.AbyssIslandY[CalamityWorld.numAbyssIslands] = islandLocationY; + switch (randomIsland) + { + case 0: + AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + break; + case 1: + AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX += 30; + break; + case 2: + AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX -= 30; + break; + case 3: + AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX += 25; + break; + case 4: + AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + islandLocationX -= 25; + break; + } + CalamityWorld.AbyssIslandX[CalamityWorld.numAbyssIslands] = islandLocationX; + CalamityWorld.numAbyssIslands++; + islandLocationY += islandLocationOffset; + } + CalamityWorld.AbyssItemArray = ShuffleArray(CalamityWorld.AbyssItemArray); + for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 + { + if (abyssHouse != 20) + AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], + CalamityWorld.AbyssIslandY[abyssHouse], + CalamityWorld.AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 + CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); + } + if (abyssSide) + { + for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + if (!Main.tile[abyssIndex, abyssIndex2].active()) + { + if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 > rockLayer) + { + if (WorldGen.genRand.Next(5) == 0) + { + int style = WorldGen.genRand.Next(13, 16); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 < (int)Main.worldSurface) + { + if (WorldGen.genRand.Next(3) == 0) + { + int style = WorldGen.genRand.Next(25, 28); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + if (!Main.tile[abyssIndex, abyssIndex2].active()) + { + if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 > rockLayer) + { + if (WorldGen.genRand.Next(5) == 0) + { + int style = WorldGen.genRand.Next(13, 16); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && + abyssIndex2 < (int)Main.worldSurface) + { + if (WorldGen.genRand.Next(3) == 0) + { + int style = WorldGen.genRand.Next(25, 28); + WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); + SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + } + } + } + } + #endregion + #region Shrines + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) + { + int tilesX = WorldGen.genRand.Next(0, generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, x); + int tilesX3 = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); + int tilesX4 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.6)); + int tilesX5 = WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)); + int tilesY3 = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + int tilesY4 = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY5 = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); + int tilesY6 = y - 50; + if ((Main.tile[tilesX3, tilesY3].type == 0 || Main.tile[tilesX3, tilesY3].type == 1) && CalamityWorld.genPureHut) + { + CalamityWorld.genPureHut = false; + SpecialHut((ushort)39, (ushort)0, (byte)6, 0, tilesX3, tilesY3); //red brick, dirt, red brick wall + } + if ((Main.tile[tilesX4, tilesY3].type == 0 || Main.tile[tilesX4, tilesY3].type == 1) && CalamityWorld.genPureHut) + { + CalamityWorld.genPureHut = false; + SpecialHut((ushort)39, (ushort)0, (byte)6, 0, tilesX4, tilesY3); + } + if (Main.tile[tilesX, tilesY3].type == (ushort)(WorldGen.crimson ? 203 : 25) && CalamityWorld.genEvilHut) + { + CalamityWorld.genEvilHut = false; + SpecialHut((ushort)(WorldGen.crimson ? 347 : 140), (ushort)(WorldGen.crimson ? 203 : 25), (byte)(WorldGen.crimson ? 174 : 33), 1, tilesX, tilesY3); //crimstone brick, crimstone, crimstone brick wall + } + if (Main.tile[tilesX2, tilesY3].type == (ushort)(WorldGen.crimson ? 203 : 25) && CalamityWorld.genEvilHut) + { + CalamityWorld.genEvilHut = false; + SpecialHut((ushort)(WorldGen.crimson ? 347 : 140), (ushort)(WorldGen.crimson ? 203 : 25), (byte)(WorldGen.crimson ? 174 : 33), 1, tilesX2, tilesY3); + } + if (Main.tile[tilesX3, tilesY5].type == 1 && CalamityWorld.genHellHut) + { + CalamityWorld.genHellHut = false; + SpecialHut((ushort)75, (ushort)56, (byte)20, 2, tilesX3, tilesY5); //obsidian brick, obsidian, obsidian brick wall + } + if (Main.tile[tilesX4, tilesY5].type == 1 && CalamityWorld.genHellHut) + { + CalamityWorld.genHellHut = false; + SpecialHut((ushort)75, (ushort)56, (byte)20, 2, tilesX4, tilesY5); + } + if (Main.tile[tilesX, tilesY4].type == 161 && CalamityWorld.genIceHut) + { + CalamityWorld.genIceHut = false; + SpecialHut((ushort)206, (ushort)161, (byte)84, 3, tilesX, tilesY4); //ice brick, ice, ice brick wall + } + if (Main.tile[tilesX2, tilesY4].type == 161 && CalamityWorld.genIceHut) + { + CalamityWorld.genIceHut = false; + SpecialHut((ushort)206, (ushort)161, (byte)84, 3, tilesX2, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == 404 && CalamityWorld.genSandHut) + { + CalamityWorld.genSandHut = false; + SpecialHut((ushort)404, (ushort)396, (byte)223, 4, tilesX, tilesY4); //fossil, sand, fossil wall + } + if (Main.tile[tilesX2, tilesY4].type == 404 && CalamityWorld.genSandHut) + { + CalamityWorld.genSandHut = false; + SpecialHut((ushort)404, (ushort)396, (byte)223, 4, tilesX2, tilesY4); + } + if (Main.tile[tilesX3, tilesY4].type == 59 && CalamityWorld.genMushroomHut) + { + CalamityWorld.genMushroomHut = false; + SpecialHut((ushort)190, (ushort)59, (byte)74, 5, tilesX3, tilesY4); //mushroom block, mud, mushroom wall + } + if (Main.tile[tilesX4, tilesY4].type == 59 && CalamityWorld.genMushroomHut) + { + CalamityWorld.genMushroomHut = false; + SpecialHut((ushort)190, (ushort)59, (byte)74, 5, tilesX4, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == 368 && CalamityWorld.genGraniteHut) + { + CalamityWorld.genGraniteHut = false; + SpecialHut((ushort)369, (ushort)368, (byte)181, 6, tilesX, tilesY4); //granite brick, granite, granite brick wall + } + if (Main.tile[tilesX2, tilesY4].type == 368 && CalamityWorld.genGraniteHut) + { + CalamityWorld.genGraniteHut = false; + SpecialHut((ushort)369, (ushort)368, (byte)181, 6, tilesX2, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == 367 && CalamityWorld.genMarbleHut) + { + CalamityWorld.genMarbleHut = false; + SpecialHut((ushort)357, (ushort)367, (byte)179, 7, tilesX, tilesY4); //marble brick, marble, marble brick wall + } + if (Main.tile[tilesX2, tilesY4].type == 367 && CalamityWorld.genMarbleHut) + { + CalamityWorld.genMarbleHut = false; + SpecialHut((ushort)357, (ushort)367, (byte)179, 7, tilesX2, tilesY4); + } + if (CalamityWorld.genSwordHut) + { + CalamityWorld.genSwordHut = false; + SpecialHut((ushort)76, (ushort)58, (byte)177, 8, tilesX5, tilesY6); + } + } + #endregion + #region Crag + int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); + int yUnderworldGen = y - 100; + CalamityWorld.fuhX = xUnderworldGen; + CalamityWorld.fuhY = yUnderworldGen; + UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); + UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); + UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); + ChasmGenerator(CalamityWorld.fuhX - 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); + ChasmGenerator(CalamityWorld.fuhX + 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); + UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); + UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); + UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); + UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); + UnderworldIslandHouse(CalamityWorld.fuhX, CalamityWorld.fuhY + 30, 1323); + UnderworldIslandHouse(CalamityWorld.fuhX - 22, CalamityWorld.fuhY + 15, 1322); + UnderworldIslandHouse(CalamityWorld.fuhX + 22, CalamityWorld.fuhY + 15, 535); + UnderworldIslandHouse(CalamityWorld.fuhX - 50, CalamityWorld.fuhY - 30, 112); + UnderworldIslandHouse(CalamityWorld.fuhX + 50, CalamityWorld.fuhY - 30, 906); + UnderworldIslandHouse(CalamityWorld.fuhX - 150, CalamityWorld.fuhY - 30, 218); + UnderworldIslandHouse(CalamityWorld.fuhX + 150, CalamityWorld.fuhY - 30, 3019); + UnderworldIslandHouse(CalamityWorld.fuhX - 180, CalamityWorld.fuhY - 20, 274); + UnderworldIslandHouse(CalamityWorld.fuhX + 180, CalamityWorld.fuhY - 20, 220); + #endregion + })); + } + //RE-ENABLE IF YOU WANT QUICK TESTING FOR WORLD GEN C: + //RemoveMostTasks(tasks); + + tasks.Add(new PassLegacy("Expand World", ExpandWorld)); + //EVERYTHING THAT WILL SPAWN IN EXPANDED HEIGHT AREA MUST BE DONE AFTER THIS SO: + tasks.Add(new PassLegacy("Planetoid Test", Planetoids)); + + //FIX THE POTS BEING A PROBLEM USING A CUSTOM FIX + int pots = tasks.FindIndex(task => task.Name == "Pots"); + if (pots != -1) + { + tasks.RemoveAt(pots); + tasks.Insert(pots, new PassLegacy("Pots", PotFix)); + } + } + #endregion + + #region SafeTileFrame + public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) + { + for (int x = i - 1; x <= i + 1; x++) + { + for (int y = j - 1; y <= j + 1; y++) + { + if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) continue; + if (x == i && y == j) WorldGen.TileFrame(i, j, resetFrame, false); + else WorldGen.TileFrame(x, y, false, false); + } + } + } + #endregion + + #region ShuffleArray + public static int[] ShuffleArray(int[] array) + { + Random random = new Random(); + for (int index = array.Length; index > 0; index--) + { + int j = random.Next(index); + int k = array[j]; + array[j] = array[index - 1]; + array[index - 1] = k; + } + return array; + } + #endregion + + #region Seasons + public static void checkSpring() + { + DateTime now = DateTime.Now; + int day = now.Day; + int month = now.Month; + if (month >= 3 && month <= 6) + { + if (month == 3 && day >= 20) + { + spring = true; + return; + } + if (month == 4) + { + spring = true; + return; + } + if (month == 5) + { + spring = true; + return; + } + if (month == 6 && day <= 20) + { + spring = true; + return; + } + } + spring = false; + } + + public static void checkSummer() + { + DateTime now = DateTime.Now; + int day = now.Day; + int month = now.Month; + if (month >= 6 && month <= 9) + { + if (month == 6 && day >= 21) + { + summer = true; + return; + } + if (month == 7) + { + summer = true; + return; + } + if (month == 8) + { + summer = true; + return; + } + if (month == 9 && day <= 21) + { + summer = true; + return; + } + } + summer = false; + } + + public static void checkFall() + { + DateTime now = DateTime.Now; + int day = now.Day; + int month = now.Month; + if (month >= 9 && month <= 12) + { + if (month == 9 && day >= 22) + { + fall = true; + return; + } + if (month == 10) + { + fall = true; + return; + } + if (month == 11) + { + fall = true; + return; + } + if (month == 12 && day <= 20) + { + fall = true; + return; + } + } + fall = false; + } + + public static void checkWinter() + { + DateTime now = DateTime.Now; + int day = now.Day; + int month = now.Month; + if (month == 12 || (month >= 1 && month <= 3)) + { + if (month == 12 && day >= 21) + { + winter = true; + return; + } + if (month == 1) + { + winter = true; + return; + } + if (month == 2) + { + winter = true; + return; + } + if (month == 3 && day <= 19) + { + winter = true; + return; + } + } + winter = false; + } + #endregion + + #region OreSpawn + public static void spawnOre(int type, double frequency, float depth, float depthLimit) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + bool genCenter = false; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int generateBack = genLimit - 80; //Small = 2020 + int generateForward = genLimit + 80; //Small = 2180 + if (type == mod.TileType("ExodiumOre")) + { + genCenter = true; + depthLimit = 0.14f; + if (y > 1500) { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } + } + if (Main.netMode != 1) + { + for (int k = 0; k < (int)((double)(x * y) * frequency); k++) + { + int tilesX = WorldGen.genRand.Next(0, (genCenter ? genLimit : generateBack)); + int tilesX2 = WorldGen.genRand.Next((genCenter ? genLimit : generateForward), x); + int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); + if (type == mod.TileType("AuricOre")) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); + WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); + } + else if (type == mod.TileType("UelibloomOre")) + { + if (Main.tile[tilesX, tilesY].type == 59) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + if (Main.tile[tilesX2, tilesY].type == 59) + { + WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("PerennialOre")) + { + if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + if (Main.tile[tilesX2, tilesY].type == 0 || Main.tile[tilesX2, tilesY].type == 1) + { + WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("CryonicOre")) + { + if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + if (Main.tile[tilesX2, tilesY].type == 147 || Main.tile[tilesX2, tilesY].type == 161 || Main.tile[tilesX2, tilesY].type == 163 || Main.tile[tilesX2, tilesY].type == 164 || Main.tile[tilesX2, tilesY].type == 200) + { + WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + } + } + #endregion + + #region AstralMeteor + public static bool checkAstralMeteor() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = 0; + float num2 = (float)(Main.maxTilesX / 4200); + int num3 = (int)(200f * num2); //Small = 201 Medium = 305 Large = 401 + for (int j = 5; j < Main.maxTilesX - 5; j++) + { + int num4 = 5; + while ((double)num4 < Main.worldSurface) + { + if (Main.tile[j, num4].active() && Main.tile[j, num4].type == mod.TileType("AstralOre")) + { + num++; + if (num > num3) + { + return false; + } + } + num4++; + } + } + return true; + } + + public static bool checkAstralBiomeSpawn() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = 0; + float num2 = (float)(Main.maxTilesX / 4200); + int num3 = (int)(400f * num2); //Small = 401 Medium = 605 Large = 801 + for (int j = 5; j < Main.maxTilesX - 5; j++) + { + int num4 = 5; + while ((double)num4 < Main.worldSurface) + { + if (Main.tile[j, num4].active() && + (Main.tile[j, num4].type == mod.TileType("AstralSand") || Main.tile[j, num4].type == mod.TileType("AstralSandstone") || + Main.tile[j, num4].type == mod.TileType("HardenedAstralSand") || Main.tile[j, num4].type == mod.TileType("AstralIce") || + Main.tile[j, num4].type == mod.TileType("AstralDirt") || Main.tile[j, num4].type == mod.TileType("AstralStone") || + Main.tile[j, num4].type == mod.TileType("AstralGrass"))) + { + num++; + if (num > num3) + { + return false; + } + } + num4++; + } + } + return true; + } + + public static void dropAstralMeteor() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + bool flag = true; + if (Main.netMode == 1) + { + return; + } + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active) + { + flag = false; + break; + } + } + if (!checkAstralMeteor()) + { + return; + } + float num5 = 600f; + while (!flag) + { + float num6 = (float)Main.maxTilesX * 0.08f; + int num7 = Main.rand.Next(150, Main.maxTilesX - 150); + while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6) + { + num7 = Main.rand.Next(150, Main.maxTilesX - 150); + } + //world surface = 920 large 740 medium 560 small + int k = (int)(Main.worldSurface * 0.5); //Large = 460, Medium = 370, Small = 280 + while (k < Main.maxTilesY) + { + if (Main.tile[num7, k].active() && Main.tileSolid[(int)Main.tile[num7, k].type]) + { + int num8 = 0; + int num9 = 15; + for (int l = num7 - num9; l < num7 + num9; l++) + { + for (int m = k - num9; m < k + num9; m++) + { + if (WorldGen.SolidTile(l, m)) + { + num8++; + if (Main.tile[l, m].type == 189 || Main.tile[l, m].type == 202) + { + num8 -= 100; + } + } + else if (Main.tile[l, m].liquid > 0) + { + num8--; + } + } + } + if ((float)num8 < num5) + { + num5 -= 0.5f; + break; + } + flag = CalamityWorld.astralMeteor(num7, k); + if (flag) + { + break; + } + break; + } + else + { + k++; + } + } + if (num5 < 100f) + { + return; + } + } + } + + public static bool astralMeteor(int i, int j) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (i < 50 || i > Main.maxTilesX - 50) + { + return false; + } + if (j < 50 || j > Main.maxTilesY - 50) + { + return false; + } + int num = 35; + Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); + for (int k = 0; k < 255; k++) + { + if (Main.player[k].active) + { + Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); + if (rectangle.Intersects(value)) + { + return false; + } + } + } + for (int l = 0; l < 200; l++) + { + if (Main.npc[l].active) + { + Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); + if (rectangle.Intersects(value2)) + { + return false; + } + } + } + for (int m = i - num; m < i + num; m++) + { + for (int n = j - num; n < j + num; n++) + { + if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) + { + return false; + } + } + } + num = WorldGen.genRand.Next(17, 23); + for (int num2 = i - num; num2 < i + num; num2++) + { + for (int num3 = j - num; num3 < j + num; num3++) + { + if (num3 > j + Main.rand.Next(-2, 3) - 5) + { + float num4 = (float)Math.Abs(i - num2); + float num5 = (float)Math.Abs(j - num3); + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + if ((double)num6 < (double)num * 0.9 + (double)Main.rand.Next(-4, 5)) + { + if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) + { + Main.tile[num2, num3].active(false); + } + Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); + } + } + } + } + num = WorldGen.genRand.Next(8, 14); + for (int num7 = i - num; num7 < i + num; num7++) + { + for (int num8 = j - num; num8 < j + num; num8++) + { + if (num8 > j + Main.rand.Next(-2, 3) - 4) + { + float num9 = (float)Math.Abs(i - num7); + float num10 = (float)Math.Abs(j - num8); + float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); + if ((double)num11 < (double)num * 0.8 + (double)Main.rand.Next(-3, 4)) + { + Main.tile[num7, num8].active(false); + } + } + } + } + num = WorldGen.genRand.Next(25, 35); + for (int num12 = i - num; num12 < i + num; num12++) + { + for (int num13 = j - num; num13 < j + num; num13++) + { + float num14 = (float)Math.Abs(i - num12); + float num15 = (float)Math.Abs(j - num13); + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if ((double)num16 < (double)num * 0.7) + { + if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) + { + WorldGen.KillTile(num12, num13, false, false, false); + } + Main.tile[num12, num13].liquid = 0; + } + if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) + { + if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + } + WorldGen.SquareTileFrame(num12, num13, true); + WorldGen.SquareWallFrame(num12, num13, true); + } + } + num = WorldGen.genRand.Next(23, 32); + for (int num17 = i - num; num17 < i + num; num17++) + { + for (int num18 = j - num; num18 < j + num; num18++) + { + if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && Main.rand.Next(10) == 0) + { + float num19 = (float)Math.Abs(i - num17); + float num20 = (float)Math.Abs(j - num18); + float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); + if ((double)num21 < (double)num * 0.8) + { + if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) + { + WorldGen.KillTile(num17, num18, false, false, false); + } + Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num17, num18, true); + } + } + } + } + num = WorldGen.genRand.Next(30, 38); + for (int num22 = i - num; num22 < i + num; num22++) + { + for (int num23 = j - num; num23 < j + num; num23++) + { + if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && Main.rand.Next(20) == 0) + { + float num24 = (float)Math.Abs(i - num22); + float num25 = (float)Math.Abs(j - num23); + float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); + if ((double)num26 < (double)num * 0.85) + { + if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) + { + WorldGen.KillTile(num22, num23, false, false, false); + } + Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num22, num23, true); + } + } + } + } + if (Main.netMode != 1) + { + NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); + if (checkAstralBiomeSpawn()) + DoAstralConversion(new Point(i, j)); + } + return true; + } + public static void DoAstralConversion(object obj) { //Pre-calculate all variables necessary for elliptical area checking @@ -1835,8 +1874,8 @@ namespace CalamityMod Vector2 fociOffset = Vector2.UnitY * fociSpacing; Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - + Vector2 bottomFoci = center + fociOffset; + for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) { for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) @@ -1945,7 +1984,7 @@ namespace CalamityMod else { Tile tile = Main.tile[x, y]; - switch(type) + switch (type) { case TileID.Dirt: Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt"); @@ -2388,2308 +2427,2361 @@ namespace CalamityMod float distance2 = Vector2.Distance(point, focus2); distance = distance1 + distance2; return distance <= distanceConstant; - } - - #endregion - - #region EvilIsland - public static void EvilIsland(int i, int j) - { - double num = (double)WorldGen.genRand.Next(100, 150); //100 150 - float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (WorldGen.crimson ? 398 : 399); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(80, 95); - num2 = (float)WorldGen.genRand.Next(10, 15); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = num5 - 1; - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; - float num19 = vector.Y + 1f; - for (int num20 = num7; num20 < num8; num20++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num19 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num19 < vector.Y) - { - num19 = vector.Y; - } - if (num19 > vector.Y + 2f) - { - num19 = vector.Y + 2f; - } - for (int num21 = num9; num21 < num10; num21++) - { - if ((float)num21 > num19) - { - float arg_69E_0 = Math.Abs((float)num20 - vector.X); - float num22 = Math.Abs((float)num21 - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && - Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore - WorldGen.SquareTileFrame(num20, num21, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (WorldGen.crimson ? 400 : 401); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - int num38 = WorldGen.genRand.Next(4); - for (int num39 = 0; num39 <= num38; num39++) - { - int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); - int num41 = num5 - WorldGen.genRand.Next(20, 40); - int num42 = WorldGen.genRand.Next(4, 8); - int num43 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(2) == 0) - { - num43 = (WorldGen.crimson ? 398 : 399); - } - for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) - { - for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) - { - float arg_C74_0 = (float)Math.Abs(num44 - num40); - float num46 = (float)(Math.Abs(num45 - num41) * 2); - if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) - { - Main.tile[num44, num45].active(true); - Main.tile[num44, num45].type = (ushort)num43; - WorldGen.SquareTileFrame(num44, num45, true); - } - } - } - for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) - { - int num48 = num41 - num42; - while (!Main.tile[num47, num48].active()) - { - num48++; - } - Main.tile[num47, num48].active(false); - Main.tile[num47, num48].liquid = 255; - WorldGen.SquareTileFrame(num47, num48, true); - } - } - } - #endregion - - #region EvilIslandHouse - public static void EvilIslandHouse(int i, int j) - { - ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile - byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - int contain = 0; - if (WorldGen.crimson) - { - contain = 1571; //scourge - } - else - { - contain = 1569; //vampire - } - WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest - int num14 = i - num2 / 2 + 1; - int num15 = i + num2 / 2 - 1; - int num16 = 1; - if (num2 > 10) - { - num16 = 2; - } - int num17 = (num6 + num7) / 2 - 1; - for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) - { - for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) - { - Main.tile[num18, num19].wall = 21; //glass - } - } - for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) - { - for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) - { - Main.tile[num20, num21].wall = 21; //glass - } - } - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - } - #endregion - - #region UnderworldIsland - public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = mod.TileType("BrimstoneSlag"); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = mod.TileType("CharredOre"); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = mod.TileType("BrimstoneSlag"); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region UnderworldIslandHouse - public static void UnderworldIslandHouse(int i, int j, int item) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile - byte wall = (byte)14; //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair - } - #endregion - - #region AbyssIsland - public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int sizeMinSmall = sizeMin / 5; - int sizeMaxSmall = sizeMax / 5; - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - SafeSquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - if (hasTenebris) - { - int p = num3; - int num150; - for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) - { - int num14 = num6; - while (!Main.tile[p, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); //-3 4 - num150 = 1; //4 8 - int num16 = mod.TileType("Tenebris"); - for (int n = p - num150; n <= p + num150; n++) - { - for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - p); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - } - int sizeMinSmall2 = sizeMin2 / 8; - int sizeMaxSmall2 = sizeMax2 / 8; - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - SafeSquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (byte)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - SafeSquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - SafeSquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region AbyssIslandHouse - public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile - byte wall = (byte)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(5, 9); - int num3 = 3; - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].type = type; - Main.tile[l, m].wall = wall; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) - { - Main.tile[n, num8].active(false); - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - switch (itemChoice) - { - case 0: itemChoice = mod.ItemType("TorrentialTear"); break; //rain item - case 1: itemChoice = mod.ItemType("IronBoots"); break; //movement acc - case 2: itemChoice = mod.ItemType("DepthCharm"); break; //regen acc - case 3: itemChoice = mod.ItemType("Archerfish"); break; //ranged - case 4: itemChoice = mod.ItemType("AnechoicPlating"); break; //defense acc - case 5: itemChoice = mod.ItemType("BallOFugu"); break; //melee - case 6: itemChoice = mod.ItemType("StrangeOrb"); break; //light pet - case 7: itemChoice = mod.ItemType("HerringStaff"); break; //summon - case 8: itemChoice = mod.ItemType("BlackAnurian"); break; //magic - case 9: itemChoice = mod.ItemType("Lionfish"); break; //throwing - default: itemChoice = 497; break; - } - WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest - } - #endregion - - #region IcePyramid - public static bool IcePyramid(int i, int j) - { - ushort num = 161; - int arg_36_0 = j - WorldGen.genRand.Next(0, 7); - int num2 = WorldGen.genRand.Next(9, 13); - int num3 = 1; - int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 - for (int k = arg_36_0; k < num4; k++) - { - for (int l = i - num3; l < i + num3 - 1; l++) - { - Main.tile[l, k].type = num; - Main.tile[l, k].active(true); - Main.tile[l, k].halfBrick(false); - Main.tile[l, k].slope(0); - } - num3++; - } - for (int m = i - num3 - 5; m <= i + num3 + 5; m++) - { - for (int n = j - 1; n <= num4 + 1; n++) - { - bool flag = true; - for (int num5 = m - 1; num5 <= m + 1; num5++) - { - for (int num6 = n - 1; num6 <= n + 1; num6++) - { - if (Main.tile[num5, num6].type != num) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[m, n].wall = 71; - WorldGen.SquareWallFrame(m, n, true); - } - } - } - int num7 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num7 = -1; - } - int num8 = i - num2 * num7; - int num9 = j + num2; - int num10 = WorldGen.genRand.Next(5, 8); - bool flag2 = true; - int num11 = WorldGen.genRand.Next(20, 30); - while (flag2) - { - flag2 = false; - bool flag3 = false; - for (int num12 = num9; num12 <= num9 + num10; num12++) - { - int num13 = num8; - if (Main.tile[num13, num12 - 1].type == 161) - { - flag3 = true; - } - if (Main.tile[num13, num12].type == num) - { - Main.tile[num13, num12 + 1].wall = 71; - Main.tile[num13 + num7, num12].wall = 71; - Main.tile[num13, num12].active(false); - flag2 = true; - } - if (flag3) - { - Main.tile[num13, num12].type = 161; - Main.tile[num13, num12].active(true); - Main.tile[num13, num12].halfBrick(false); - Main.tile[num13, num12].slope(0); - } - } - num8 -= num7; - } - num8 = i - num2 * num7; - bool flag4 = true; - bool flag5 = false; - flag2 = true; - while (flag2) - { - for (int num14 = num9; num14 <= num9 + num10; num14++) - { - int num15 = num8; - Main.tile[num15, num14].active(false); - } - num8 += num7; - num9++; - num11--; - if (num9 >= num4 - num10 * 2) - { - num11 = 10; - } - if (num11 <= 0) - { - bool flag6 = false; - if (!flag4 && !flag5) - { - flag5 = true; - flag6 = true; - int num16 = WorldGen.genRand.Next(7, 13); - int num17 = WorldGen.genRand.Next(23, 28); - int num18 = num17; - int num19 = num8; - while (num17 > 0) - { - for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) - { - if (num17 == num18 || num17 == 1) - { - if (num20 >= num9 - num16 + num10 + 2) - { - Main.tile[num8, num20].active(false); - } - } - else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) - { - if (num20 >= num9 - num16 + num10 + 1) - { - Main.tile[num8, num20].active(false); - } - } - else - { - Main.tile[num8, num20].active(false); - } - } - num17--; - num8 += num7; - } - int num21 = num8 - num7; - int num22 = num21; - int num23 = num19; - if (num21 > num19) - { - num22 = num19; - num23 = num21; - } - int num24 = WorldGen.genRand.Next(3); - if (num24 == 0) - { - num24 = 1861; //diving gear - } - else if (num24 == 1) - { - num24 = 1163; //balloon - } - else if (num24 == 2) - { - num24 = 1253; //shell - } - WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); - int num25 = WorldGen.genRand.Next(1, 10); - for (int num26 = 0; num26 < num25; num26++) - { - int arg_49B_0 = WorldGen.genRand.Next(num22, num23); - int j2 = num9 + num10; - WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); - } - for (int num27 = num22; num27 <= num23; num27++) - { - WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); - } - } - if (flag4) - { - flag4 = false; - num7 *= -1; - num11 = WorldGen.genRand.Next(15, 20); - } - else if (flag6) - { - num11 = WorldGen.genRand.Next(10, 15); - } - else - { - num7 *= -1; - num11 = WorldGen.genRand.Next(20, 40); - } - } - if (num9 >= num4 - num10) - { - flag2 = false; - } - } - int num28 = WorldGen.genRand.Next(20, 40); //100 200 - int num29 = WorldGen.genRand.Next(100, 160); //500 800 - flag2 = true; - int num30 = num10; - num11 = WorldGen.genRand.Next(10, 50); - if (num7 == 1) - { - num8 -= num30; - } - int num31 = WorldGen.genRand.Next(5, 10); - while (flag2) - { - num28--; - num29--; - num11--; - for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) - { - int num33 = num9; - if (num32 >= num8 && num32 <= num8 + num30) - { - Main.tile[num32, num33].active(false); - } - else - { - Main.tile[num32, num33].type = num; - Main.tile[num32, num33].active(true); - Main.tile[num32, num33].halfBrick(false); - Main.tile[num32, num33].slope(0); - } - if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) - { - Main.tile[num32, num33].wall = 71; - } - } - num9++; - num8 += num7; - if (num28 <= 0) - { - flag2 = false; - for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) - { - if (Main.tile[num34, num9].active()) - { - flag2 = true; - } - } - } - if (num11 < 0) - { - num11 = WorldGen.genRand.Next(10, 50); - num7 *= -1; - } - if (num29 <= 0) - { - flag2 = false; - } - } - return true; - } - #endregion - - #region SpecialHut - public static void SpecialHut(ushort tile, ushort tile2, byte wall, int hutType, int chestX, int chestY) - { - int m = WorldGen.genRand.Next(2, 4); - int num6 = WorldGen.genRand.Next(2, 4); - for (int n = chestX - m - 1; n <= chestX + m + 1; n++) - { - for (int num8 = chestY - num6 - 1; num8 <= chestY + num6 + 1; num8++) - { - Main.tile[n, num8].active(true); - Main.tile[n, num8].type = tile; //change - Main.tile[n, num8].liquid = 0; - Main.tile[n, num8].lava(false); - } - } - for (int num9 = chestX - m; num9 <= chestX + m; num9++) - { - for (int num10 = chestY - num6; num10 <= chestY + num6; num10++) - { - Main.tile[num9, num10].active(false); - Main.tile[num9, num10].wall = wall; //change - } - } - for (int num14 = chestX - m - 1; num14 <= chestX + m + 1; num14++) - { - for (int num15 = chestY + num6 - 2; num15 <= chestY + num6; num15++) - { - Main.tile[num14, num15].active(false); - } - } - for (int num16 = chestX - m - 1; num16 <= chestX + m + 1; num16++) - { - for (int num17 = chestY + num6 - 2; num17 <= chestY + num6 - 1; num17++) - { - Main.tile[num16, num17].active(false); - } - } - for (int num18 = chestX - m - 1; num18 <= chestX + m + 1; num18++) - { - int num19 = 4; - int num20 = chestY + num6 + 2; - while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) - { - Main.tile[num18, num20].active(true); - Main.tile[num18, num20].type = tile2; //change - num20++; - num19--; - } - } - m -= WorldGen.genRand.Next(1, 3); - int num21 = chestY - num6 - 2; - while (m > -1) - { - for (int num22 = chestX - m - 1; num22 <= chestX + m + 1; num22++) - { - Main.tile[num22, num21].active(true); - Main.tile[num22, num21].type = tile; //change - } - m -= WorldGen.genRand.Next(1, 3); - num21--; - } - CalamityWorld.SChestX[hutType] = chestX; - CalamityWorld.SChestY[hutType] = chestY; - SpecialChest(hutType); - } - #endregion - - #region SpecialChest - public static void SpecialChest(int itemChoice) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int item = 0; - int chestType = 0; - switch (itemChoice) //0 to 7 - { - case 0: item = 976; break; //climbing gear - case 1: item = (WorldGen.crimson ? 3016 : 3015); chestType = (WorldGen.crimson ? 43 : 3); break; //flesh knuckles or putrid scent - case 2: item = 908; chestType = 44; break; //lava waders - case 3: item = 1595; chestType = 47; break; //cuffs - case 4: item = 899; chestType = 30; break; //sun stone - case 5: item = 1864; chestType = 32; break; //scarab - case 6: item = 532; chestType = 50; break; //fuck you, star cloak - case 7: item = 554; chestType = 51; break; //fuck you, cross necklace - case 8: item = mod.ItemType("Murasama"); chestType = 44; break; - } - for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) - { - for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) - { - WorldGen.KillTile(j, k, false, false, false); - } - } - for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) - { - for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].slope(0); - Main.tile[l, m].halfBrick(false); - } - } - } - WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); - } - #endregion - - #region ChasmGenerator - public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - float num = (float)steps; //y / 4 - if (ocean) - { - int tileYLookup = j; - if (abyssSide) - { - while (!Main.tile[i + 125, tileYLookup].active()) - { - tileYLookup++; - } - } - else - { - while (!Main.tile[i - 125, tileYLookup].active()) - { - tileYLookup++; - } - } - j = tileYLookup; - } - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; - vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; - int num2 = 5; - double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width - while (num3 > 0.0) - { - if (num > 0f) - { - num3 += (double)WorldGen.genRand.Next(2); - num3 -= (double)WorldGen.genRand.Next(2); - if (ocean && num > (float)((double)(Main.maxTilesY / 4) * 0.75)) //dig small hole - { - if (num3 < 4.0) //min width - { - num3 = 4.0; //min width - } - if (num3 > 6.0) //max width - { - num3 = 6.0; //max width - } - } - else //dig large hole - { - if (num3 < (ocean ? 42.0 : 14.0)) //min width - { - num3 = (ocean ? 42.0 : 14.0); //min width - } - if (num3 > (ocean ? 60.0 : 40.0)) //max width - { - num3 = (ocean ? 60.0 : 40.0); //max width - } - if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) - { - num3 = (ocean ? 50.0 : 20.0); - } - } - } - else if ((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.312)) //.362 - { - num3 -= (double)(WorldGen.genRand.Next(5) + 8); //4 - } - if (((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.3) && num > 0f && ocean) || - ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - num -= 1f; - int num4; - int num5; - int num6; - int num7; - if (num > (float)num2) - { - num4 = (int)((double)vector.X - num3 * 0.5); - num5 = (int)((double)vector.X + num3 * 0.5); - num6 = (int)((double)vector.Y - num3 * 0.5); - num7 = (int)((double)vector.Y + num3 * 0.5); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int k = num4; k < num5; k++) - { - for (int l = num6; l < num7; l++) - { - if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(false); - } - else - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(true); - } - } - } - } - } - if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.312)) //1260 - { - num = 2f; - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; - if ((double)vector2.X > 0.02) - { - vector2.X = 0.02f; - } - if ((double)vector2.X < -0.02) - { - vector2.X = -0.02f; - } - num4 = (int)((double)vector.X - num3 * 1.1); - num5 = (int)((double)vector.X + num3 * 1.1); - num6 = (int)((double)vector.Y - num3 * 1.1); - num7 = (int)((double)vector.Y + num3 * 1.1); - if (num4 < 1) - { - num4 = 1; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int m = num4; m < num5; m++) - { - for (int n = num6; n < num7; n++) - { - if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (n > j + WorldGen.genRand.Next(7, 16)) - { - Main.tile[m, n].active(false); - } - if (steps <= num2) - { - Main.tile[m, n].active(false); - } - if (ocean) - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(false); - } - else - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(true); - } - } - } - } - for (int num11 = num4; num11 < num5; num11++) - { - for (int num12 = num6; num12 < num7; num12++) - { - if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(false); - } - else - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(true); - } - if (steps <= num2) - { - Main.tile[num11, num12].active(false); - } - } - } - } - } - } - #endregion - - #region PlanetoidMethods - //WORLD GENERATION PASSES - private static void ExpandWorld(GenerationProgress progress) - { - int newHeight = Main.maxTilesY + ExpandWorldBy; - - //--------------------- - //MISC. FIXES - //--------------------- - - //TILES - FieldInfo worldSizeY = typeof(WorldFileData).GetField("WorldSizeY", BindingFlags.Instance | BindingFlags.Public); - worldSizeY.SetValue(Main.ActiveWorldFileData, newHeight); - - FieldInfo lastMaxTilesY = typeof(WorldGen).GetField("lastMaxTilesY", BindingFlags.Static | BindingFlags.NonPublic); - lastMaxTilesY.SetValue(null, newHeight); - - Main.maxTilesY = newHeight; - - Main.bottomWorld = newHeight * 16; - Main.maxSectionsY = Main.maxTilesY / 150; - // - - //MAP - MethodInfo methodInfo = typeof(Main).GetMethod("InitMap", BindingFlags.NonPublic | BindingFlags.Instance); - methodInfo.Invoke(Main.instance, null); - // - - //MOVING THE TILES DOWN - Tile[,] newTiles = new Tile[8401, 2401 + ExpandWorldBy]; - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = 0; y < Main.maxTilesY; y++) - { - newTiles[x, y] = new Tile(); - if (y >= ExpandWorldBy) - { - newTiles[x, y].CopyFrom(Main.tile[x, y - ExpandWorldBy]); - Main.tile[x, y - ExpandWorldBy] = null; - } - } - } - - Main.tile = newTiles; - - for (int i = 0; i < Main.chest.Length; i++) - { - if (Main.chest[i] != null) - Main.chest[i].y += ExpandWorldBy; - } - // - - //FIXING VARIABLES - Main.worldSurface += ExpandWorldBy; - Main.rockLayer += ExpandWorldBy; - WorldGen.worldSurface += ExpandWorldBy; - WorldGen.worldSurfaceHigh += ExpandWorldBy; - WorldGen.worldSurfaceLow += ExpandWorldBy; - WorldGen.rockLayer += ExpandWorldBy; - WorldGen.rockLayerHigh += ExpandWorldBy; - WorldGen.rockLayerLow += ExpandWorldBy; - Main.spawnTileY += ExpandWorldBy; - Main.dungeonY += ExpandWorldBy; - // - - //FIXING THE GUIDE'S CURRENT POSITION - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].type == NPCID.Guide) - { - Main.npc[i].homeTileY = Main.spawnTileY; - Main.npc[i].position.Y += ExpandWorldBy * 16f; - break; - } - } - // - } - - private static void Planetoids(GenerationProgress progress) - { - progress.Message = "Generating Planetoids..."; - - int GrassPlanetoidCount = Main.maxTilesX / 1100; - int LCPlanetoidCount = Main.maxTilesX / 800; - int MudPlanetoidCount = Main.maxTilesX / 1100; - - //It might seem scary but fuck making an extra boolean - while (true) - { - if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 100, Main.maxTilesX / 2 + 100), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) - { - break; - } - } - while (LCPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(70, ExpandWorldBy); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - LCPlanetoidCount--; - } - while (GrassPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); - int y = WorldGen.genRand.Next(100, ExpandWorldBy); - - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - GrassPlanetoidCount--; - } - while (MudPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); - int y = WorldGen.genRand.Next(100, ExpandWorldBy); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - MudPlanetoidCount--; - } - } - - private static void PotFix(GenerationProgress progress) - { - Main.tileSolid[137] = true; - Main.tileSolid[130] = true; - progress.Message = Lang.gen[35].Value; - for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) - { - float num = (float)((double)i / ((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008)); - progress.Set(num); - bool flag = false; - int num2 = 0; - while (!flag) - { - int num3 = WorldGen.genRand.Next((int)WorldGen.worldSurfaceHigh, Main.maxTilesY - 10); - if ((double)num > 0.93) - { - num3 = Main.maxTilesY - 150; - } - else if ((double)num > 0.75) - { - num3 = (int)WorldGen.worldSurfaceLow; - } - int num4 = WorldGen.genRand.Next(1, Main.maxTilesX - 1); - bool flag2 = false; - for (int j = num3; j < Main.maxTilesY; j++) - { - if (!flag2) - { - if (Main.tile[num4, j].active() && Main.tileSolid[(int)Main.tile[num4, j].type] && !Main.tile[num4, j - 1].lava()) - { - flag2 = true; - } - } - else - { - int style = WorldGen.genRand.Next(0, 4); - int num5 = 0; - if (j < Main.maxTilesY - 5) - { - num5 = (int)Main.tile[num4, j + 1].type; - } - if (num5 == 147 || num5 == 161 || num5 == 162) - { - style = WorldGen.genRand.Next(4, 7); - } - if (num5 == 60) - { - style = WorldGen.genRand.Next(7, 10); - } - if (Main.wallDungeon[(int)Main.tile[num4, j].wall]) - { - style = WorldGen.genRand.Next(10, 13); - } - if (num5 == 41 || num5 == 43 || num5 == 44) - { - style = WorldGen.genRand.Next(10, 13); - } - if (num5 == 22 || num5 == 23 || num5 == 25) - { - style = WorldGen.genRand.Next(16, 19); - } - if (num5 == 199 || num5 == 203 || num5 == 204 || num5 == 200) - { - style = WorldGen.genRand.Next(22, 25); - } - if (num5 == 367) - { - style = WorldGen.genRand.Next(31, 34); - } - if (num5 == 226) - { - style = WorldGen.genRand.Next(28, 31); - } - if (j > Main.maxTilesY - 200) - { - style = WorldGen.genRand.Next(13, 16); - } - if (WorldGen.PlacePot(num4, j, 28, style)) - { - flag = true; - break; - } - num2++; - if (num2 >= 10000) - { - flag = true; - break; - } - } - } - } - } - } - - private static void RemoveMostTasks(List tasks) - { - int value = 15; - while (tasks.Count > value) - { - if (tasks[value].Name == "Spawn Point") - { - value++; - } - tasks.RemoveAt(value); - } - } - #endregion - - #region PostUpdate - public override void PostUpdate() - { - if (!NPC.downedBoss3 && revenge) - { - if (Main.netMode != 1) - { - if (Sandstorm.Happening) - { - Sandstorm.Happening = false; - Sandstorm.TimeLeft = 0; - } - } - } - if (CalamityGlobalNPC.holyBoss >= 0 && !Main.npc[CalamityGlobalNPC.holyBoss].active) - { - CalamityGlobalNPC.holyBoss = -1; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.Providence); - netMessage.Write(CalamityGlobalNPC.holyBoss); - netMessage.Send(); - } - } - if (CalamityGlobalNPC.doughnutBoss >= 0 && !Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - CalamityGlobalNPC.doughnutBoss = -1; - } - if (CalamityGlobalNPC.voidBoss >= 0 && !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - CalamityGlobalNPC.voidBoss = -1; - } - if (CalamityGlobalNPC.energyFlame >= 0 && !Main.npc[CalamityGlobalNPC.energyFlame].active) - { - CalamityGlobalNPC.energyFlame = -1; - } - if (CalamityGlobalNPC.hiveMind >= 0 && !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - CalamityGlobalNPC.hiveMind = -1; - } - if (CalamityGlobalNPC.hiveMind2 >= 0 && !Main.npc[CalamityGlobalNPC.hiveMind2].active) - { - CalamityGlobalNPC.hiveMind2 = -1; - } - if (CalamityGlobalNPC.scavenger >= 0 && !Main.npc[CalamityGlobalNPC.scavenger].active) - { - CalamityGlobalNPC.scavenger = -1; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.Ravager); - netMessage.Write(CalamityGlobalNPC.scavenger); - netMessage.Send(); - } - } - if (CalamityGlobalNPC.DoGHead >= 0 && !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - CalamityGlobalNPC.DoGHead = -1; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoG); - netMessage.Write(CalamityGlobalNPC.DoGHead); - netMessage.Send(); - } - } - if (CalamityGlobalNPC.ghostBoss >= 0 && !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - CalamityGlobalNPC.ghostBoss = -1; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.Polterghast); - netMessage.Write(CalamityGlobalNPC.ghostBoss); - netMessage.Send(); - } - } - if (CalamityGlobalNPC.laserEye >= 0 && !Main.npc[CalamityGlobalNPC.laserEye].active) - { - CalamityGlobalNPC.laserEye = -1; - } - if (CalamityGlobalNPC.fireEye >= 0 && !Main.npc[CalamityGlobalNPC.fireEye].active) - { - CalamityGlobalNPC.fireEye = -1; - } - if (CalamityGlobalNPC.lordeBoss >= 0 && !Main.npc[CalamityGlobalNPC.lordeBoss].active) - { - CalamityGlobalNPC.lordeBoss = -1; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.LORDE); - netMessage.Write(CalamityGlobalNPC.lordeBoss); - netMessage.Send(); - } - } - #region SpawnDoG - if (CalamityGlobalNPC.DoGSecondStageCountdown > 0) - { - CalamityGlobalNPC.DoGSecondStageCountdown--; - if (Main.netMode != 1) - { - if (CalamityGlobalNPC.DoGSecondStageCountdown == 21540) - { - NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("CeaselessVoid")); - } - if (CalamityGlobalNPC.DoGSecondStageCountdown == 14340) - { - NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("StormWeaverHead")); - } - if (CalamityGlobalNPC.DoGSecondStageCountdown == 7140) - { - NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("CosmicWraith")); - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 60) - { - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("DevourerofGodsHeadS")); - string key = "Mods.CalamityMod.EdgyBossText10"; - 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); - } - } - } - } - } - #endregion - if (Main.netMode != 1) - { - if (revenge) - { - CultistRitual.delay -= Main.dayRate * 10; - if (CultistRitual.delay < 0) - { - CultistRitual.delay = 0; - } - CultistRitual.recheck -= Main.dayRate * 10; - if (CultistRitual.recheck < 0) - { - CultistRitual.recheck = 0; - } - } - } - } - #endregion - } -} + } + #endregion + + #region EvilIsland + public static void EvilIsland(int i, int j) + { + double num = (double)WorldGen.genRand.Next(100, 150); //100 150 + float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (WorldGen.crimson ? 398 : 399); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(80, 95); + num2 = (float)WorldGen.genRand.Next(10, 15); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = num5 - 1; + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; + float num19 = vector.Y + 1f; + for (int num20 = num7; num20 < num8; num20++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num19 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num19 < vector.Y) + { + num19 = vector.Y; + } + if (num19 > vector.Y + 2f) + { + num19 = vector.Y + 2f; + } + for (int num21 = num9; num21 < num10; num21++) + { + if ((float)num21 > num19) + { + float arg_69E_0 = Math.Abs((float)num20 - vector.X); + float num22 = Math.Abs((float)num21 - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && + Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore + WorldGen.SquareTileFrame(num20, num21, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (WorldGen.crimson ? 400 : 401); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + int num38 = WorldGen.genRand.Next(4); + for (int num39 = 0; num39 <= num38; num39++) + { + int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); + int num41 = num5 - WorldGen.genRand.Next(20, 40); + int num42 = WorldGen.genRand.Next(4, 8); + int num43 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(2) == 0) + { + num43 = (WorldGen.crimson ? 398 : 399); + } + for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) + { + for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) + { + float arg_C74_0 = (float)Math.Abs(num44 - num40); + float num46 = (float)(Math.Abs(num45 - num41) * 2); + if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) + { + Main.tile[num44, num45].active(true); + Main.tile[num44, num45].type = (ushort)num43; + WorldGen.SquareTileFrame(num44, num45, true); + } + } + } + for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) + { + int num48 = num41 - num42; + while (!Main.tile[num47, num48].active()) + { + num48++; + } + Main.tile[num47, num48].active(false); + Main.tile[num47, num48].liquid = 255; + WorldGen.SquareTileFrame(num47, num48, true); + } + } + } + #endregion + + #region EvilIslandHouse + public static void EvilIslandHouse(int i, int j) + { + ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile + byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + int contain = 0; + if (WorldGen.crimson) + { + contain = 1571; //scourge + } + else + { + contain = 1569; //vampire + } + WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest + int num14 = i - num2 / 2 + 1; + int num15 = i + num2 / 2 - 1; + int num16 = 1; + if (num2 > 10) + { + num16 = 2; + } + int num17 = (num6 + num7) / 2 - 1; + for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) + { + for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) + { + Main.tile[num18, num19].wall = 21; //glass + } + } + for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) + { + for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) + { + Main.tile[num20, num21].wall = 21; //glass + } + } + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + } + #endregion + + #region UnderworldIsland + public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = mod.TileType("BrimstoneSlag"); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = mod.TileType("CharredOre"); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = mod.TileType("BrimstoneSlag"); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + } + #endregion + + #region UnderworldIslandHouse + public static void UnderworldIslandHouse(int i, int j, int item) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile + byte wall = (byte)14; //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair + } + #endregion + + #region AbyssIsland + public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int sizeMinSmall = sizeMin / 5; + int sizeMaxSmall = sizeMax / 5; + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + SafeSquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + if (hasTenebris) + { + int p = num3; + int num150; + for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) + { + int num14 = num6; + while (!Main.tile[p, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); //-3 4 + num150 = 1; //4 8 + int num16 = mod.TileType("Tenebris"); + for (int n = p - num150; n <= p + num150; n++) + { + for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - p); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + } + int sizeMinSmall2 = sizeMin2 / 8; + int sizeMaxSmall2 = sizeMax2 / 8; + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + SafeSquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + SafeSquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + SafeSquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + } + } + #endregion + + #region AbyssIslandHouse + public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile + ushort wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(5, 9); + int num3 = 3; + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].type = type; + Main.tile[l, m].wall = wall; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) + { + Main.tile[n, num8].active(false); + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + switch (itemChoice) + { + case 0: itemChoice = mod.ItemType("TorrentialTear"); break; //rain item + case 1: itemChoice = mod.ItemType("IronBoots"); break; //movement acc + case 2: itemChoice = mod.ItemType("DepthCharm"); break; //regen acc + case 3: itemChoice = mod.ItemType("Archerfish"); break; //ranged + case 4: itemChoice = mod.ItemType("AnechoicPlating"); break; //defense acc + case 5: itemChoice = mod.ItemType("BallOFugu"); break; //melee + case 6: itemChoice = mod.ItemType("StrangeOrb"); break; //light pet + case 7: itemChoice = mod.ItemType("HerringStaff"); break; //summon + case 8: itemChoice = mod.ItemType("BlackAnurian"); break; //magic + case 9: itemChoice = mod.ItemType("Lionfish"); break; //throwing + default: itemChoice = 497; break; + } + WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest + } + #endregion + + #region IcePyramid + public static bool IcePyramid(int i, int j) + { + ushort num = 161; + int arg_36_0 = j - WorldGen.genRand.Next(0, 7); + int num2 = WorldGen.genRand.Next(9, 13); + int num3 = 1; + int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 + for (int k = arg_36_0; k < num4; k++) + { + for (int l = i - num3; l < i + num3 - 1; l++) + { + Main.tile[l, k].type = num; + Main.tile[l, k].active(true); + Main.tile[l, k].halfBrick(false); + Main.tile[l, k].slope(0); + } + num3++; + } + for (int m = i - num3 - 5; m <= i + num3 + 5; m++) + { + for (int n = j - 1; n <= num4 + 1; n++) + { + bool flag = true; + for (int num5 = m - 1; num5 <= m + 1; num5++) + { + for (int num6 = n - 1; num6 <= n + 1; num6++) + { + if (Main.tile[num5, num6].type != num) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[m, n].wall = 71; + WorldGen.SquareWallFrame(m, n, true); + } + } + } + int num7 = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num7 = -1; + } + int num8 = i - num2 * num7; + int num9 = j + num2; + int num10 = WorldGen.genRand.Next(5, 8); + bool flag2 = true; + int num11 = WorldGen.genRand.Next(20, 30); + while (flag2) + { + flag2 = false; + bool flag3 = false; + for (int num12 = num9; num12 <= num9 + num10; num12++) + { + int num13 = num8; + if (Main.tile[num13, num12 - 1].type == 161) + { + flag3 = true; + } + if (Main.tile[num13, num12].type == num) + { + Main.tile[num13, num12 + 1].wall = 71; + Main.tile[num13 + num7, num12].wall = 71; + Main.tile[num13, num12].active(false); + flag2 = true; + } + if (flag3) + { + Main.tile[num13, num12].type = 161; + Main.tile[num13, num12].active(true); + Main.tile[num13, num12].halfBrick(false); + Main.tile[num13, num12].slope(0); + } + } + num8 -= num7; + } + num8 = i - num2 * num7; + bool flag4 = true; + bool flag5 = false; + flag2 = true; + while (flag2) + { + for (int num14 = num9; num14 <= num9 + num10; num14++) + { + int num15 = num8; + Main.tile[num15, num14].active(false); + } + num8 += num7; + num9++; + num11--; + if (num9 >= num4 - num10 * 2) + { + num11 = 10; + } + if (num11 <= 0) + { + bool flag6 = false; + if (!flag4 && !flag5) + { + flag5 = true; + flag6 = true; + int num16 = WorldGen.genRand.Next(7, 13); + int num17 = WorldGen.genRand.Next(23, 28); + int num18 = num17; + int num19 = num8; + while (num17 > 0) + { + for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) + { + if (num17 == num18 || num17 == 1) + { + if (num20 >= num9 - num16 + num10 + 2) + { + Main.tile[num8, num20].active(false); + } + } + else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) + { + if (num20 >= num9 - num16 + num10 + 1) + { + Main.tile[num8, num20].active(false); + } + } + else + { + Main.tile[num8, num20].active(false); + } + } + num17--; + num8 += num7; + } + int num21 = num8 - num7; + int num22 = num21; + int num23 = num19; + if (num21 > num19) + { + num22 = num19; + num23 = num21; + } + int num24 = WorldGen.genRand.Next(3); + if (num24 == 0) + { + num24 = 1861; //diving gear + } + else if (num24 == 1) + { + num24 = 1163; //balloon + } + else if (num24 == 2) + { + num24 = 1253; //shell + } + WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); + int num25 = WorldGen.genRand.Next(1, 10); + for (int num26 = 0; num26 < num25; num26++) + { + int arg_49B_0 = WorldGen.genRand.Next(num22, num23); + int j2 = num9 + num10; + WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); + } + for (int num27 = num22; num27 <= num23; num27++) + { + WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); + } + } + if (flag4) + { + flag4 = false; + num7 *= -1; + num11 = WorldGen.genRand.Next(15, 20); + } + else if (flag6) + { + num11 = WorldGen.genRand.Next(10, 15); + } + else + { + num7 *= -1; + num11 = WorldGen.genRand.Next(20, 40); + } + } + if (num9 >= num4 - num10) + { + flag2 = false; + } + } + int num28 = WorldGen.genRand.Next(20, 40); //100 200 + int num29 = WorldGen.genRand.Next(100, 160); //500 800 + flag2 = true; + int num30 = num10; + num11 = WorldGen.genRand.Next(10, 50); + if (num7 == 1) + { + num8 -= num30; + } + int num31 = WorldGen.genRand.Next(5, 10); + while (flag2) + { + num28--; + num29--; + num11--; + for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) + { + int num33 = num9; + if (num32 >= num8 && num32 <= num8 + num30) + { + Main.tile[num32, num33].active(false); + } + else + { + Main.tile[num32, num33].type = num; + Main.tile[num32, num33].active(true); + Main.tile[num32, num33].halfBrick(false); + Main.tile[num32, num33].slope(0); + } + if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) + { + Main.tile[num32, num33].wall = 71; + } + } + num9++; + num8 += num7; + if (num28 <= 0) + { + flag2 = false; + for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) + { + if (Main.tile[num34, num9].active()) + { + flag2 = true; + } + } + } + if (num11 < 0) + { + num11 = WorldGen.genRand.Next(10, 50); + num7 *= -1; + } + if (num29 <= 0) + { + flag2 = false; + } + } + return true; + } + #endregion + + #region SpecialHut + public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int chestX, int chestY) + { + int m = WorldGen.genRand.Next(2, 4); + int num6 = WorldGen.genRand.Next(2, 4); + for (int n = chestX - m - 1; n <= chestX + m + 1; n++) + { + for (int num8 = chestY - num6 - 1; num8 <= chestY + num6 + 1; num8++) + { + Main.tile[n, num8].active(true); + Main.tile[n, num8].type = tile; //change + Main.tile[n, num8].liquid = 0; + Main.tile[n, num8].lava(false); + } + } + for (int num9 = chestX - m; num9 <= chestX + m; num9++) + { + for (int num10 = chestY - num6; num10 <= chestY + num6; num10++) + { + Main.tile[num9, num10].active(false); + Main.tile[num9, num10].wall = wall; //change + } + } + for (int num14 = chestX - m - 1; num14 <= chestX + m + 1; num14++) + { + for (int num15 = chestY + num6 - 2; num15 <= chestY + num6; num15++) + { + Main.tile[num14, num15].active(false); + } + } + for (int num16 = chestX - m - 1; num16 <= chestX + m + 1; num16++) + { + for (int num17 = chestY + num6 - 2; num17 <= chestY + num6 - 1; num17++) + { + Main.tile[num16, num17].active(false); + } + } + for (int num18 = chestX - m - 1; num18 <= chestX + m + 1; num18++) + { + int num19 = 4; + int num20 = chestY + num6 + 2; + while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) + { + Main.tile[num18, num20].active(true); + Main.tile[num18, num20].type = tile2; //change + num20++; + num19--; + } + } + m -= WorldGen.genRand.Next(1, 3); + int num21 = chestY - num6 - 2; + while (m > -1) + { + for (int num22 = chestX - m - 1; num22 <= chestX + m + 1; num22++) + { + Main.tile[num22, num21].active(true); + Main.tile[num22, num21].type = tile; //change + } + m -= WorldGen.genRand.Next(1, 3); + num21--; + } + CalamityWorld.SChestX[hutType] = chestX; + CalamityWorld.SChestY[hutType] = chestY; + SpecialChest(hutType); + } + #endregion + + #region SpecialChest + public static void SpecialChest(int itemChoice) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int item = 0; + int chestType = 0; + switch (itemChoice) //0 to 9 + { + case 0: item = 976; break; //climbing gear + case 1: item = (WorldGen.crimson ? 3016 : 3015); chestType = (WorldGen.crimson ? 43 : 3); break; //flesh knuckles or putrid scent + case 2: item = 908; chestType = 44; break; //lava waders + case 3: item = 1595; chestType = 47; break; //cuffs + case 4: item = 899; chestType = 30; break; //sun stone + case 5: item = 1864; chestType = 32; break; //scarab + case 6: item = 532; chestType = 50; break; //fuck you, star cloak + case 7: item = 554; chestType = 51; break; //fuck you, cross necklace + case 8: item = mod.ItemType("Murasama"); chestType = 44; break; + case 9: item = mod.ItemType("BossRush"); chestType = 4; break; + } + for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) + { + for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) + { + WorldGen.KillTile(j, k, false, false, false); + } + } + for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) + { + for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) + { + if (m < Main.maxTilesY) + { + Main.tile[l, m].slope(0); + Main.tile[l, m].halfBrick(false); + } + } + } + WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); + } + #endregion + + #region ChasmGenerator + public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + float num = (float)steps; //y / 4, small = 300, medium = 450, large = 600 + if (Main.maxTilesY > 1500) { num += 100f; if (Main.maxTilesY > 2100) { num += 100f; } } //small = 300, medium = 550, large = 800 + if (ocean) + { + int tileYLookup = j; + if (abyssSide) + { + while (!Main.tile[i + 125, tileYLookup].active()) + { + tileYLookup++; + } + } + else + { + while (!Main.tile[i - 125, tileYLookup].active()) + { + tileYLookup++; + } + } + j = tileYLookup; + } + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; + vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; + int num2 = 5; + double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width + while (num3 > 0.0) + { + if (num > 0f) + { + num3 += (double)WorldGen.genRand.Next(2); + num3 -= (double)WorldGen.genRand.Next(2); + float smallHoleLimit = 240f; //small + if (Main.maxTilesY > 1500) { smallHoleLimit = 460f; if (Main.maxTilesY > 2100) { smallHoleLimit = 700f; } } + if (ocean && num > smallHoleLimit) //dig small hole, small = 225, medium = 450, large = 675, 80% of first number + { + if (num3 < 4.0) //min width + { + num3 = 4.0; //min width + } + if (num3 > 6.0) //max width + { + num3 = 6.0; //max width + } + } + else //dig large hole + { + if (num3 < (ocean ? 42.0 : 14.0)) //min width + { + num3 = (ocean ? 42.0 : 14.0); //min width + } + if (num3 > (ocean ? 60.0 : 40.0)) //max width + { + num3 = (ocean ? 60.0 : 40.0); //max width + } + if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) + { + num3 = (ocean ? 50.0 : 20.0); + } + } + } + else + { + if (Main.maxTilesY > 2100) + { + if ((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.35)) //960 + 840 = 1800 + { + num3 -= (double)(WorldGen.genRand.Next(5) + 8); + } + } + else if (Main.maxTilesY > 1500) + { + if ((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.331)) + { + num3 -= (double)(WorldGen.genRand.Next(5) + 8); + } + } + else + { + if ((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.312)) //960 + { + num3 -= (double)(WorldGen.genRand.Next(5) + 8); + } + } + } + if (Main.maxTilesY > 2100) + { + if (((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.38) && num > 0f && ocean) || //960 + 912 = 1872 limit is 1944 + ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else if (Main.maxTilesY > 1500) + { + if (((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.34) && num > 0f && ocean) || + ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else + { + if (((double)vector.Y > (Main.rockLayer + (double)Main.maxTilesY * 0.3) && num > 0f && ocean) || + ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + num -= 1f; + int num4; + int num5; + int num6; + int num7; + if (num > (float)num2) + { + num4 = (int)((double)vector.X - num3 * 0.5); + num5 = (int)((double)vector.X + num3 * 0.5); + num6 = (int)((double)vector.Y - num3 * 0.5); + num7 = (int)((double)vector.Y + num3 * 0.5); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int k = num4; k < num5; k++) + { + for (int l = num6; l < num7; l++) + { + if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(false); + } + else + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(true); + } + } + } + } + } + if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.312)) //1260 + { + num = 2f; + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; + if ((double)vector2.X > 0.02) + { + vector2.X = 0.02f; + } + if ((double)vector2.X < -0.02) + { + vector2.X = -0.02f; + } + num4 = (int)((double)vector.X - num3 * 1.1); + num5 = (int)((double)vector.X + num3 * 1.1); + num6 = (int)((double)vector.Y - num3 * 1.1); + num7 = (int)((double)vector.Y + num3 * 1.1); + if (num4 < 1) + { + num4 = 1; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int m = num4; m < num5; m++) + { + for (int n = num6; n < num7; n++) + { + if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (n > j + WorldGen.genRand.Next(7, 16)) + { + Main.tile[m, n].active(false); + } + if (steps <= num2) + { + Main.tile[m, n].active(false); + } + if (ocean) + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(false); + } + else + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(true); + } + } + } + } + for (int num11 = num4; num11 < num5; num11++) + { + for (int num12 = num6; num12 < num7; num12++) + { + if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(false); + } + else + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(true); + } + if (steps <= num2) + { + Main.tile[num11, num12].active(false); + } + } + } + } + } + } + #endregion + + #region PlanetoidMethods + //WORLD GENERATION PASSES + private static void ExpandWorld(GenerationProgress progress) + { + int newHeight = Main.maxTilesY + ExpandWorldBy; + + //--------------------- + //MISC. FIXES + //--------------------- + + //TILES + FieldInfo worldSizeY = typeof(WorldFileData).GetField("WorldSizeY", BindingFlags.Instance | BindingFlags.Public); + worldSizeY.SetValue(Main.ActiveWorldFileData, newHeight); + + FieldInfo lastMaxTilesY = typeof(WorldGen).GetField("lastMaxTilesY", BindingFlags.Static | BindingFlags.NonPublic); + lastMaxTilesY.SetValue(null, newHeight); + + Main.maxTilesY = newHeight; + + Main.bottomWorld = newHeight * 16; + Main.maxSectionsY = Main.maxTilesY / 150; + // + + //MAP + MethodInfo methodInfo = typeof(Main).GetMethod("InitMap", BindingFlags.NonPublic | BindingFlags.Instance); + methodInfo.Invoke(Main.instance, null); + // + + //MOVING THE TILES DOWN + Tile[,] newTiles = new Tile[8401, 2401 + ExpandWorldBy]; + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = 0; y < Main.maxTilesY; y++) + { + newTiles[x, y] = new Tile(); + if (y >= ExpandWorldBy) + { + newTiles[x, y].CopyFrom(Main.tile[x, y - ExpandWorldBy]); + Main.tile[x, y - ExpandWorldBy] = null; + } + } + } + + Main.tile = newTiles; + + for (int i = 0; i < Main.chest.Length; i++) + { + if (Main.chest[i] != null) + Main.chest[i].y += ExpandWorldBy; + } + // + + //FIXING VARIABLES + Main.worldSurface += ExpandWorldBy; + Main.rockLayer += ExpandWorldBy; + WorldGen.worldSurface += ExpandWorldBy; + WorldGen.worldSurfaceHigh += ExpandWorldBy; + WorldGen.worldSurfaceLow += ExpandWorldBy; + WorldGen.rockLayer += ExpandWorldBy; + WorldGen.rockLayerHigh += ExpandWorldBy; + WorldGen.rockLayerLow += ExpandWorldBy; + Main.spawnTileY += ExpandWorldBy; + Main.dungeonY += ExpandWorldBy; + // + + //FIXING THE GUIDE'S CURRENT POSITION + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].type == NPCID.Guide) + { + Main.npc[i].homeTileY = Main.spawnTileY; + Main.npc[i].position.Y += ExpandWorldBy * 16f; + break; + } + } + // + } + + private static void Planetoids(GenerationProgress progress) + { + progress.Message = "Generating Planetoids..."; + + int GrassPlanetoidCount = Main.maxTilesX / 1100; + int LCPlanetoidCount = Main.maxTilesX / 800; + int MudPlanetoidCount = Main.maxTilesX / 1100; + + //It might seem scary but fuck making an extra boolean + while (true) + { + if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 100, Main.maxTilesX / 2 + 100), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) + { + break; + } + } + while (LCPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(70, ExpandWorldBy); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + LCPlanetoidCount--; + } + while (GrassPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); + int y = WorldGen.genRand.Next(100, ExpandWorldBy); + + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + GrassPlanetoidCount--; + } + while (MudPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int y = WorldGen.genRand.Next(100, ExpandWorldBy); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + MudPlanetoidCount--; + } + } + + private static void PotFix(GenerationProgress progress) + { + Main.tileSolid[137] = true; + Main.tileSolid[130] = true; + progress.Message = Lang.gen[35].Value; + for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) + { + float num = (float)((double)i / ((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008)); + progress.Set(num); + bool flag = false; + int num2 = 0; + while (!flag) + { + int num3 = WorldGen.genRand.Next((int)WorldGen.worldSurfaceHigh, Main.maxTilesY - 10); + if ((double)num > 0.93) + { + num3 = Main.maxTilesY - 150; + } + else if ((double)num > 0.75) + { + num3 = (int)WorldGen.worldSurfaceLow; + } + int num4 = WorldGen.genRand.Next(1, Main.maxTilesX - 1); + bool flag2 = false; + for (int j = num3; j < Main.maxTilesY; j++) + { + if (!flag2) + { + if (Main.tile[num4, j].active() && Main.tileSolid[(int)Main.tile[num4, j].type] && !Main.tile[num4, j - 1].lava()) + { + flag2 = true; + } + } + else + { + int style = WorldGen.genRand.Next(0, 4); + int num5 = 0; + if (j < Main.maxTilesY - 5) + { + num5 = (int)Main.tile[num4, j + 1].type; + } + if (num5 == 147 || num5 == 161 || num5 == 162) + { + style = WorldGen.genRand.Next(4, 7); + } + if (num5 == 60) + { + style = WorldGen.genRand.Next(7, 10); + } + if (Main.wallDungeon[(int)Main.tile[num4, j].wall]) + { + style = WorldGen.genRand.Next(10, 13); + } + if (num5 == 41 || num5 == 43 || num5 == 44) + { + style = WorldGen.genRand.Next(10, 13); + } + if (num5 == 22 || num5 == 23 || num5 == 25) + { + style = WorldGen.genRand.Next(16, 19); + } + if (num5 == 199 || num5 == 203 || num5 == 204 || num5 == 200) + { + style = WorldGen.genRand.Next(22, 25); + } + if (num5 == 367) + { + style = WorldGen.genRand.Next(31, 34); + } + if (num5 == 226) + { + style = WorldGen.genRand.Next(28, 31); + } + if (j > Main.maxTilesY - 200) + { + style = WorldGen.genRand.Next(13, 16); + } + if (WorldGen.PlacePot(num4, j, 28, style)) + { + flag = true; + break; + } + num2++; + if (num2 >= 10000) + { + flag = true; + break; + } + } + } + } + } + } + + private static void RemoveMostTasks(List tasks) + { + int value = 15; + while (tasks.Count > value) + { + if (tasks[value].Name == "Spawn Point") + { + value++; + } + tasks.RemoveAt(value); + } + } + #endregion + + #region PostUpdate + public override void PostUpdate() + { + if (!NPC.downedBoss3 && revenge) + { + if (Main.netMode != 1) + { + if (Sandstorm.Happening) + { + Sandstorm.Happening = false; + Sandstorm.TimeLeft = 0; + } + } + } + if (CalamityGlobalNPC.holyBoss >= 0 && !Main.npc[CalamityGlobalNPC.holyBoss].active) + { + CalamityGlobalNPC.holyBoss = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.Providence); + netMessage.Write(CalamityGlobalNPC.holyBoss); + netMessage.Send(); + } + } + if (CalamityGlobalNPC.doughnutBoss >= 0 && !Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + CalamityGlobalNPC.doughnutBoss = -1; + } + if (CalamityGlobalNPC.voidBoss >= 0 && !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + CalamityGlobalNPC.voidBoss = -1; + } + if (CalamityGlobalNPC.energyFlame >= 0 && !Main.npc[CalamityGlobalNPC.energyFlame].active) + { + CalamityGlobalNPC.energyFlame = -1; + } + if (CalamityGlobalNPC.hiveMind >= 0 && !Main.npc[CalamityGlobalNPC.hiveMind].active) + { + CalamityGlobalNPC.hiveMind = -1; + } + if (CalamityGlobalNPC.hiveMind2 >= 0 && !Main.npc[CalamityGlobalNPC.hiveMind2].active) + { + CalamityGlobalNPC.hiveMind2 = -1; + } + if (CalamityGlobalNPC.scavenger >= 0 && !Main.npc[CalamityGlobalNPC.scavenger].active) + { + CalamityGlobalNPC.scavenger = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.Ravager); + netMessage.Write(CalamityGlobalNPC.scavenger); + netMessage.Send(); + } + } + if (CalamityGlobalNPC.DoGHead >= 0 && !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + CalamityGlobalNPC.DoGHead = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoG); + netMessage.Write(CalamityGlobalNPC.DoGHead); + netMessage.Send(); + } + } + if (CalamityGlobalNPC.SCal >= 0 && !Main.npc[CalamityGlobalNPC.SCal].active) + { + CalamityGlobalNPC.SCal = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SupremeCal); + netMessage.Write(CalamityGlobalNPC.SCal); + netMessage.Send(); + } + } + if (CalamityGlobalNPC.ghostBoss >= 0 && !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + CalamityGlobalNPC.ghostBoss = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.Polterghast); + netMessage.Write(CalamityGlobalNPC.ghostBoss); + netMessage.Send(); + } + } + if (CalamityGlobalNPC.laserEye >= 0 && !Main.npc[CalamityGlobalNPC.laserEye].active) + { + CalamityGlobalNPC.laserEye = -1; + } + if (CalamityGlobalNPC.fireEye >= 0 && !Main.npc[CalamityGlobalNPC.fireEye].active) + { + CalamityGlobalNPC.fireEye = -1; + } + if (CalamityGlobalNPC.lordeBoss >= 0 && !Main.npc[CalamityGlobalNPC.lordeBoss].active) + { + CalamityGlobalNPC.lordeBoss = -1; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.LORDE); + netMessage.Write(CalamityGlobalNPC.lordeBoss); + netMessage.Send(); + } + } + #region SpawnDoG + if (CalamityGlobalNPC.DoGSecondStageCountdown > 0) + { + CalamityGlobalNPC.DoGSecondStageCountdown--; + if (Main.netMode != 1) + { + if (CalamityGlobalNPC.DoGSecondStageCountdown == 21540) + { + NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("CeaselessVoid")); + } + if (CalamityGlobalNPC.DoGSecondStageCountdown == 14340) + { + NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("StormWeaverHead")); + } + if (CalamityGlobalNPC.DoGSecondStageCountdown == 7140) + { + NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("CosmicWraith")); + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 60) + { + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) + { + NPC.SpawnOnPlayer((int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0), mod.NPCType("DevourerofGodsHeadS")); + string key = "Mods.CalamityMod.EdgyBossText10"; + 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); + } + } + } + } + } + #endregion + if (Main.netMode != 1) + { + if (revenge) + { + CultistRitual.delay -= Main.dayRate * 10; + if (CultistRitual.delay < 0) + { + CultistRitual.delay = 0; + } + CultistRitual.recheck -= Main.dayRate * 10; + if (CultistRitual.recheck < 0) + { + CultistRitual.recheck = 0; + } + } + } + } + #endregion + } +} diff --git a/CustomTileFraming.cs b/CustomTileFraming.cs index 43bd926737..2ce3e77392 100644 --- a/CustomTileFraming.cs +++ b/CustomTileFraming.cs @@ -21,11 +21,11 @@ namespace CalamityMod static CustomTileFraming() { - Setup(); - } - - private static void Setup() - { + Setup(); + } + + private static void Setup() + { Mod mod = CalamityMod.Instance; int size = CalamityGlobalTile.PlantTypes.Length; @@ -54,12 +54,11 @@ namespace CalamityMod 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; - + if (PlantCheckAgainst[plantType] == null) return false; int size = PlantCheckAgainst[plantType].Length; for (int i = 0; i < size; i++) { diff --git a/Dusts/AHSparkle.cs b/Dusts/AHSparkle.cs index 13b408e409..44a04352f1 100644 --- a/Dusts/AHSparkle.cs +++ b/Dusts/AHSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class AHSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - dust.alpha = 50; - } - - 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.4f, 0.8f, 1.0f); - if(dust.scale < 0.25f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class AHSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + dust.alpha = 50; + } + + 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.4f, 0.8f, 1.0f); + if(dust.scale < 0.25f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/AWSparkle.cs b/Dusts/AWSparkle.cs index 229b798c01..ea1b5c7b00 100644 --- a/Dusts/AWSparkle.cs +++ b/Dusts/AWSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class AWSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.7f; - } - - 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.05f, 0.4f, 0.05f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class AWSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.7f; + } + + 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.05f, 0.4f, 0.05f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/BHSparkle.cs b/Dusts/BHSparkle.cs index 98f03f63a9..20f4aee896 100644 --- a/Dusts/BHSparkle.cs +++ b/Dusts/BHSparkle.cs @@ -1,70 +1,70 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class BHSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.94f; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 1.5f; - dust.alpha = 100; - } - - 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; - if (dust.scale >= 1.5) - { - dust.scale -= 0.01f; - } - else - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.5) - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.25) - { - dust.scale -= 0.05f; - } - if (dust.scale < 0.3f) - { - dust.active = false; - } - float num94 = dust.scale; - if (dust.noLight) - { - num94 *= 0.1f; - dust.scale -= 0.06f; - if (dust.scale < 1f) - { - dust.scale -= 0.06f; - } - if (Main.player[Main.myPlayer].wet) - { - dust.position += Main.player[Main.myPlayer].velocity * 0.5f; - } - else - { - dust.position += Main.player[Main.myPlayer].velocity; - } - } - if (num94 > 1f) - { - num94 = 1f; - } - Lighting.AddLight(dust.position, 0.25f, 0.15f, 0.01f); - return false; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class BHSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.94f; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 1.5f; + dust.alpha = 100; + } + + 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; + if (dust.scale >= 1.5) + { + dust.scale -= 0.01f; + } + else + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.5) + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.25) + { + dust.scale -= 0.05f; + } + if (dust.scale < 0.3f) + { + dust.active = false; + } + float num94 = dust.scale; + if (dust.noLight) + { + num94 *= 0.1f; + dust.scale -= 0.06f; + if (dust.scale < 1f) + { + dust.scale -= 0.06f; + } + if (Main.player[Main.myPlayer].wet) + { + dust.position += Main.player[Main.myPlayer].velocity * 0.5f; + } + else + { + dust.position += Main.player[Main.myPlayer].velocity; + } + } + if (num94 > 1f) + { + num94 = 1f; + } + Lighting.AddLight(dust.position, 0.25f, 0.15f, 0.01f); + return false; + } + } } \ No newline at end of file diff --git a/Dusts/BrimstoneFlame.cs b/Dusts/BrimstoneFlame.cs index 79f1109381..6111b7bb54 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); - } - } +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 diff --git a/Dusts/CCSparkle.cs b/Dusts/CCSparkle.cs index a0da8311c4..d084d2ff02 100644 --- a/Dusts/CCSparkle.cs +++ b/Dusts/CCSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class CCSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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.5f, 0f, 0.5f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class CCSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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.5f, 0f, 0.5f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/CESparkle.cs b/Dusts/CESparkle.cs index 7a10e935ae..d8f238601e 100644 --- a/Dusts/CESparkle.cs +++ b/Dusts/CESparkle.cs @@ -1,67 +1,67 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class CESparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.94f; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 1.5f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - float light = 0.35f * dust.scale; - if (dust.scale >= 1.5) - { - dust.scale -= 0.01f; - } - else - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.5) - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.25) - { - dust.scale -= 0.05f; - } - if (dust.scale < 0.3f) - { - dust.active = false; - } - float num94 = dust.scale; - if (dust.noLight) - { - num94 *= 0.1f; - dust.scale -= 0.06f; - if (dust.scale < 1f) - { - dust.scale -= 0.06f; - } - if (Main.player[Main.myPlayer].wet) - { - dust.position += Main.player[Main.myPlayer].velocity * 0.5f; - } - else - { - dust.position += Main.player[Main.myPlayer].velocity; - } - } - if (num94 > 1f) - { - num94 = 1f; - } - Lighting.AddLight(dust.position, 0.1f, 1.0f, 0.1f); - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class CESparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.94f; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 1.5f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + float light = 0.35f * dust.scale; + if (dust.scale >= 1.5) + { + dust.scale -= 0.01f; + } + else + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.5) + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.25) + { + dust.scale -= 0.05f; + } + if (dust.scale < 0.3f) + { + dust.active = false; + } + float num94 = dust.scale; + if (dust.noLight) + { + num94 *= 0.1f; + dust.scale -= 0.06f; + if (dust.scale < 1f) + { + dust.scale -= 0.06f; + } + if (Main.player[Main.myPlayer].wet) + { + dust.position += Main.player[Main.myPlayer].velocity * 0.5f; + } + else + { + dust.position += Main.player[Main.myPlayer].velocity; + } + } + if (num94 > 1f) + { + num94 = 1f; + } + Lighting.AddLight(dust.position, 0.1f, 1.0f, 0.1f); + return false; + } }} \ No newline at end of file diff --git a/Dusts/DWSparkle.cs b/Dusts/DWSparkle.cs index 158a462edf..a66c713e12 100644 --- a/Dusts/DWSparkle.cs +++ b/Dusts/DWSparkle.cs @@ -1,68 +1,68 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class DWSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.24f; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 1.2f; - dust.alpha = 100; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - float light = 0.35f * dust.scale; - if (dust.scale >= 1.5) - { - dust.scale -= 0.01f; - } - else - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.5) - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.25) - { - dust.scale -= 0.05f; - } - if (dust.scale < 0.3f) - { - dust.active = false; - } - float num94 = dust.scale; - if (dust.noLight) - { - num94 *= 0.1f; - dust.scale -= 0.08f; - if (dust.scale < 1f) - { - dust.scale -= 0.08f; - } - if (Main.player[Main.myPlayer].wet) - { - dust.position += Main.player[Main.myPlayer].velocity * 0.75f; - } - else - { - dust.position += Main.player[Main.myPlayer].velocity; - } - } - if (num94 > 1f) - { - num94 = 1f; - } - Lighting.AddLight(dust.position, 1.0f, 0.2f, 0.01f); - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class DWSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.24f; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 1.2f; + dust.alpha = 100; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + float light = 0.35f * dust.scale; + if (dust.scale >= 1.5) + { + dust.scale -= 0.01f; + } + else + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.5) + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.25) + { + dust.scale -= 0.05f; + } + if (dust.scale < 0.3f) + { + dust.active = false; + } + float num94 = dust.scale; + if (dust.noLight) + { + num94 *= 0.1f; + dust.scale -= 0.08f; + if (dust.scale < 1f) + { + dust.scale -= 0.08f; + } + if (Main.player[Main.myPlayer].wet) + { + dust.position += Main.player[Main.myPlayer].velocity * 0.75f; + } + else + { + dust.position += Main.player[Main.myPlayer].velocity; + } + } + if (num94 > 1f) + { + num94 = 1f; + } + Lighting.AddLight(dust.position, 1.0f, 0.2f, 0.01f); + return false; + } }} \ No newline at end of file diff --git a/Dusts/DarkManaFlame.cs b/Dusts/DarkManaFlame.cs index 5636676f3e..c2fc4afcd3 100644 --- a/Dusts/DarkManaFlame.cs +++ b/Dusts/DarkManaFlame.cs @@ -1,41 +1,41 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts -{ - public class DarkManaFlame : 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.9f; - } - - public override bool MidUpdate(Dust dust) - { - if (!dust.noGravity) - { - dust.velocity.Y += 0.05f; - dust.velocity.X += 0.05f; - } - if (!dust.noLight) - { - float strength = dust.scale * 1.4f; - if (strength > 1f) - { - strength = 1f; - } - Lighting.AddLight(dust.position, 0.1f * strength, 0.01f * strength, 0.1f * strength); - } - return true; - } - - public override Color? GetAlpha(Dust dust, Color lightColor) - { - return new Color(lightColor.R, lightColor.G, lightColor.B, 25); - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class DarkManaFlame : 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.9f; + } + + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + dust.velocity.X += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.1f * strength, 0.01f * 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 diff --git a/Dusts/GBSparkle.cs b/Dusts/GBSparkle.cs index a3d850e3bf..ec534a7264 100644 --- a/Dusts/GBSparkle.cs +++ b/Dusts/GBSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class GBSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.3f; - dust.alpha = 100; - 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.05f, 0.4f, 0.25f); - if (dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class GBSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.3f; + dust.alpha = 100; + 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.05f, 0.4f, 0.25f); + if (dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/GFSparkle.cs b/Dusts/GFSparkle.cs index 9e9b5305bb..575f7f753b 100644 --- a/Dusts/GFSparkle.cs +++ b/Dusts/GFSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class GFSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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, light, light, light); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class GFSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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, light, light, light); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/HBSparkle.cs b/Dusts/HBSparkle.cs index 6d6e18bc57..a0cff41c6d 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; - } +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 diff --git a/Dusts/HSparkle.cs b/Dusts/HSparkle.cs index 680b0380da..2e3af904ee 100644 --- a/Dusts/HSparkle.cs +++ b/Dusts/HSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class HSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 1.5f; - } - - 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, light, light, light); - if (dust.scale < 0.3f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class HSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 1.5f; + } + + 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, light, light, light); + if (dust.scale < 0.3f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/HolyFlame.cs b/Dusts/HolyFlame.cs index 9ba4e851f1..08deeb2c03 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); - } - } +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 diff --git a/Dusts/MSparkle.cs b/Dusts/MSparkle.cs index 0044fa7f17..d73b39fe3f 100644 --- a/Dusts/MSparkle.cs +++ b/Dusts/MSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class MSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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.05f, 0.05f, 0.4f); - if(dust.scale < 0.25f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class MSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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.05f, 0.05f, 0.4f); + if(dust.scale < 0.25f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/NFSparkle.cs b/Dusts/NFSparkle.cs index a70dfac8f5..af19b6d170 100644 --- a/Dusts/NFSparkle.cs +++ b/Dusts/NFSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class NFSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.25f; - dust.noGravity = true; - dust.alpha = 50; - dust.noLight = true; - dust.scale = 0.225f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.5f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.01f, 0.2f, 0.2f); - if (dust.scale < 0.175f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class NFSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.25f; + dust.noGravity = true; + dust.alpha = 50; + dust.noLight = true; + dust.scale = 0.225f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.5f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.01f, 0.2f, 0.2f); + if (dust.scale < 0.175f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/OMGWTHSparkle.cs b/Dusts/OMGWTHSparkle.cs index 3ca3879961..524f68ee15 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; - } +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 diff --git a/Dusts/PGSparkle.cs b/Dusts/PGSparkle.cs index 2550bc48e9..718d644c7a 100644 --- a/Dusts/PGSparkle.cs +++ b/Dusts/PGSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class PGSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.75f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 1.0f; - } - - 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.5f, 0.05f, 0.5f); - if(dust.scale < 0.5f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class PGSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.75f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 1.0f; + } + + 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.5f, 0.05f, 0.5f); + if(dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/SBSparkle.cs b/Dusts/SBSparkle.cs index 950dcb8838..b035ab96c3 100644 --- a/Dusts/SBSparkle.cs +++ b/Dusts/SBSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class SBSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.alpha = 100; - dust.noGravity = false; - dust.noLight = true; - dust.scale = 0.2f; - } - - 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.05f, 0.05f, 0.25f); - if (dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class SBSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.alpha = 100; + dust.noGravity = false; + dust.noLight = true; + dust.scale = 0.2f; + } + + 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.05f, 0.05f, 0.25f); + if (dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/SPSparkle.cs b/Dusts/SPSparkle.cs index 6df5708388..1486732e91 100644 --- a/Dusts/SPSparkle.cs +++ b/Dusts/SPSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class SPSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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, 0f, 0.6f, 1.0f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class SPSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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, 0f, 0.6f, 1.0f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/SWSparkle.cs b/Dusts/SWSparkle.cs index 70259612de..b1049fe41e 100644 --- a/Dusts/SWSparkle.cs +++ b/Dusts/SWSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class SWSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = false; - 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.15f, 0.01f, 0.15f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class SWSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = false; + 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.15f, 0.01f, 0.15f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/TCESparkle.cs b/Dusts/TCESparkle.cs index 2b216baf84..c3bbe4b030 100644 --- a/Dusts/TCESparkle.cs +++ b/Dusts/TCESparkle.cs @@ -1,67 +1,67 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class TCESparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.94f; - dust.noGravity = true; - dust.noLight = false; - dust.scale = 1.0f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X; - float light = 0.35f * dust.scale; - if (dust.scale >= 1.5) - { - dust.scale -= 0.01f; - } - else - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.5) - { - dust.scale -= 0.05f; - } - if (dust.scale <= 0.25) - { - dust.scale -= 0.05f; - } - if (dust.scale < 0.5f) - { - dust.active = false; - } - float num94 = dust.scale; - if (dust.noLight) - { - num94 *= 0.1f; - dust.scale -= 0.06f; - if (dust.scale < 1f) - { - dust.scale -= 0.06f; - } - if (Main.player[Main.myPlayer].wet) - { - dust.position += Main.player[Main.myPlayer].velocity * 0.5f; - } - else - { - dust.position += Main.player[Main.myPlayer].velocity; - } - } - if (num94 > 1f) - { - num94 = 1f; - } - Lighting.AddLight(dust.position, 0.5f, 1.0f, 0.1f); - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class TCESparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.94f; + dust.noGravity = true; + dust.noLight = false; + dust.scale = 1.0f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X; + float light = 0.35f * dust.scale; + if (dust.scale >= 1.5) + { + dust.scale -= 0.01f; + } + else + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.5) + { + dust.scale -= 0.05f; + } + if (dust.scale <= 0.25) + { + dust.scale -= 0.05f; + } + if (dust.scale < 0.5f) + { + dust.active = false; + } + float num94 = dust.scale; + if (dust.noLight) + { + num94 *= 0.1f; + dust.scale -= 0.06f; + if (dust.scale < 1f) + { + dust.scale -= 0.06f; + } + if (Main.player[Main.myPlayer].wet) + { + dust.position += Main.player[Main.myPlayer].velocity * 0.5f; + } + else + { + dust.position += Main.player[Main.myPlayer].velocity; + } + } + if (num94 > 1f) + { + num94 = 1f; + } + Lighting.AddLight(dust.position, 0.5f, 1.0f, 0.1f); + return false; + } }} \ No newline at end of file diff --git a/Dusts/TFSSparkle.cs b/Dusts/TFSSparkle.cs index 0dea81d2ba..daec628525 100644 --- a/Dusts/TFSSparkle.cs +++ b/Dusts/TFSSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class TFSSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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, light, light, light); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class TFSSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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, light, light, light); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/TMSparkle.cs b/Dusts/TMSparkle.cs index 8c21f83e11..4bfd0006ff 100644 --- a/Dusts/TMSparkle.cs +++ b/Dusts/TMSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class TMSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale = 1.5f; - } - - 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, light, light, light); - if (dust.scale < 0.3f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class TMSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 1.5f; + } + + 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, light, light, light); + if (dust.scale < 0.3f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/TWSparkle.cs b/Dusts/TWSparkle.cs index 10161500fc..2fa796cf5f 100644 --- a/Dusts/TWSparkle.cs +++ b/Dusts/TWSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class TWSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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.5f, 0.5f, 0f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class TWSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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.5f, 0.5f, 0f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/TYSSparkle.cs b/Dusts/TYSSparkle.cs index 6fc98c528f..d5f4fc4ab2 100644 --- a/Dusts/TYSSparkle.cs +++ b/Dusts/TYSSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class TYSSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.5f; - dust.alpha = 55; - dust.noGravity = false; - dust.noLight = false; - dust.scale = 0.75f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity * 1.5f; - dust.rotation += dust.velocity.X * 1.1f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.5f, 0.05f, 0.05f); - if (dust.scale < 0.25f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class TYSSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.5f; + dust.alpha = 55; + dust.noGravity = false; + dust.noLight = false; + dust.scale = 0.75f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity * 1.5f; + dust.rotation += dust.velocity.X * 1.1f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.5f, 0.05f, 0.05f); + if (dust.scale < 0.25f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Dusts/WBSparkle.cs b/Dusts/WBSparkle.cs index c6b831dcb6..bda7d43896 100644 --- a/Dusts/WBSparkle.cs +++ b/Dusts/WBSparkle.cs @@ -1,30 +1,30 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class WBSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.5f; - } - - 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.2f, 0.6f, 1.0f); - if(dust.scale < 0.1f) - { - dust.active = false; - } - return false; - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class WBSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.5f; + } + + 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.2f, 0.6f, 1.0f); + if(dust.scale < 0.1f) + { + dust.active = false; + } + return false; + } }} \ No newline at end of file diff --git a/Gores/Cryo Minion gore 1.png b/Gores/Cryo Minion gore 1.png new file mode 100644 index 0000000000..e63a1f27e0 Binary files /dev/null and b/Gores/Cryo Minion gore 1.png differ diff --git a/Gores/Cryo Minion gore 2.png b/Gores/Cryo Minion gore 2.png new file mode 100644 index 0000000000..cbf2143aa0 Binary files /dev/null and b/Gores/Cryo Minion gore 2.png differ diff --git a/Gores/Cryo spirit gore 1.png b/Gores/Cryo spirit gore 1.png new file mode 100644 index 0000000000..91cf54199d Binary files /dev/null and b/Gores/Cryo spirit gore 1.png differ diff --git a/Gores/Large Perf Gore 1.png b/Gores/Large Perf Gore 1.png new file mode 100644 index 0000000000..36a21be47e Binary files /dev/null and b/Gores/Large Perf Gore 1.png differ diff --git a/Gores/Large Perf Gore 2.png b/Gores/Large Perf Gore 2.png new file mode 100644 index 0000000000..c449ccb9f7 Binary files /dev/null and b/Gores/Large Perf Gore 2.png differ diff --git a/Gores/Large Perf Gore 3.png b/Gores/Large Perf Gore 3.png new file mode 100644 index 0000000000..4a77ee1e3d Binary files /dev/null and b/Gores/Large Perf Gore 3.png differ diff --git a/Gores/Large Perf Gore 4.png b/Gores/Large Perf Gore 4.png new file mode 100644 index 0000000000..a271f8fc44 Binary files /dev/null and b/Gores/Large Perf Gore 4.png differ diff --git a/Gores/Large Perf Gore 5.png b/Gores/Large Perf Gore 5.png new file mode 100644 index 0000000000..3874a77fe5 Binary files /dev/null and b/Gores/Large Perf Gore 5.png differ diff --git a/Gores/Medium Perf Gore 1.png b/Gores/Medium Perf Gore 1.png new file mode 100644 index 0000000000..2d86489dd3 Binary files /dev/null and b/Gores/Medium Perf Gore 1.png differ diff --git a/Gores/Medium Perf Gore 2.png b/Gores/Medium Perf Gore 2.png new file mode 100644 index 0000000000..6036a22f6a Binary files /dev/null and b/Gores/Medium Perf Gore 2.png differ diff --git a/Gores/Medium Perf Gore 3.png b/Gores/Medium Perf Gore 3.png new file mode 100644 index 0000000000..f50e28a651 Binary files /dev/null and b/Gores/Medium Perf Gore 3.png differ diff --git a/Gores/Medium Perf Gore 4.png b/Gores/Medium Perf Gore 4.png new file mode 100644 index 0000000000..f10ace6ecb Binary files /dev/null and b/Gores/Medium Perf Gore 4.png differ diff --git a/Gores/MiniPerf Gore 1.png b/Gores/MiniPerf Gore 1.png new file mode 100644 index 0000000000..b1376f81da Binary files /dev/null and b/Gores/MiniPerf Gore 1.png differ diff --git a/Gores/MiniPerf Gore 2.png b/Gores/MiniPerf Gore 2.png new file mode 100644 index 0000000000..21b62e1a63 Binary files /dev/null and b/Gores/MiniPerf Gore 2.png differ diff --git a/Gores/MiniPerf Gore 3.png b/Gores/MiniPerf Gore 3.png new file mode 100644 index 0000000000..36fcb5736e Binary files /dev/null and b/Gores/MiniPerf Gore 3.png differ diff --git a/Gores/Small Perf Gore 1.png b/Gores/Small Perf Gore 1.png new file mode 100644 index 0000000000..bc1a9eec84 Binary files /dev/null and b/Gores/Small Perf Gore 1.png differ diff --git a/Gores/Small Perf Gore 2.png b/Gores/Small Perf Gore 2.png new file mode 100644 index 0000000000..7a88e18d04 Binary files /dev/null and b/Gores/Small Perf Gore 2.png differ diff --git a/Gores/Small Perf Gore 3.png b/Gores/Small Perf Gore 3.png new file mode 100644 index 0000000000..a452238a80 Binary files /dev/null and b/Gores/Small Perf Gore 3.png differ diff --git a/Gores/perf_hive_gore_1.png b/Gores/perf_hive_gore_1.png new file mode 100644 index 0000000000..95cbe86cfe Binary files /dev/null and b/Gores/perf_hive_gore_1.png differ diff --git a/Gores/perf_hive_gore_2.png b/Gores/perf_hive_gore_2.png new file mode 100644 index 0000000000..6ccbbc8fb8 Binary files /dev/null and b/Gores/perf_hive_gore_2.png differ diff --git a/Gores/perf_hive_gore_3.png b/Gores/perf_hive_gore_3.png new file mode 100644 index 0000000000..67ab9cb809 Binary files /dev/null and b/Gores/perf_hive_gore_3.png differ diff --git a/Gores/perf_hive_gore_4.png b/Gores/perf_hive_gore_4.png new file mode 100644 index 0000000000..e9d6776bf1 Binary files /dev/null and b/Gores/perf_hive_gore_4.png differ diff --git a/Injections.cs b/Injections.cs index bd0842b2f4..0415d4fea9 100644 --- a/Injections.cs +++ b/Injections.cs @@ -1,114 +1,114 @@ -using System; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; - -using Terraria; -using Terraria.ModLoader; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace CalamityMod -{ - public static class Injections - { - public static void Load() - { - DoSwaps(); - } - - public static void Unload() - { - DoSwaps(); - } - - public static void DoSwaps() - { - try - { - if (!Main.dedServ) - Swap(typeof(Main), "checkMap", "NewCheckMap"); - } - catch - { - ErrorLogger.Log("CalamityMod: Error DoSwaps()"); - } - } - - public static void Swap(Type type, string oldMethod, string newMethod) - { - BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - - RuntimeMethodHandle previousMethodHandle; - RuntimeMethodHandle newMethodHandle; - - Type t = typeof(Injections); - - previousMethodHandle = type.GetMethod(oldMethod, flags).MethodHandle; - newMethodHandle = t.GetMethod(newMethod, flags).MethodHandle; - - RuntimeHelpers.PrepareMethod(previousMethodHandle); - RuntimeHelpers.PrepareMethod(newMethodHandle); - - IntPtr ptr = previousMethodHandle.Value + IntPtr.Size * 2; - IntPtr ptr2 = newMethodHandle.Value + IntPtr.Size * 2; - - int value = ptr.ToInt32(); - Marshal.WriteInt32(ptr, Marshal.ReadInt32(ptr2)); - Marshal.WriteInt32(ptr2, Marshal.ReadInt32(new IntPtr(value))); - } - - public static bool NewCheckMap(int i, int j) - { - MessageBox.Show("checking map"); - if (Main.instance.mapTarget[i, j] == null || Main.instance.mapTarget[i, j].IsDisposed) - { - Main.initMap[i, j] = false; - } - if (!Main.initMap[i, j]) - { - try - { - int width = Main.textureMaxWidth; - int height = Main.textureMaxHeight; - if (i == Main.mapTargetX - 1) - { - width = Main.maxTilesX % Main.textureMaxWidth; - } - if (j == Main.mapTargetY - 1) - { - height = Main.maxTilesY % Main.textureMaxHeight; - } - Main.instance.mapTarget[i, j] = new RenderTarget2D(Main.instance.GraphicsDevice, width, height, false, Main.instance.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth16, 0, RenderTargetUsage.PreserveContents); - } - catch - { - Main.mapEnabled = false; - for (int k = 0; k < Main.mapTargetX; k++) - { - for (int l = 0; l < Main.mapTargetY; l++) - { - try - { - Main.initMap[k, l] = false; - Main.instance.mapTarget[k, l].Dispose(); - } - catch - { - } - } - } - return false; - } - Main.initMap[i, j] = true; - return true; - } - return true; - } - } -} +using System; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +using Terraria; +using Terraria.ModLoader; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod +{ + public static class Injections + { + public static void Load() + { + DoSwaps(); + } + + public static void Unload() + { + DoSwaps(); + } + + public static void DoSwaps() + { + try + { + if (!Main.dedServ) + Swap(typeof(Main), "checkMap", "NewCheckMap"); + } + catch + { + ErrorLogger.Log("CalamityMod: Error DoSwaps()"); + } + } + + public static void Swap(Type type, string oldMethod, string newMethod) + { + BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; + + RuntimeMethodHandle previousMethodHandle; + RuntimeMethodHandle newMethodHandle; + + Type t = typeof(Injections); + + previousMethodHandle = type.GetMethod(oldMethod, flags).MethodHandle; + newMethodHandle = t.GetMethod(newMethod, flags).MethodHandle; + + RuntimeHelpers.PrepareMethod(previousMethodHandle); + RuntimeHelpers.PrepareMethod(newMethodHandle); + + IntPtr ptr = previousMethodHandle.Value + IntPtr.Size * 2; + IntPtr ptr2 = newMethodHandle.Value + IntPtr.Size * 2; + + int value = ptr.ToInt32(); + Marshal.WriteInt32(ptr, Marshal.ReadInt32(ptr2)); + Marshal.WriteInt32(ptr2, Marshal.ReadInt32(new IntPtr(value))); + } + + public static bool NewCheckMap(int i, int j) + { + MessageBox.Show("checking map"); + if (Main.instance.mapTarget[i, j] == null || Main.instance.mapTarget[i, j].IsDisposed) + { + Main.initMap[i, j] = false; + } + if (!Main.initMap[i, j]) + { + try + { + int width = Main.textureMaxWidth; + int height = Main.textureMaxHeight; + if (i == Main.mapTargetX - 1) + { + width = Main.maxTilesX % Main.textureMaxWidth; + } + if (j == Main.mapTargetY - 1) + { + height = Main.maxTilesY % Main.textureMaxHeight; + } + Main.instance.mapTarget[i, j] = new RenderTarget2D(Main.instance.GraphicsDevice, width, height, false, Main.instance.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth16, 0, RenderTargetUsage.PreserveContents); + } + catch + { + Main.mapEnabled = false; + for (int k = 0; k < Main.mapTargetX; k++) + { + for (int l = 0; l < Main.mapTargetY; l++) + { + try + { + Main.initMap[k, l] = false; + Main.instance.mapTarget[k, l].Dispose(); + } + catch + { + } + } + } + return false; + } + Main.initMap[i, j] = true; + return true; + } + return true; + } + } +} diff --git a/Items/AbyssItems/AbyssalAmulet.cs b/Items/AbyssItems/AbyssalAmulet.cs index 1dbaf5a936..76e4d51a2e 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 = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.abyssalAmulet = 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.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 = 50000; + 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 diff --git a/Items/AbyssItems/AbyssalDivingGear.cs b/Items/AbyssItems/AbyssalDivingGear.cs index bc21596895..f1975595df 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 = 250000; - 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(); - } - } +using System; +using 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 = 250000; + 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 diff --git a/Items/AbyssItems/AlluringBait.cs b/Items/AbyssItems/AlluringBait.cs index f49651c01a..6dd709286b 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 = 50000; - 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; } - } - } +using System; +using 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 = 50000; + 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 diff --git a/Items/AbyssItems/AnechoicPlating.cs b/Items/AbyssItems/AnechoicPlating.cs index 8a46cbadef..2030975a02 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 = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.anechoicPlating = 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.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 = 50000; + 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 diff --git a/Items/AbyssItems/CloakingGland.cs b/Items/AbyssItems/CloakingGland.cs index 12672c973f..f33b552236 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 = 3000; - item.rare = 3; - } - } +using System; +using 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 = 3000; + item.rare = 3; + } + } } \ No newline at end of file diff --git a/Items/AbyssItems/DepthCells.cs b/Items/AbyssItems/DepthCells.cs index 623e730583..6081e51df4 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 = 10000; - item.rare = 3; - } - } +using System; +using 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 = 10000; + item.rare = 3; + } + } } \ No newline at end of file diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs index c445944734..bd0012df06 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 abyss"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.depthCharm = 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.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 abyss"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 50000; + 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 diff --git a/Items/AbyssItems/IronBoots.cs b/Items/AbyssItems/IronBoots.cs index c02ae2c835..3573d11dcd 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 = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ironBoots = 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.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 = 50000; + 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 diff --git a/Items/AbyssItems/Lumenite.cs b/Items/AbyssItems/Lumenite.cs index 40dea3d744..b1c9d36e58 100644 --- a/Items/AbyssItems/Lumenite.cs +++ b/Items/AbyssItems/Lumenite.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 Lumenite : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lumenyl"); - Tooltip.SetDefault("A shard of lumenous energy"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = 10000; - item.rare = 3; - } - } +using System; +using 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.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = 10000; + item.rare = 3; + } + } } \ No newline at end of file diff --git a/Items/AbyssItems/LumenousAmulet.cs b/Items/AbyssItems/LumenousAmulet.cs index 3a66fbb17b..c56e97ed68 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 15% 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 = 150000; - 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(); - } - } +using System; +using 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 15% 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 = 150000; + 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 diff --git a/Items/AbyssItems/ReaperTooth.cs b/Items/AbyssItems/ReaperTooth.cs index a9eea2f8f0..b9888ba420 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 = 100000; - item.rare = 8; - } - } +using System; +using 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 = 100000; + item.rare = 8; + } + } } \ No newline at end of file diff --git a/Items/AbyssItems/ReaperToothNecklace.cs b/Items/AbyssItems/ReaperToothNecklace.cs index 94aeebe0d9..e4d98caa8b 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 and critical strike chance by 25%\n" + - "Cuts your defense and damage reduction in half"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 500000; - 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(); - } - } +using System; +using 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 and critical strike chance by 25%\n" + + "Cuts your defense and damage reduction in half"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 500000; + 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 diff --git a/Items/AbyssItems/StrangeOrb.cs b/Items/AbyssItems/StrangeOrb.cs index a168b28067..2858223bd4 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 in the abyss"); - } - - 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); - } - } - } +using System; +using 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 in the abyss"); + } + + 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 diff --git a/Items/AbyssItems/SunkenStew.cs b/Items/AbyssItems/SunkenStew.cs index 7537cb2669..54edde63f3 100644 --- a/Items/AbyssItems/SunkenStew.cs +++ b/Items/AbyssItems/SunkenStew.cs @@ -1,62 +1,62 @@ -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"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.healLife = 120; - item.healMana = 150; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 3; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - //item.potion = true; - item.buffType = 26; - item.buffTime = 216000; - item.value = 10000; - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool UseItem(Player player) - { - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2220 : 3000)); - return true; - } - - 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(); - } - } +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"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.healLife = 120; + item.healMana = 150; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 3; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + //item.potion = true; + item.buffType = 26; + item.buffTime = 216000; + item.value = 10000; + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool UseItem(Player player) + { + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2220 : 3000)); + return true; + } + + 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 diff --git a/Items/AbyssItems/TorrentialTear.cs b/Items/AbyssItems/TorrentialTear.cs index 3cdcf4255e..3eab676962 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; - } - } +using System; +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 diff --git a/Items/AbyssalWarhammer.cs b/Items/AbyssalWarhammer.cs index c7884ca14a..c13f0d88f7 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 = 8; - item.value = 550000; - 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, 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 +{ + 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 = 8; + item.value = 550000; + 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, 100); + } + } } \ No newline at end of file diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 35438013fb..1162cc9bd2 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 = 150000; - 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(); - } - } +using System; +using 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 = 150000; + 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 diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 7d902caeb7..b7ea05670e 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.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.Accessories -{ - public class AmalgamatedBrain : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amalgamated Brain"); - Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\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 = 300000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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.1f; - player.magicDamage += 0.1f; - player.rangedDamage += 0.1f; - player.thrownDamage += 0.1f; - player.minionDamage += 0.1f; - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 5; - } - - 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(); - } - } +using System; +using 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 AmalgamatedBrain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amalgamated Brain"); + Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\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 = 300000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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.1f; + player.magicDamage += 0.1f; + player.rangedDamage += 0.1f; + player.thrownDamage += 0.1f; + player.minionDamage += 0.1f; + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 5; + } + + 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 diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index b07a61eb15..881c1f3529 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.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 -{ - public class AmbrosialAmpoule : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ambrosial Ampoule"); - Tooltip.SetDefault("50% increased mining speed\n" + - "You emit light\n" + - "6% increased damage reduction and increased life regen\n" + - "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + - "Honey 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 = 5000000; - 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.AddTile(TileID.LunarCraftingStation); - 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.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.Accessories +{ + public class AmbrosialAmpoule : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ambrosial Ampoule"); + Tooltip.SetDefault("50% 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 = 5000000; + 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.AddTile(TileID.LunarCraftingStation); + 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.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 61eb70039a..e5b24c31fa 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.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 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 = 10000; - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aSpark = 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 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 = 10000; + 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 diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 9c58e7d53c..afc38bae09 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.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.Accessories { -public class AncientFossil : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Fossil"); - Tooltip.SetDefault("Increases pick speed by 35% while underground"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 5000; - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) - { - player.pickSpeed -= 0.35f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("SiltGroup", 100); - recipe.AddTile(TileID.Furnaces); - 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.Accessories { +public class AncientFossil : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Fossil"); + Tooltip.SetDefault("Increases pick speed by 35% while underground"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 5000; + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) + { + player.pickSpeed -= 0.35f; + } + } + + 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 diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index f9e3177dd9..d8968dcf6e 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 = 500000; - 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 += 420; - } - - 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(); - } - } +using System; +using 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 = 500000; + 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 += 420; + } + + 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 diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 3fcc61285d..3736766c65 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.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 ArcanumoftheVoid : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arcanum of the Void"); - Tooltip.SetDefault("You have a 10% 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 = 1500000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.projRef = 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 ArcanumoftheVoid : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arcanum of the Void"); + Tooltip.SetDefault("You have a 10% 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 = 1500000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.projRef = true; + } + } } \ No newline at end of file diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 5fecc1bea9..ff20ad3b83 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("50% 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 = 50000; - 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.5f; - } - } - - 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(); - } - } +using System; +using 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("50% 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 = 50000; + 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.5f; + } + } + + 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 diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 7bbbcef425..2bb37275ad 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.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.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 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" + - "12% damage reduction while submerged in liquid\n" + - "Increased defense by 10 when below 25% life\n" + - "Toggle visibility of this accessory to enable/disable the dash"); - } - - public override void SetDefaults() - { - item.width = 60; - item.height = 54; - item.value = 10000000; - item.defense = 10; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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.lifeRegen += 3; - 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 (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) { player.statDefense += 10; } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.12f; } - } - - 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(); - } - } +using System; +using 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 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" + + "10% damage reduction while submerged in liquid\n" + + "Increased defense by 10 when below 25% life\n" + + "Toggle visibility of this accessory to enable/disable the dash"); + } + + public override void SetDefaults() + { + item.width = 60; + item.height = 54; + item.value = 10000000; + item.defense = 10; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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.lifeRegen += 1; + 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 (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) { player.statDefense += 10; } + 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 diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 0acf90f685..a479b07937 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.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 -{ - [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" + - "12% damage reduction while submerged in liquid\n" + - "Increased defense by 10 when below 25% life\n" + - "+20 max life and increased life regen\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 = 5000000; - item.rare = 9; - item.defense = 5; - 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.lifeRegen += 2; - player.statLifeMax2 += 20; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) { player.statDefense += 10; } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.12f; } - } - - 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(); - } - } +using System; +using 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" + + "Increased defense by 10 when below 25% life\n" + + "+20 max life and increased life regen\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 = 5000000; + item.rare = 9; + item.defense = 5; + 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.lifeRegen += 1; + player.statLifeMax2 += 20; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) { player.statDefense += 10; } + 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 diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index 458fab3dfe..100aac8011 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.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.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 10% 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 40 defense\n" + - "Press O to toggle teleportation UI"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 1000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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(); - } - } +using System; +using 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 10% 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 40 defense\n" + + "Press O to toggle teleportation UI"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 1000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index f844766a09..281ae553cd 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.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.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 = 100000; - item.expert = true; - 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; - } +using System; +using 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 = 100000; + item.expert = true; + 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 diff --git a/Items/Accessories/AureateWings.cs b/Items/Accessories/AureateWings.cs index 60d3747837..f63cf5bc5e 100644 --- a/Items/Accessories/AureateWings.cs +++ b/Items/Accessories/AureateWings.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class AureateWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureate Booster"); - Tooltip.SetDefault("Mach speed with style!\n" + - "Good acceleration: 2\n" + - "Good flight time: 90"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 500000; - item.rare = 6; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - player.rocketDelay2--; - if (player.rocketDelay2 <= 0) - { - Main.PlaySound(SoundID.Item13, player.position); - player.rocketDelay2 = 60; - } - int num66 = 2; - if (player.controlUp) - { - num66 = 4; - } - for (int num67 = 0; num67 < num66; num67++) - { - int type = 6; - if (player.head == 41) - { - int arg_58FD_0 = player.body; - } - float scale = 1.75f; - int alpha = 100; - float x = player.position.X + (float)(player.width / 2) + 16f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 26f; - } - float num68 = player.position.Y + (float)player.height - 18f; - if (num67 == 1 || num67 == 3) - { - x = player.position.X + (float)(player.width / 2) + 8f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 20f; - } - num68 += 6f; - } - if (num67 > 1) - { - num68 += player.velocity.Y; - } - int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default(Color), scale); - Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; - Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; - Main.dust[num69].noGravity = true; - Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - if (num66 == 4) - { - Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; - } - } - } - player.wingTimeMax = 90; - } - - 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 = 10f; - acceleration *= 2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 5); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class AureateWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureate Booster"); + Tooltip.SetDefault("Mach speed with style!\n" + + "Good acceleration: 2\n" + + "Good flight time: 90"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 500000; + item.rare = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + player.rocketDelay2--; + if (player.rocketDelay2 <= 0) + { + Main.PlaySound(SoundID.Item13, player.position); + player.rocketDelay2 = 60; + } + int num66 = 2; + if (player.controlUp) + { + num66 = 4; + } + for (int num67 = 0; num67 < num66; num67++) + { + int type = 6; + if (player.head == 41) + { + int arg_58FD_0 = player.body; + } + float scale = 1.75f; + int alpha = 100; + float x = player.position.X + (float)(player.width / 2) + 16f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 26f; + } + float num68 = player.position.Y + (float)player.height - 18f; + if (num67 == 1 || num67 == 3) + { + x = player.position.X + (float)(player.width / 2) + 8f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 20f; + } + num68 += 6f; + } + if (num67 > 1) + { + num68 += player.velocity.Y; + } + int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default(Color), scale); + Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; + expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; + Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; + Main.dust[num69].noGravity = true; + Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + if (num66 == 4) + { + Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; + expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; + } + } + } + player.wingTimeMax = 90; + } + + 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 = 10f; + acceleration *= 2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 5); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 34ebb4f48f..b4c039029d 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.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.Accessories -{ - public class BadgeofBravery : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Badge of Bravery"); - Tooltip.SetDefault("The lower the health the greater the melee speed"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.value = 150000; - item.accessory = true; - } - - 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 void UpdateAccessory(Player player, bool hideVisual) - { - if (player.statLife <= (player.statLifeMax2 * 0.8f) && player.statLife > (player.statLifeMax2 * 0.6f)) - { - player.meleeSpeed += 0.05f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.6f) && player.statLife > (player.statLifeMax2 * 0.4f)) - { - player.meleeSpeed += 0.1f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.4f) && player.statLife > (player.statLifeMax2 * 0.2f)) - { - player.meleeSpeed += 0.15f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.2f)) - { - player.meleeSpeed += 0.2f; - } - } - - 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(); - } - } +using System; +using 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("The lower the health the greater the melee speed"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.value = 150000; + item.accessory = true; + } + + 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 void UpdateAccessory(Player player, bool hideVisual) + { + if (player.statLife <= (player.statLifeMax2 * 0.8f) && player.statLife > (player.statLifeMax2 * 0.6f)) + { + player.meleeSpeed += 0.05f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.6f) && player.statLife > (player.statLifeMax2 * 0.4f)) + { + player.meleeSpeed += 0.1f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.4f) && player.statLife > (player.statLifeMax2 * 0.2f)) + { + player.meleeSpeed += 0.15f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.2f)) + { + player.meleeSpeed += 0.2f; + } + } + + 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(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 0d1971a0aa..0f701cf0b9 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("You have a damaging life-draining aura around you\n" + - "When below 50% life you gain 10% increased damage reduction, 10% increased damage, and 10% increased critical strike chance\n" + - "When below 15% life you gain 15% increased damage reduction, 15% increased damage, and 15% increased critical strike chance\n" + - "When below 100 defense you gain 15% increased damage"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 2500000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareCore = 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 BloodflareCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Core"); + Tooltip.SetDefault("You have a damaging life-draining aura around you\n" + + "When below 50% life you gain 5% increased damage reduction, 10% increased damage, and 10% increased critical strike chance\n" + + "When below 15% life you gain 10% increased damage reduction, 15% increased damage, and 15% increased critical strike chance\n" + + "When below 100 defense you gain 15% increased damage"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 2500000; + item.expert = true; + 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 diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 7fc5729a4e..4ae97e82ba 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.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 -{ - [AutoloadEquip(EquipType.Neck)] - public class BloodyWormScarf : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Scarf"); - Tooltip.SetDefault("15% increased damage reduction and increased melee stats"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 42; - item.value = 500000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.meleeDamage += 0.1f; - player.meleeSpeed += 0.1f; - player.endurance += 0.15f; - } - - 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(); - } - } +using System; +using 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 = 500000; + item.expert = true; + 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 diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index a68aae4df5..b01c1b8981 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -1,55 +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.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"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = 150000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - 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.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(ItemID.LeadBar, 7); - 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.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 = 150000; + 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.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.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddIngredient(ItemID.LeadBar, 7); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index b38e4e2905..54ef80c656 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 = 500000; - 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(); - } - } +using System; +using 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 = 500000; + 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 diff --git a/Items/Accessories/CelestialTracers.cs b/Items/Accessories/CelestialTracers.cs index 66eb4fb3ce..8d511b3dbd 100644 --- a/Items/Accessories/CelestialTracers.cs +++ b/Items/Accessories/CelestialTracers.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.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class CelestialTracers : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Excellent acceleration: 3\n" + - "Excellent flight time: 280\n" + - "Taking speed EVEN FURTHER BEYOND!\n" + - "Greater mobility on ice\n" + - "Water and lava walking\n" + - "Temporary immunity to lava\n" + - "Being hit for over 200 damage will make you immune for an extended period of time"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = 20000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.accRunSpeed = 12f; - player.rocketBoots = 3; - player.moveSpeed += 0.5f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 920; - player.wingTimeMax = 280; - modPlayer.IBoots = !hideVisual; - modPlayer.elysianFire = !hideVisual; - modPlayer.cTracers = true; - } - - 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 = 13f; - acceleration *= 3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ElysianTracers"); - recipe.AddIngredient(null, "DrewsWings"); - recipe.AddIngredient(null, "DarksunFragment", 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 Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class CelestialTracers : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Excellent acceleration: 3\n" + + "Excellent flight time: 280\n" + + "Taking speed EVEN FURTHER BEYOND!\n" + + "Greater mobility on ice\n" + + "Water and lava walking\n" + + "Temporary immunity to lava\n" + + "Being hit for over 200 damage will make you immune for an extended period of time"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = 20000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.accRunSpeed = 12f; + player.rocketBoots = 3; + player.moveSpeed += 0.5f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 920; + player.wingTimeMax = 280; + modPlayer.IBoots = !hideVisual; + modPlayer.elysianFire = !hideVisual; + modPlayer.cTracers = true; + } + + 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 = 13f; + acceleration *= 3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ElysianTracers"); + recipe.AddIngredient(null, "DrewsWings"); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 28ff3202c4..246d2a8364 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"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.lifeRegen = 2; - item.value = 150000; - item.rare = 8; - 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, "CruptixBar", 2); - recipe.AddIngredient(ItemID.SpelunkerPotion, 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.Accessories +{ + public class ChaosAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Amulet"); + Tooltip.SetDefault("Spelunker effect"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.lifeRegen = 2; + item.value = 150000; + item.rare = 8; + 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, "CruptixBar", 2); + recipe.AddIngredient(ItemID.SpelunkerPotion, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index 57c4c04054..57a966cfe3 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 playerName = player.name == "Fabsol"; - if (playerName) - { - modPlayer.lol = true; - } - else if (!player.immune) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, 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.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.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 diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index ab12b8dee3..64fe108e83 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("You have a damaging life-draining aura around you\n" + - "10% increased damage reduction\n" + - "12% increased damage and critical strike chance\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 15 second cooldown\n" + - "Boosts your max HP by 10%"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 10000000; - item.expert = true; - 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(); - } - } +using System; +using 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("You have a damaging life-draining aura around you\n" + + "5% increased damage reduction\n" + + "5% increased damage and critical strike chance\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 15 second cooldown\n" + + "Boosts your max HP by 10%"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 10000000; + item.expert = true; + 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 diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index a7b01c86c3..0e0bed4644 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.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 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 = 50000; - 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(); - } +using System; +using 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 = 50000; + 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 diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 0125361c72..2cc2d86848 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 melee damage, speed, and 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 = 50000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dodgeScarf = true; - modPlayer.dashMod = 1; - } - } +using System; +using 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 = 50000; + item.rare = 5; + 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 diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index ea1af3bfc2..9c8096b8df 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 = 30000; - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.endurance += 0.05f; - player.thorns = 0.25f; - } - } +using System; +using 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 = 30000; + 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 diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index 034a11dc67..077eb3ff26 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.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 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 = 50000; - 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(); - } +using System; +using 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 = 50000; + 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 diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index cffbf171bc..d15e2685f1 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 = 50000; - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.crownJewel = 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 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 = 50000; + 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 diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs index 2c731286a5..2a1f35584f 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, 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 = 5000000; - 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 += 10; - 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.SniperScope); - 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.Accessories +{ + public class DaedalusEmblem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Emblem"); + Tooltip.SetDefault("5% increased ranged damage, 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 = 5000000; + 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.05f; + 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.SniperScope); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index f690db9240..f01d30fb31 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.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.Accessories -{ - public class DarkSunRing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Sun Ring"); - Tooltip.SetDefault("Increase to damage, melee speed, critical strike chance, life regeneration,\n" + - "defense, pick speed, max minions, and minion knockback\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 = 5000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.darkSunRing = true; - player.maxMinions += 1; - player.lifeRegen += 2; - player.statDefense += 8; - player.meleeSpeed += 0.1f; - player.meleeDamage += 0.1f; - player.meleeCrit += 4; - player.rangedDamage += 0.1f; - player.rangedCrit += 4; - player.magicDamage += 0.1f; - player.magicCrit += 4; - player.pickSpeed -= 0.3f; - player.minionDamage += 0.1f; - player.minionKB += 1f; - player.thrownDamage += 0.1f; - player.thrownCrit += 4; - if (Main.dayTime) - { - player.lifeRegen += 3; - } - else - { - player.statDefense += 30; - } - } - - 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(); - } - } +using System; +using 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 DarkSunRing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Sun Ring"); + Tooltip.SetDefault("Increase to damage, melee speed, critical strike chance, life regeneration,\n" + + "defense, pick speed, max minions, and minion knockback\n" + + "During the day the player has +2 life regen\n" + + "During the night the player has +20 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 = 5000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.darkSunRing = true; + player.maxMinions += 1; + player.lifeRegen += 1; + player.statDefense += 5; + player.meleeSpeed += 0.05f; + player.meleeDamage += 0.05f; + player.meleeCrit += 5; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + player.magicDamage += 0.05f; + player.magicCrit += 5; + player.pickSpeed -= 0.3f; + player.minionDamage += 0.05f; + player.minionKB += 1f; + player.thrownDamage += 0.05f; + player.thrownCrit += 5; + if (Main.dayTime) + { + player.lifeRegen += 2; + } + else + { + player.statDefense += 20; + } + } + + 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 diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 251608a145..28859a5fc0 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.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.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" + - "Increases pickup range for mana stars and you restore mana when damaged"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = 1500000; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dAmulet = true; - player.panic = true; - player.armorPenetration += 25; - player.manaMagnet = true; - player.magicCuffs = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CelestialCuffs); - 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(); - } - } +using System; +using 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" + + "Increases pickup range for mana stars and you restore mana when damaged"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = 1500000; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dAmulet = true; + player.panic = true; + player.armorPenetration += 25; + player.manaMagnet = true; + player.magicCuffs = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CelestialCuffs); + 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 diff --git a/Items/Accessories/DiscordianWings.cs b/Items/Accessories/DiscordianWings.cs index 5691a8dbaa..166a042ca3 100644 --- a/Items/Accessories/DiscordianWings.cs +++ b/Items/Accessories/DiscordianWings.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class DiscordianWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Discordian Wings"); - Tooltip.SetDefault("Formed from the flames of pure chaos\nGood acceleration: 2\nExcellent flight time: 125"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 500000; - item.rare = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 125; - } - - 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 = 9f; - acceleration *= 2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 5); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class DiscordianWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Discordian Wings"); + Tooltip.SetDefault("Formed from the flames of pure chaos\nGood acceleration: 2\nExcellent flight time: 125"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 500000; + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 125; + } + + 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 = 9f; + acceleration *= 2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 5); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 2e94e13d1c..67aaaf2ac4 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.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.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" + - "You gain rage over time\n" + - "Gives immunity to the horror debuff\n" + - "Standing still regenerates your life quickly and boosts your defense by 50\n" + - "Nanomachines, son"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 5000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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(ItemID.LunarBar, 30); - 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.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" + + "You gain rage over time\n" + + "Gives immunity to the horror debuff\n" + + "Standing still regenerates your life quickly and boosts your defense by 50\n" + + "Nanomachines, son"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 5000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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(ItemID.LunarBar, 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/DrewsWings.cs b/Items/Accessories/DrewsWings.cs index ededab2926..4dbdb6d273 100644 --- a/Items/Accessories/DrewsWings.cs +++ b/Items/Accessories/DrewsWings.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class DrewsWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drew's Wings"); - Tooltip.SetDefault("Absolutely Fabulous\n" + - "Excellent acceleration: 3\n" + - "Excellent flight time: 361\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 10000000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 361; - } - - 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 = 13f; - acceleration *= 3f; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class DrewsWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drew's Wings"); + Tooltip.SetDefault("Absolutely Fabulous\n" + + "Excellent acceleration: 3\n" + + "Excellent flight time: 361\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 10000000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 361; + } + + 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 = 13f; + acceleration *= 3f; + } + } } \ No newline at end of file diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 6b05ae904a..290848d791 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.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.Accessories -{ - public class ElementalGauntlet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Gauntlet"); - Tooltip.SetDefault("Melee attacks inflict most debuffs\n" + - "15% increased melee speed, damage, and critical strike chance\n" + - "Increased invincibility after taking damage\n" + - "You are immune 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 = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eGauntlet = true; - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 15; - player.meleeSpeed += 0.15f; - player.lavaImmune = 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(); - } - } +using System; +using 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 inflict most debuffs\n" + + "10% increased melee speed, damage, and critical strike chance\n" + + "Increased invincibility after taking damage\n" + + "You are immune 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 = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eGauntlet = true; + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.meleeSpeed += 0.1f; + player.lavaImmune = 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 diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 5e2e7c8cf3..b7b473e16d 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.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 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" + - "15% increased ranged damage and critical strike chance\n" + - "Daedalus Emblem effects"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eQuiver = true; - player.rangedDamage += 0.15f; - player.rangedCrit += 15; - 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(); - } - } +using System; +using 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 critical strike chance\n" + + "Daedalus Emblem effects"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eQuiver = true; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + 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 diff --git a/Items/Accessories/ElysianTracers.cs b/Items/Accessories/ElysianTracers.cs index f34e2de160..b10a4a7f89 100644 --- a/Items/Accessories/ElysianTracers.cs +++ b/Items/Accessories/ElysianTracers.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class ElysianTracers : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elysian Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Excellent acceleration: 2.75\n" + - "Excellent flight time: 200\n" + - "Ludicrous 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 = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (Main.rand.Next(2) == 0 ? 206 : 173), 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.accRunSpeed = 10.5f; - player.rocketBoots = 3; - player.moveSpeed += 0.36f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 920; - player.wingTimeMax = 200; - modPlayer.IBoots = !hideVisual; - modPlayer.elysianFire = !hideVisual; - modPlayer.eTracers = true; - } - - 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 = 11f; - acceleration *= 2.75f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "InfinityBoots"); - recipe.AddIngredient(null, "ElysianWings"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class ElysianTracers : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elysian Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Excellent acceleration: 2.75\n" + + "Excellent flight time: 200\n" + + "Ludicrous 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 = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (Main.rand.Next(2) == 0 ? 206 : 173), 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.accRunSpeed = 10.5f; + player.rocketBoots = 3; + player.moveSpeed += 0.36f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 920; + player.wingTimeMax = 200; + modPlayer.IBoots = !hideVisual; + modPlayer.elysianFire = !hideVisual; + modPlayer.eTracers = true; + } + + 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 = 11f; + acceleration *= 2.75f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "InfinityBoots"); + recipe.AddIngredient(null, "ElysianWings"); + 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 diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 8a8a816d2e..fee3e83921 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.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.Accessories -{ - public class EtherealTalisman : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ethereal Talisman"); - Tooltip.SetDefault("15% increased magic damage, critical strike chance, and 20% decreased mana usage\n" + - "+150 max mana\n" + - "Increases life regen and reveals treasure locations\n" + - "Reduces the cooldown of healing potions\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 = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eTalisman = true; - player.findTreasure = true; - player.pStone = true; - player.manaFlower = true; - player.lifeRegen += 2; - player.statManaMax2 += 150; - player.magicDamage += 0.15f; - player.manaCost *= 0.8f; - player.magicCrit += 15; - } - - 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(); - } - } +using System; +using 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("10% increased magic damage, critical strike chance, and 10% decreased mana usage\n" + + "+150 max mana\n" + + "Increases life regen and reveals treasure locations\n" + + "Reduces the cooldown of healing potions\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 = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eTalisman = true; + player.findTreasure = true; + player.pStone = true; + player.manaFlower = true; + player.lifeRegen += 2; + player.statManaMax2 += 150; + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + player.magicCrit += 10; + } + + 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 diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 2fb118264c..546ddc0ae9 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 = 500000; - 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"), 45, 2f, Main.myPlayer, 0f, 0f); - } - } - } - } +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 = 500000; + 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"), 45, 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index 8f4b19eaee..6461d3855c 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.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.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 30% life that reduces damage\n" + - "The shell becomes more powerful when below 10% life and reduces damage even further"); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 44; - item.value = 5000000; - item.rare = 9; - item.defense = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.noKnockback = true; - if ((float)player.statLife > (float)player.statLifeMax2 * 0.25f) - { - 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 ((double)player.statLife <= (double)player.statLifeMax2 * 0.3) - { - player.AddBuff(62, 5, true); - } - if ((double)player.statLife <= (double)player.statLifeMax2 * 0.1) - { - player.endurance += 0.05f; - } - } - - 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(); - } - } +using System; +using 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 = 5000000; + item.rare = 9; + item.defense = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.noKnockback = true; + if ((float)player.statLife > (float)player.statLifeMax2 * 0.25f) + { + 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 ((double)player.statLife <= (double)player.statLifeMax2 * 0.5) + { + player.AddBuff(62, 5, true); + } + if ((double)player.statLife <= (double)player.statLifeMax2 * 0.15) + { + player.endurance += 0.05f; + } + } + + 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 diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index d6cf559d3d..10cf1ddaae 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 = 50000; - 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; - } - } +using System; +using 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 = 50000; + 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 diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 5f7d582894..2cafc3a260 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.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 -{ - 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 +2 life regen\n" + - "Being above 75% life grants the player 5% increased damage and critical strike chance\n" + - "Being below 25% life grants the player 20 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 = 2; - item.value = 500000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.frostFlare = true; - player.resistCold = true; - player.buffImmune[44] = true; - player.buffImmune[46] = true; - player.buffImmune[47] = true; - if (player.statLife > (player.statLifeMax2 * 0.75f)) - { - player.meleeDamage += 0.05f; - player.magicDamage += 0.05f; - player.rangedDamage += 0.05f; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 5; - } - if (player.statLife < (player.statLifeMax2 * 0.25f)) - { - player.statDefense += 20; - } - } - } +using System; +using 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 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 5% increased damage and critical strike chance\n" + + "Being below 25% life grants the player 20 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 = 500000; + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.frostFlare = true; + player.resistCold = true; + player.buffImmune[44] = true; + player.buffImmune[46] = true; + player.buffImmune[47] = true; + if (player.statLife > (player.statLifeMax2 * 0.75f)) + { + player.meleeDamage += 0.05f; + player.magicDamage += 0.05f; + player.rangedDamage += 0.05f; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 5; + } + if (player.statLife < (player.statLifeMax2 * 0.25f)) + { + player.statDefense += 20; + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index ce9afe3298..96b3de5e81 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 = 30000; - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fCarapace = 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 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 = 30000; + item.rare = 1; + 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 diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 0ba8cca097..aaec9948b3 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 = 30000; - 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; - } - } +using System; +using 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 = 30000; + 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 diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 6fbe08fc1a..42aed65bd8 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.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 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 = 100000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed -= 0.1f; - player.thorns = 0.25f; - } - } +using System; +using 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 = 100000; + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed -= 0.1f; + player.thorns = 0.25f; + } + } } \ No newline at end of file diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index 54348f2902..cd24f65192 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 = 150000; - 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(); - } - } +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 = 150000; + 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 diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 546199afd6..a857d53832 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 = 300000; - 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 += 5; - 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(); - } - } +using System; +using 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 = 300000; + 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 += 5; + 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 diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index eae7be81f2..7176203f65 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.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 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.lifeRegen = 2; - item.value = 50000; - 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(); - } - } +using System; +using 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.lifeRegen = 2; + item.value = 50000; + 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 diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 77b54fc22f..9b03520032 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.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 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" + - "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 = 1500000; - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.heartOfDarkness = 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 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" + + "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 = 1500000; + item.rare = 10; + 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 diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 9a3465cf97..2fea76c8e4 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -1,267 +1,256 @@ -using System; -using 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 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 2, and all damage and crit chance by 5%\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 waifus to protect you\n" + - "Toggling the visibility of this accessory also toggles the waifus on and off"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = 10000000; - item.defense = 6; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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)); - player.lifeRegen += 2; - player.statLifeMax2 += 20; - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 2.0f; - player.endurance += 0.05f; - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.meleeCrit += 5; - player.meleeDamage += 0.05f; - player.magicCrit += 5; - player.magicDamage += 0.05f; - player.rangedCrit += 5; - player.rangedDamage += 0.05f; - player.thrownCrit += 5; - player.thrownDamage += 0.05f; - player.minionDamage += 0.05f; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.brimstoneWaifu = true; - modPlayer.sandWaifu = true; - modPlayer.sandBoobWaifu = true; - modPlayer.cloudWaifu = true; - modPlayer.sirenWaifu = true; - modPlayer.elementalHeart = true; - if (player.whoAmI == Main.myPlayer && !hideVisual) - { - int damage = NPC.downedMoonlord ? 100 : 60; - 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("CloudWaifu")] > 1) - { - player.ClearBuff(mod.BuffType("BrimstoneWaifu")); - player.ClearBuff(mod.BuffType("SirenLure")); - player.ClearBuff(mod.BuffType("DrewsSandyWaifu")); - player.ClearBuff(mod.BuffType("SandyWaifu")); - player.ClearBuff(mod.BuffType("CloudyWaifu")); - } - 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)((float)damage * damageMult), 2f, Main.myPlayer, 0f, 0f); - } - 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"), 0, 0f, Main.myPlayer, 0f, 0f); - } - 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)((float)damage * damageMult), 2f, Main.myPlayer, 0f, 0f); - } - 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)((float)damage * damageMult), 2f, Main.myPlayer, 0f, 0f); - } - 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)((float)damage * damageMult), 2f, Main.myPlayer, 0f, 0f); - } - } - else - { - 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("CloudWaifu")] > 0) - { - player.ClearBuff(mod.BuffType("BrimstoneWaifu")); - player.ClearBuff(mod.BuffType("SirenLure")); - player.ClearBuff(mod.BuffType("DrewsSandyWaifu")); - player.ClearBuff(mod.BuffType("SandyWaifu")); - player.ClearBuff(mod.BuffType("CloudyWaifu")); - } - } - 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); - } - } - } - } - } - - 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; + +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 2, and all damage and crit chance by 5%\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 waifus to protect you\n" + + "Toggling the visibility of this accessory also toggles the waifus on and off\n" + + "Stat increases are slightly higher if the waifus are turned off"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = 10000000; + item.defense = 6; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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 += 2; + player.statLifeMax2 += 20; + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 2.0f; + player.endurance += 0.05f; + player.statManaMax2 += 50; + player.manaCost *= 0.95f; + player.meleeCrit += 5; + player.meleeDamage += 0.05f; + player.magicCrit += 5; + player.magicDamage += 0.05f; + player.rangedCrit += 5; + player.rangedDamage += 0.05f; + player.thrownCrit += 5; + player.thrownDamage += 0.05f; + player.minionDamage += 0.05f; + 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("CloudWaifu")] > 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), 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"), 0, 0f, 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), 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), 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), 2f, Main.myPlayer, 0f, 0f); + } + } + else + { + player.lifeRegen += 3; + player.statLifeMax2 += 25; + player.moveSpeed += 0.12f; + player.jumpSpeedBoost += 2.2f; + player.endurance += 0.06f; + player.statManaMax2 += 60; + player.manaCost *= 0.93f; + player.meleeCrit += 6; + player.meleeDamage += 0.06f; + player.magicCrit += 6; + player.magicDamage += 0.06f; + player.rangedCrit += 6; + player.rangedDamage += 0.06f; + player.thrownCrit += 6; + player.thrownDamage += 0.06f; + player.minionDamage += 0.06f; + 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("CloudWaifu")] > 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 2f6444ac11..8c57fcf6e3 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("10% increased damage reduction, +5 defense, and increased life regen while in the Jungle\n" + - "Poison and Venom immunity\n" + - "Honey 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 = 500000; - 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 += 2; - player.statDefense += 5; - player.endurance += 0.1f; - } - player.buffImmune[70] = true; - player.buffImmune[20] = true; - if (!player.honey && player.lifeRegen < 0) - { - player.lifeRegen += 4; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 2; - 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(); - } - } +using System; +using 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 = 500000; + 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 += 2; + player.statDefense += 5; + player.endurance += 0.05f; + } + player.buffImmune[70] = true; + player.buffImmune[20] = true; + if (!player.honey && player.lifeRegen < 0) + { + player.lifeRegen += 3; + 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 diff --git a/Items/Accessories/InfinityBoots.cs b/Items/Accessories/InfinityBoots.cs index 0fdb196524..2f6823066a 100644 --- a/Items/Accessories/InfinityBoots.cs +++ b/Items/Accessories/InfinityBoots.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings, EquipType.Shoes)] - public class InfinityBoots : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seraph Tracers"); - Tooltip.SetDefault("Counts as wings\n" + - "Excellent acceleration: 2.25\n" + - "Excellent flight time: 120\n" + - "Ludicrous 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 = 5000000; - item.accessory = true; - } - - 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 void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.accRunSpeed = 9.25f; - player.rocketBoots = 3; - player.moveSpeed += 0.24f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 920; - player.wingTimeMax = 120; - modPlayer.IBoots = !hideVisual; - modPlayer.sTracers = true; - } - - 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 = 10f; - acceleration *= 2.25f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("WingsGroup"); - recipe.AddIngredient(null, "AngelTreads"); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddIngredient(null, "BarofLife", 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 Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings, EquipType.Shoes)] + public class InfinityBoots : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seraph Tracers"); + Tooltip.SetDefault("Counts as wings\n" + + "Excellent acceleration: 2.25\n" + + "Excellent flight time: 120\n" + + "Ludicrous 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 = 5000000; + item.accessory = true; + } + + 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 void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.accRunSpeed = 9.25f; + player.rocketBoots = 3; + player.moveSpeed += 0.24f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 920; + player.wingTimeMax = 120; + modPlayer.IBoots = !hideVisual; + modPlayer.sTracers = true; + } + + 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 = 10f; + acceleration *= 2.25f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("WingsGroup"); + recipe.AddIngredient(null, "AngelTreads"); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index ec086688fc..67c807d13e 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 and crit chance by 6%, \n" + - "defense by 8, 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 = 50000; - 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; - } - } +using System; +using 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 and crit chance by 6%, \n" + + "defense by 8, 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 = 50000; + 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 diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index d49d8636ec..76c433edfd 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -1,32 +1,32 @@ -using System; -using 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 irradiated debuff"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 10; - item.value = 150000; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.buffImmune[mod.BuffType("Irradiated")] = 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 LeadCore : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lead Core"); + Tooltip.SetDefault("Grants immunity to the irradiated debuff"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 10; + item.value = 150000; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.buffImmune[mod.BuffType("Irradiated")] = true; + } }} \ No newline at end of file diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index be68250e25..a902eb286f 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 = 30000; - 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 += 5; - } - } - } +using System; +using 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 = 30000; + 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 += 5; + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 57725ce397..e9310670d6 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("10% 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 = 500000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneJungle) - { - player.lifeRegen += 2; - player.statDefense += 5; - player.endurance += 0.1f; - } - } - - 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(); - } - } +using System; +using 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 = 500000; + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneJungle) + { + player.lifeRegen += 2; + 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 diff --git a/Items/Accessories/MLGRune.cs b/Items/Accessories/MLGRune.cs index ccd090e9e9..ad0cb9c898 100644 --- a/Items/Accessories/MLGRune.cs +++ b/Items/Accessories/MLGRune.cs @@ -1,40 +1,40 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Accessories -{ - public class MLGRune : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demon Trophy"); - Tooltip.SetDefault("Boosts spawn rate by 1.25 times\n" + - "Effects cannot be reversed"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 99; - item.rare = 1; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = true; - } - - public override bool UseItem(Player player) - { - CalamityWorld.demonMode = true; - return true; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Accessories +{ + public class MLGRune : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon Trophy"); + Tooltip.SetDefault("Boosts spawn rate by 1.25 times\n" + + "Effects cannot be reversed"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 99; + item.rare = 1; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = true; + } + + public override bool UseItem(Player player) + { + CalamityWorld.demonMode = true; + return true; + } + } } \ No newline at end of file diff --git a/Items/Accessories/MLGRune2.cs b/Items/Accessories/MLGRune2.cs index b521225c6f..5d1e5e6830 100644 --- a/Items/Accessories/MLGRune2.cs +++ b/Items/Accessories/MLGRune2.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Accessories -{ - public class MLGRune2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Onion"); - Tooltip.SetDefault("Doesn't do anything currently...or does it!?\n" + - "Consuming it does something that cannot be reversed"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.expert = true; - item.maxStack = 99; - item.useAnimation = 30; - 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 (!Main.expertMode || modPlayer.extraAccessoryML) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) - { - player.itemTime = item.useTime; - modPlayer.extraAccessoryML = true; - if (!CalamityWorld.onionMode) - { - CalamityWorld.onionMode = true; - } - } - return true; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Accessories +{ + public class MLGRune2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Onion"); + Tooltip.SetDefault("Doesn't do anything currently...or does it!?\n" + + "Consuming it does something that cannot be reversed"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.expert = true; + item.maxStack = 99; + item.useAnimation = 30; + 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 (!Main.expertMode || modPlayer.extraAccessoryML) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) + { + player.itemTime = item.useTime; + modPlayer.extraAccessoryML = true; + if (!CalamityWorld.onionMode) + { + CalamityWorld.onionMode = true; + } + } + return true; + } + } } \ No newline at end of file diff --git a/Items/Accessories/MOAB.cs b/Items/Accessories/MOAB.cs index 5c5bcf6bab..5c168cb7e1 100644 --- a/Items/Accessories/MOAB.cs +++ b/Items/Accessories/MOAB.cs @@ -1,127 +1,127 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class MOAB : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("MOAB"); - Tooltip.SetDefault("The mother of all balloons\n" + - "Counts as wings\n" + - "Decent acceleration: 1.3\n" + - "Low flight time: 50"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 5000000; - item.rare = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - player.rocketDelay2--; - if (player.rocketDelay2 <= 0) - { - Main.PlaySound(SoundID.Item13, player.position); - player.rocketDelay2 = 60; - } - int num66 = 2; - if (player.controlUp) - { - num66 = 4; - } - for (int num67 = 0; num67 < num66; num67++) - { - int type = 6; - if (player.head == 41) - { - int arg_58FD_0 = player.body; - } - float scale = 1.75f; - int alpha = 100; - float x = player.position.X + (float)(player.width / 2) + 16f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 26f; - } - float num68 = player.position.Y + (float)player.height - 18f; - if (num67 == 1 || num67 == 3) - { - x = player.position.X + (float)(player.width / 2) + 8f; - if (player.direction > 0) - { - x = player.position.X + (float)(player.width / 2) - 20f; - } - num68 += 6f; - } - if (num67 > 1) - { - num68 += player.velocity.Y; - } - int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default(Color), scale); - Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; - expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; - Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; - Main.dust[num69].noGravity = true; - Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - if (num66 == 4) - { - Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; - expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; - } - } - } - player.doubleJumpCloud = true; - player.doubleJumpSandstorm = true; - player.doubleJumpBlizzard = true; - player.jumpBoost = true; - player.autoJump = true; - player.noFallDmg = true; - player.jumpSpeedBoost += 1.4f; - player.wingTimeMax = 50; - } - - 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 = 9f; - acceleration *= 1.3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrogLeg); - recipe.AddIngredient(ItemID.BundleofBalloons); - recipe.AddIngredient(ItemID.LuckyHorseshoe); - recipe.AddIngredient(ItemID.Jetpack); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class MOAB : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("MOAB"); + Tooltip.SetDefault("The mother of all balloons\n" + + "Counts as wings\n" + + "Decent acceleration: 1.3\n" + + "Low flight time: 50"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 5000000; + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + player.rocketDelay2--; + if (player.rocketDelay2 <= 0) + { + Main.PlaySound(SoundID.Item13, player.position); + player.rocketDelay2 = 60; + } + int num66 = 2; + if (player.controlUp) + { + num66 = 4; + } + for (int num67 = 0; num67 < num66; num67++) + { + int type = 6; + if (player.head == 41) + { + int arg_58FD_0 = player.body; + } + float scale = 1.75f; + int alpha = 100; + float x = player.position.X + (float)(player.width / 2) + 16f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 26f; + } + float num68 = player.position.Y + (float)player.height - 18f; + if (num67 == 1 || num67 == 3) + { + x = player.position.X + (float)(player.width / 2) + 8f; + if (player.direction > 0) + { + x = player.position.X + (float)(player.width / 2) - 20f; + } + num68 += 6f; + } + if (num67 > 1) + { + num68 += player.velocity.Y; + } + int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default(Color), scale); + Dust expr_5A11_cp_0_cp_0 = Main.dust[num69]; + expr_5A11_cp_0_cp_0.velocity.X = expr_5A11_cp_0_cp_0.velocity.X * 0.1f; + Main.dust[num69].velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; + Main.dust[num69].noGravity = true; + Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + if (num66 == 4) + { + Dust expr_5AA6_cp_0_cp_0 = Main.dust[num69]; + expr_5AA6_cp_0_cp_0.velocity.Y = expr_5AA6_cp_0_cp_0.velocity.Y + 6f; + } + } + } + player.doubleJumpCloud = true; + player.doubleJumpSandstorm = true; + player.doubleJumpBlizzard = true; + player.jumpBoost = true; + player.autoJump = true; + player.noFallDmg = true; + player.jumpSpeedBoost += 1.4f; + player.wingTimeMax = 50; + } + + 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 = 9f; + acceleration *= 1.3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FrogLeg); + recipe.AddIngredient(ItemID.BundleofBalloons); + recipe.AddIngredient(ItemID.LuckyHorseshoe); + recipe.AddIngredient(ItemID.Jetpack); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index cceafe198e..5d943ea118 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 = 30000; - 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; - } - } - } +using System; +using 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 = 30000; + 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 diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index bbd7f9ae80..4fc46ecdb3 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.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.Accessories -{ - public class Nanotech : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanotech"); - Tooltip.SetDefault("Throwing projectiles leave behind nanoblades as they travel\n" + - "While holding a throwing weapon your defense is boosted by 15 and your damage reduction is boosted by 10%\n" + - "Throwing weapons have a chance to instantly kill normal enemies\n" + - "15% increased throwing damage, crit chance, and velocity"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.nanotech = true; - player.thrownDamage += 0.15f; - player.thrownCrit += 15; - player.thrownVelocity += 0.15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - 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(); - } - } +using System; +using 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 Nanotech : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanotech"); + Tooltip.SetDefault("Throwing projectiles leave behind nanoblades as they travel\n" + + "While holding a throwing weapon your defense is boosted by 15 and your damage reduction is boosted by 10%\n" + + "Throwing weapons have a chance to instantly kill normal enemies\n" + + "10% increased throwing damage, crit chance, and velocity"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.nanotech = true; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + player.thrownVelocity += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + 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 diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 00842ce427..4f24724574 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.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 NecklaceofVexation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necklace of Vexation"); - Tooltip.SetDefault("Revenge\n" + - "20% increased damage when under 50% life"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = 150000; - item.rare = 6; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.statLife < (player.statLifeMax2 * 0.5f)) - { - player.meleeDamage += 0.2f; - player.magicDamage += 0.2f; - player.rangedDamage += 0.2f; - player.thrownDamage += 0.2f; - player.minionDamage += 0.2f; - } - } - - 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(); - } - } +using System; +using 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 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 = 150000; + item.rare = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.statLife < (player.statLifeMax2 * 0.5f)) + { + player.meleeDamage += 0.15f; + player.magicDamage += 0.15f; + player.rangedDamage += 0.15f; + player.thrownDamage += 0.15f; + player.minionDamage += 0.15f; + } + } + + 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 diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 71ea7cf8b2..df8758a11e 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.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 OrnateShield : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ornate Shield"); - Tooltip.SetDefault("Increased defense by 8 when below 25% life"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = 150000; - item.rare = 5; - item.defense = 4; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.statLife <= (player.statLifeMax2 * 0.25f)) - { - player.statDefense += 8; - } - } - - 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(); - } - } +using System; +using 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"); + Tooltip.SetDefault("Increased defense by 8 when below 25% life"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = 150000; + item.rare = 5; + item.defense = 4; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.statLife <= (player.statLifeMax2 * 0.25f)) + { + player.statDefense += 8; + } + } + + 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 diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index f05820dd9e..a580175c04 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.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.Accessories -{ - public class PlagueHive : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Hive"); - Tooltip.SetDefault("Blinds and weakens the player if above 90% life\n" + - "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 = 500000; - item.expert = true; - 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; - modPlayer.alchFlask = true; - if (player.statLife >= (player.statLifeMax * 0.9f)) - { - player.blind = true; - player.statDefense -= 5; - player.moveSpeed -= 0.05f; - } - 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; - } - } - } +using System; +using 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("Blinds and weakens the player if above 90% life\n" + + "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 = 500000; + item.expert = true; + 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; + modPlayer.alchFlask = true; + if (player.statLife >= (player.statLifeMax * 0.9f)) + { + player.blind = true; + player.statDefense -= 5; + player.moveSpeed -= 0.05f; + } + 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 diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 2e6101da20..665883d65a 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.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.Accessories -{ - public class PsychoticAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Psychotic Amulet"); - Tooltip.SetDefault("Boosts melee and ranged damage and critical strike chance by 5%\n" + - "Grants a massive boost to these stats if you aren't moving"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 150000; - item.rare = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.pAmulet = true; - player.shroomiteStealth = true; - player.meleeDamage += 0.05f; - player.meleeCrit += 5; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - } +using System; +using 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 PsychoticAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Psychotic Amulet"); + Tooltip.SetDefault("Boosts melee and ranged damage and critical strike chance by 5%\n" + + "Grants a massive boost to these stats if you aren't moving"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 150000; + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.pAmulet = true; + player.shroomiteStealth = true; + player.meleeDamage += 0.05f; + player.meleeCrit += 5; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + } } \ No newline at end of file diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 975d51981b..9ed76c6e27 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 = 50000; - 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 += 2; - } - } - - 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(); - } - } +using System; +using 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 = 50000; + 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 += 2; + } + } + + 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 diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index e00657fcae..a461e54028 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 throwing weapon your throwing damage increases\n" + - "This effect can stack up to 50 times\n" + - "Max throwing damage boost is 15%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = 30000; - 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(); - } - } +using System; +using 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 throwing weapon your throwing damage increases\n" + + "This effect can stack up to 250 times\n" + + "Max throwing damage boost is 15%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = 30000; + 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 diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index b0906886ca..33f2119429 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,101 +1,101 @@ -using System; -using 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" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "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 30% 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 = 10000000; - item.defense = 12; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dAmulet = true; - player.panic = true; - player.armorPenetration += 50; - player.manaMagnet = true; - player.magicCuffs = true; - 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); - } - player.noKnockback = true; - if ((float)player.statLife > (float)player.statLifeMax2 * 0.25f) - { - 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 ((double)player.statLife <= (double)player.statLifeMax2 * 0.3) - { - player.AddBuff(62, 5, true); - } - if ((double)player.statLife <= (double)player.statLifeMax2 * 0.15) - { - player.endurance += 0.05f; - } - } - - 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(); - } - } +using System; +using 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" + + "Increases pickup range for mana stars and you restore mana when damaged\n" + + "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 = 10000000; + item.defense = 12; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dAmulet = true; + player.panic = true; + player.armorPenetration += 50; + player.manaMagnet = true; + player.magicCuffs = true; + 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); + } + player.noKnockback = true; + if ((float)player.statLife > (float)player.statLifeMax2 * 0.25f) + { + 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 ((double)player.statLife <= (double)player.statLifeMax2 * 0.5) + { + player.AddBuff(62, 5, true); + } + if ((double)player.statLife <= (double)player.statLifeMax2 * 0.15) + { + player.endurance += 0.05f; + } + } + + 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 diff --git a/Items/Accessories/Revenge.cs b/Items/Accessories/Revenge.cs index a1d16b8c09..66e6475332 100644 --- a/Items/Accessories/Revenge.cs +++ b/Items/Accessories/Revenge.cs @@ -1,76 +1,76 @@ -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.Accessories -{ - public class Revenge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Revengeance"); - Tooltip.SetDefault("READ ALL OF THIS\n" + - "Activates revengeance mode, can only be used in expert mode.\n" + - "Activates rage, which is a new stat. When rage is maxed press V to activate rage mode.\n" + - "You gain rage whenever you take damage.\n" + - "Activates adrenaline, which is a new stat. When adrenaline is maxed press B to activate adrenaline mode.\n" + - "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + - "If you hit max adrenaline and don't use it within 5 seconds your adrenaline damage will drop gradually.\n" + - "All enemies drop 5 times the cash and enemy spawn rates are boosted.\n" + - "You do 5% MORE damage but you also take 5% MORE damage (this is only active after your first boss kill).\n" + - "Before you have killed your first boss you take 20% LESS damage from everything.\n" + - "Changes ALL boss AIs in vanilla and the Calamity Mod.\n" + - "DO NOT USE IF A BOSS IS ALIVE!\n" + - "Only use if you are absolutely sure you want to go through with this!"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.expert = true; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - if (!Main.expertMode) - { - 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.revenge) - { - CalamityWorld.revenge = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - return true; - } - } +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.Accessories +{ + public class Revenge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Revengeance"); + Tooltip.SetDefault("READ ALL OF THIS\n" + + "Activates revengeance mode, can only be used in expert mode.\n" + + "Activates rage, which is a new stat. When rage is maxed press V to activate rage mode.\n" + + "You gain rage whenever you take damage.\n" + + "Activates adrenaline, which is a new stat. When adrenaline is maxed press B to activate adrenaline mode.\n" + + "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + + "If you hit max adrenaline and don't use it within 5 seconds your adrenaline damage will drop gradually.\n" + + "All enemies drop 5 times the cash and enemy spawn rates are boosted.\n" + + "You do 5% MORE damage but you also take 5% MORE damage (this is only active after your first boss kill).\n" + + "Before you have killed your first boss you take 20% LESS damage from everything.\n" + + "Changes ALL boss AIs in vanilla and the Calamity Mod.\n" + + "DO NOT USE IF A BOSS IS ALIVE!\n" + + "Only use if you are absolutely sure you want to go through with this!"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.expert = true; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + if (!Main.expertMode || CalamityWorld.bossRushActive) + { + 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.revenge) + { + CalamityWorld.revenge = true; + 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 diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index e6dd2d9573..2bf10029df 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.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.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 = 30000; - 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; - } - } - } +using System; +using 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 = 30000; + 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; + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 0202ab28df..4a34875d73 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.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 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 = 50000; - 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(); - } +using System; +using 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 = 50000; + 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 diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index dfc8cc746c..3755c4a33c 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -1,71 +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, critical strike chance, and 15% decreased mana usage\n" + - "+100 max mana, increases life regen, and reveals treasure locations\n" + - "Reduces the cooldown of healing potions"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 5000000; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.findTreasure = true; - player.pStone = true; - player.lifeRegen += 1; - player.statManaMax2 += 100; - player.magicDamage += 0.1f; - player.manaCost *= 0.85f; - player.magicCrit += 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CharmofMyths); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(ItemID.SpellTome); - 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.CharmofMyths); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddIngredient(null, "ChaosAmulet"); - recipe.AddIngredient(ItemID.BloodWater, 10); - 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.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" + + "+100 max mana, increases life regen, and reveals treasure locations\n" + + "Reduces the cooldown of healing potions"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 5000000; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.findTreasure = true; + player.pStone = true; + player.lifeRegen += 1; + player.statManaMax2 += 100; + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CharmofMyths); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(ItemID.SpellTome); + 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.CharmofMyths); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(ItemID.SpellTome); + recipe.AddIngredient(null, "ChaosAmulet"); + recipe.AddIngredient(ItemID.BloodWater, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/SkylineWings.cs b/Items/Accessories/SkylineWings.cs index d2d3adf99f..e36ac77d13 100644 --- a/Items/Accessories/SkylineWings.cs +++ b/Items/Accessories/SkylineWings.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.Wings)] - public class SkylineWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skyline Wings"); - Tooltip.SetDefault("Low acceleration: 1\nLow flight time: 20"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.wingTimeMax = 30; - } - - 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 = 8f; - acceleration *= 1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Feather, 5); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.Bone, 15); - 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.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class SkylineWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyline Wings"); + Tooltip.SetDefault("Low acceleration: 1\nLow flight time: 20"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 50000; + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.wingTimeMax = 30; + } + + 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 = 8f; + acceleration *= 1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Feather, 5); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(ItemID.Bone, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index 2d23462b34..eadbce93ef 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 Generator"); - 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 = 50000; - 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(); - } - } +using System; +using 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 Generator"); + 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 = 50000; + 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 diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index f573fca8fa..0a03e71db5 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -1,77 +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 -{ - public class Sponge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Sponge"); - Tooltip.SetDefault("50% increased mining speed and you emit light\n" + - "12% increased damage reduction and increased life regen\n" + - "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + - "Honey 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 = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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(); - } - } +using System; +using 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 = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Accessories/StarlightWings.cs b/Items/Accessories/StarlightWings.cs index 95ece47e4c..91d59064b5 100644 --- a/Items/Accessories/StarlightWings.cs +++ b/Items/Accessories/StarlightWings.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class StarlightWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starlight Wings"); - Tooltip.SetDefault("Wings of the Nightingale\nDecent acceleration: 1.5\nGood flight time: 110"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 500000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 110; - } - - 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 = 9f; - acceleration *= 1.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 5); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class StarlightWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starlight Wings"); + Tooltip.SetDefault("Wings of the Nightingale\nDecent acceleration: 1.5\nGood flight time: 110"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 500000; + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 110; + } + + 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 = 9f; + acceleration *= 1.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 5); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index d74be4857b..78d01e69c0 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.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 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 throwing damage and velocity\n" + - "10% increased throwing 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 = 15000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - player.thrownVelocity += 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(); - } - } +using System; +using 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 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 throwing damage and velocity\n" + + "10% increased throwing 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 = 15000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + player.thrownVelocity += 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 diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 5ebc265c2c..9413b4d9ca 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 = 5000000; - 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(); - } - } +using System; +using 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 = 5000000; + 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 diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 9f5e495e9d..0c5ac774a9 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 = 10000000; - 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(); - } - } +using System; +using 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 = 10000000; + 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 diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 134c4c859f..e127e626b7 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.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 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" + - "10% increased throwing damage and velocity\n" + - "10% increased throwing crit chance"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 5000000; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.autoJump = true; - player.jumpSpeedBoost += 0.4f; - player.extraFall += 35; - player.blackBelt = true; - player.dash = 1; - player.spikedBoots = 2; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - player.thrownVelocity += 0.1f; - } - - 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(); - } - } +using System; +using 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 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 throwing damage and velocity\n" + + "5% increased throwing crit chance"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 5000000; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.autoJump = true; + player.jumpSpeedBoost += 0.4f; + player.extraFall += 35; + player.blackBelt = true; + player.dash = 1; + player.spikedBoots = 2; + player.thrownDamage += 0.05f; + player.thrownCrit += 5; + player.thrownVelocity += 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 diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index f2140ffb61..0c72db91ad 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 and crit chance by 5%, \n" + - "defense by 5, and max movement speed and acceleration by 5%\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 50000; - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.stressPills = 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 StressPills : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stress Pills"); + Tooltip.SetDefault("Boosts your damage and crit chance by 5%, \n" + + "defense by 5, and max movement speed and acceleration by 5%\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 50000; + 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 diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 22b2a3525d..8f854ebeee 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 = 1000000; - 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(); - } - } +using System; +using 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 = 1000000; + 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 diff --git a/Items/Accessories/TarragonWings.cs b/Items/Accessories/TarragonWings.cs index 26bc524fd8..f7221b866d 100644 --- a/Items/Accessories/TarragonWings.cs +++ b/Items/Accessories/TarragonWings.cs @@ -1,87 +1,87 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class TarragonWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Wings"); - Tooltip.SetDefault("Born of the jungle\nExcellent acceleration: 2.5\nExcellent flight time: 250"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 750000; - item.accessory = true; - } - - 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 void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 75, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 250; - } - - 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 = 11f; - acceleration *= 2.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 5); - recipe.AddIngredient(ItemID.SoulofFlight, 30); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class TarragonWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Wings"); + Tooltip.SetDefault("Born of the jungle\nExcellent acceleration: 2.5\nExcellent flight time: 250"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 750000; + item.accessory = true; + } + + 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 void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 75, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 250; + } + + 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 = 11f; + acceleration *= 2.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 5); + recipe.AddIngredient(ItemID.SoulofFlight, 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index ed3b1217cc..ae826fdc95 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" + - "6% 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 = 3000000; - 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(); - } - } +using System; +using 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 = 3000000; + 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 diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 5611c7b8bb..7b84a5bc44 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,217 +1,217 @@ -using System; -using 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 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("12% increased damage and critical strike chance\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" + - "Immunity to lava 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 = 10000000; - item.expert = true; - 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"), 250, 1f, Main.myPlayer, 0f, 0f); - } - } - player.meleeCrit += 12; - player.magicCrit += 12; - player.rangedCrit += 12; - player.thrownCrit += 12; - player.meleeDamage += 0.12f; - player.thrownDamage += 0.12f; - player.rangedDamage += 0.12f; - player.magicDamage += 0.12f; - player.minionDamage += 0.12f; - player.ignoreWater = true; - player.lavaImmune = true; - if (player.lavaWet) - { - player.meleeDamage += 0.15f; - player.thrownDamage += 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; - player.thrownDamage += 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) - { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 500, 5f, player.whoAmI, 0f, 0f); - Main.projectile[projectile1].timeLeft = 10; - } - } - if (player.immune) - { - if (Main.rand.Next(16) == 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, 500, 3f, 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 = 200f; - bool flag = seaCounter % 60 == 0; - int num3 = 80; - 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"), 500, 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(); - } - } +using System; +using 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 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("10% increased damage and critical strike chance\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" + + "Immunity to lava 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 = 10000000; + item.expert = true; + 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"), 250, 1f, Main.myPlayer, 0f, 0f); + } + } + player.meleeCrit += 10; + player.magicCrit += 10; + player.rangedCrit += 10; + player.thrownCrit += 10; + player.meleeDamage += 0.1f; + player.thrownDamage += 0.1f; + player.rangedDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + player.ignoreWater = true; + player.lavaImmune = true; + if (player.lavaWet) + { + player.meleeDamage += 0.15f; + player.thrownDamage += 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; + player.thrownDamage += 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) + { + int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 500, 5f, player.whoAmI, 0f, 0f); + Main.projectile[projectile1].timeLeft = 10; + } + } + if (player.immune) + { + if (Main.rand.Next(16) == 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, 500, 3f, 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 = 200f; + bool flag = seaCounter % 60 == 0; + int num3 = 80; + 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"), 500, 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 diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index f6d9402cac..94f82b40b8 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.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 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 = 10000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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 = 10000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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 b31f166bda..6a195af028 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.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.Accessories { -public class TheFirstShadowflame : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The First Shadowflame"); - Tooltip.SetDefault("One of the first magical artifacts, granted to a disheveled race of humans long ago by the Tyrant King Yharim\nLittle did the humans know of the horrid curse that lied within...\nGrants shadowflame powers to all minions"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 150000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.shadowMinions = 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 TheFirstShadowflame : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The First Shadowflame"); + Tooltip.SetDefault("One of the first magical artifacts, granted to a disheveled race of humans long ago by the Tyrant King Yharim\nLittle did the humans know of the horrid curse that lied within...\nGrants shadowflame powers to all minions"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 150000; + 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 diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index a5b8a404c3..69368614c8 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 = 30000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.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; + +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 = 30000; + 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 diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index c7600e602b..094b6c1461 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -1,135 +1,135 @@ -using System; -using 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 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" + - "Immunity to lava and 25% increased damage while in lava"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 500000; - item.expert = true; - 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.lavaImmune = true; - player.meleeDamage += 0.15f; - player.thrownDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - if (player.lavaWet) - { - player.meleeDamage += 0.25f; - player.thrownDamage += 0.25f; - player.rangedDamage += 0.25f; - player.magicDamage += 0.25f; - player.minionDamage += 0.25f; - } - 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("StandingFire"), 40, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - } - } - } - if (FireCountdown == 0) - { - FireCountdown = 300; - } - 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; - } - } - } - } - } - } +using System; +using 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 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" + + "Immunity to lava and 25% increased damage while in lava"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 500000; + item.expert = true; + 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.lavaImmune = true; + player.meleeDamage += 0.15f; + player.thrownDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + if (player.lavaWet) + { + player.meleeDamage += 0.25f; + player.thrownDamage += 0.25f; + player.rangedDamage += 0.25f; + player.magicDamage += 0.25f; + player.minionDamage += 0.25f; + } + 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("StandingFire"), 40, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + } + } + } + if (FireCountdown == 0) + { + FireCountdown = 300; + } + 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 diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index bb33b30b02..8cbc0555f2 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("Waifu 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 = 500000; - 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"), 45, 2f, Main.myPlayer, 0f, 0f); - } - } - } - } +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("Waifu 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 = 500000; + 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"), 45, 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 956691840f..20478426c2 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.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 WifeinaBottlewithBoobs : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rare Waifu in a Bottle"); - Tooltip.SetDefault("Summons a sand elemental to fight for you\n;D"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = 500000; - item.expert = true; - 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"), 45, 2f, Main.myPlayer, 0f, 0f); - } - } - } - } +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 Waifu in a Bottle"); + Tooltip.SetDefault("Summons a sand elemental to fight for you\n;D"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = 500000; + item.expert = true; + 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"), 45, 2f, Main.myPlayer, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Items/Accessories/XerocWings.cs b/Items/Accessories/XerocWings.cs index 9a5ff580ce..251181d7fe 100644 --- a/Items/Accessories/XerocWings.cs +++ b/Items/Accessories/XerocWings.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Wings)] - public class XerocWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Wings"); - Tooltip.SetDefault("Highly radioactive\nExcellent acceleration: 2.25\nExcellent flight time: 160"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 20; - item.value = 500000; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int num59 = 4; - if (player.direction == 1) - { - num59 = -40; - } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 242, 0f, 0f, 100, default(Color), 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.Next(10) == 0) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - player.wingTimeMax = 160; - } - - 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 = 9f; - acceleration *= 2.25f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 5); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - 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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Wings)] + public class XerocWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Wings"); + Tooltip.SetDefault("Highly radioactive\nExcellent acceleration: 2.25\nExcellent flight time: 160"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 20; + item.value = 500000; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int num59 = 4; + if (player.direction == 1) + { + num59 = -40; + } + int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 242, 0f, 0f, 100, default(Color), 2.4f); + Main.dust[num60].noGravity = true; + Main.dust[num60].velocity *= 0.3f; + if (Main.rand.Next(10) == 0) + { + Main.dust[num60].fadeIn = 2f; + } + Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + player.wingTimeMax = 160; + } + + 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 = 9f; + acceleration *= 2.25f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 5); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 4bc07625a2..0e6b700e0c 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.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.Accessories -{ - public class YharimsInsignia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Insignia"); - Tooltip.SetDefault("10% increased damage when under 50% life\n" + - "Increased melee speed as health lowers\n" + - "7% increased melee speed and damage\n" + - "Melee attacks inflict holy fire\n" + - "Increased invincibility after taking damage\n" + - "You are immune to lava\n" + - "Increased melee knockback"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 38; - item.value = 5000000; - item.accessory = true; - } - - 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 void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.yInsignia = true; - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.07f; - player.meleeSpeed += 0.07f; - player.lavaImmune = true; - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.rangedDamage += 0.1f; - player.thrownDamage += 0.1f; - player.minionDamage += 0.1f; - } - if (player.statLife <= (player.statLifeMax2 * 0.8f) && player.statLife > (player.statLifeMax2 * 0.6f)) - { - player.meleeSpeed += 0.05f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.6f) && player.statLife > (player.statLifeMax2 * 0.4f)) - { - player.meleeSpeed += 0.1f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.4f) && player.statLife > (player.statLifeMax2 * 0.2f)) - { - player.meleeSpeed += 0.15f; - } - else if (player.statLife <= (player.statLifeMax2 * 0.2f)) - { - player.meleeSpeed += 0.2f; - } - } - - 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(); - } - } +using System; +using 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" + + "Increased melee speed as health lowers\n" + + "5% increased melee speed and damage\n" + + "Melee attacks inflict holy fire\n" + + "Increased invincibility after taking damage\n" + + "You are immune to lava\n" + + "Increased melee knockback"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 38; + item.value = 5000000; + item.accessory = true; + } + + 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 void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.yInsignia = true; + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.05f; + player.meleeSpeed += 0.05f; + player.lavaImmune = true; + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.rangedDamage += 0.1f; + player.thrownDamage += 0.1f; + player.minionDamage += 0.1f; + } + if (player.statLife <= (player.statLifeMax2 * 0.8f) && player.statLife > (player.statLifeMax2 * 0.6f)) + { + player.meleeSpeed += 0.05f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.6f) && player.statLife > (player.statLifeMax2 * 0.4f)) + { + player.meleeSpeed += 0.1f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.4f) && player.statLife > (player.statLifeMax2 * 0.2f)) + { + player.meleeSpeed += 0.15f; + } + else if (player.statLife <= (player.statLifeMax2 * 0.2f)) + { + player.meleeSpeed += 0.2f; + } + } + + 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 diff --git a/Items/AerialHamaxe.cs b/Items/AerialHamaxe.cs index aeae907bf8..63f489a483 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 = 25; - item.melee = true; - item.width = 48; - item.height = 48; - item.useTime = 20; - item.useAnimation = 20; - item.useTurn = true; - item.axe = 20; - item.hammer = 75; - item.useStyle = 1; - item.knockBack = 7; - item.value = 50000; - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); //Specific hamaxe 1 recipe. - 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); - } - } - } +using System; +using 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 = 25; + item.melee = true; + item.width = 48; + item.height = 48; + item.useTime = 20; + item.useAnimation = 20; + item.useTurn = true; + item.axe = 20; + item.hammer = 75; + item.useStyle = 1; + item.knockBack = 7; + item.value = 50000; + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); //Specific hamaxe 1 recipe. + 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 diff --git a/Items/AerialiteBar.cs b/Items/AerialiteBar.cs index 52e34c11b2..6bfa7a823f 100644 --- a/Items/AerialiteBar.cs +++ b/Items/AerialiteBar.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 AerialiteBar : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerialite Bar"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = 18750; - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteOre", 4); - recipe.AddTile(TileID.Furnaces); - 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 { +public class AerialiteBar : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerialite Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = 18750; + item.rare = 2; + } + + 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 diff --git a/Items/AncientBoneDust.cs b/Items/AncientBoneDust.cs index 3421257f37..99c6607017 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 = 5000; - item.rare = 1; - } - } +using System; +using 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 = 5000; + item.rare = 1; + } + } } \ No newline at end of file diff --git a/Items/AnechoicCoating.cs b/Items/AnechoicCoating.cs index c10c1fb6a6..1d1f04c77c 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 = 5000; - } - - 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(); - } - } +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 = 5000; + } + + 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 diff --git a/Items/AquaticScourge/AquaticEmblem.cs b/Items/AquaticScourge/AquaticEmblem.cs index 15bb75af12..f9f3105a8b 100644 --- a/Items/AquaticScourge/AquaticEmblem.cs +++ b/Items/AquaticScourge/AquaticEmblem.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.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 40, maximum movement speed reduction is 15%"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 26; - item.value = 500000; - item.rare = 5; - 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; - } - } +using System; +using 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 40, maximum movement speed reduction is 15%"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 26; + item.value = 500000; + item.rare = 5; + 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 diff --git a/Items/AquaticScourge/AquaticScourgeBag.cs b/Items/AquaticScourge/AquaticScourgeBag.cs index 2fa2d80bc7..d8c5b96139 100644 --- a/Items/AquaticScourge/AquaticScourgeBag.cs +++ b/Items/AquaticScourge/AquaticScourgeBag.cs @@ -1,120 +1,120 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 (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(15) == 0) - { - player.QuickSpawnItem(ItemID.HighTestFishingLine); - } - if (Main.rand.Next(30) == 0) - { - player.QuickSpawnItem(ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - player.QuickSpawnItem(ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("AeroStone")); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 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)); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 (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(15) == 0) + { + player.QuickSpawnItem(ItemID.HighTestFishingLine); + } + if (Main.rand.Next(30) == 0) + { + player.QuickSpawnItem(ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + player.QuickSpawnItem(ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("AeroStone")); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 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 diff --git a/Items/AquaticScourge/Seafood.cs b/Items/AquaticScourge/Seafood.cs index 45d7b62b54..30c14680b7 100644 --- a/Items/AquaticScourge/Seafood.cs +++ b/Items/AquaticScourge/Seafood.cs @@ -1,51 +1,51 @@ -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..."); - } - - 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(); - } - } +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..."); + } + + 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 diff --git a/Items/AridArtifact.cs b/Items/AridArtifact.cs index 56ce9cbb7c..d9961eb9a6 100644 --- a/Items/AridArtifact.cs +++ b/Items/AridArtifact.cs @@ -1,67 +1,67 @@ -using System; -using 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 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) - { - 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); - } - 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(); - } - } +using System; +using 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 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) + { + 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); + } + 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 diff --git a/Items/AridArtifact.png b/Items/AridArtifact.png index ebb9253a69..d381ad9adc 100644 Binary files a/Items/AridArtifact.png and b/Items/AridArtifact.png differ diff --git a/Items/Armageddon.cs b/Items/Armageddon.cs index 943eed501a..e882fbd383 100644 --- a/Items/Armageddon.cs +++ b/Items/Armageddon.cs @@ -1,84 +1,90 @@ -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 Armageddon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armageddon"); - Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + - "Effect can be toggled on and off\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss\n" + - "If a boss is defeated with this effect active it will drop 10 treasure bags, 9 in normal mode\n" + - "If any player dies while a boss is alive the boss will instantly despawn"); - } - - public override void SetDefaults() - { - item.rare = 11; - 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) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - - if (!CalamityWorld.armageddon) - { - CalamityWorld.armageddon = true; - } - else - { - CalamityWorld.armageddon = false; - } - - string key = CalamityWorld.armageddon ? "Mods.CalamityMod.ArmageddonText" : "Mods.CalamityMod.ArmageddonText2"; - Color messageColor = Color.Fuchsia; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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 Armageddon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armageddon"); + Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + + "Effect can be toggled on and off\n" + + "Using this while a boss is alive will instantly kill you and despawn the boss\n" + + "If a boss is defeated with this effect active it will drop 11 treasure bags, 10 in normal mode\n" + + "If any player dies while a boss is alive the boss will instantly despawn"); + } + + public override void SetDefaults() + { + item.rare = 11; + 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 CanUseItem(Player player) + { + if (CalamityWorld.bossRushActive) + { + 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.armageddon) + { + CalamityWorld.armageddon = true; + } + else + { + CalamityWorld.armageddon = false; + } + string key = CalamityWorld.armageddon ? "Mods.CalamityMod.ArmageddonText" : "Mods.CalamityMod.ArmageddonText2"; + Color messageColor = Color.Fuchsia; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs index f351a62882..fd16341ff6 100644 --- a/Items/Armor/AbyssalDivingSuit.cs +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -1,85 +1,85 @@ -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 25%\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\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 = 5000000; - 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.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; - } - } +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 25%\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\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 = 5000000; + 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.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 diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index ad60e5ccbb..45b1d020f5 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AerospecBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Breastplate"); - Tooltip.SetDefault("+20 max mana and +1 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 65000; - item.rare = 3; - item.defense = 7; - } - - public override void UpdateEquip(Player player) - { - player.statManaMax2 += 20; - player.maxMinions++; - } - - 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(); - } - } +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 AerospecBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Breastplate"); + Tooltip.SetDefault("+20 max mana and +1 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 65000; + item.rare = 3; + item.defense = 7; + } + + public override void UpdateEquip(Player player) + { + player.statManaMax2 += 20; + player.maxMinions++; + } + + 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 diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 5fc6122785..9351bf7e82 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.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 AerospecHat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Hat"); - Tooltip.SetDefault("8% increased magic damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 50000; - 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; - } - - 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(); - } - } +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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 50000; + 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; + } + + 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 diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 762ea65de3..6f3852471f 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.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 AerospecHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Headgear"); - Tooltip.SetDefault("8% increased throwing damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 50000; - 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 throwing 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.thrownCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.thrownDamage += 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(); - } - } +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 AerospecHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Headgear"); + Tooltip.SetDefault("8% increased throwing damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 50000; + 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 throwing 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.thrownCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.thrownDamage += 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 diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index 36b0b26b81..5abe814f04 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 = 50000; - 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(); - } - } +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 = 50000; + 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 diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index 7d6693b8ee..32a1059452 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Helmet"); - Tooltip.SetDefault("8% increased summon damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 50000; - 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 = "5% increased movement speed\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"), 25, 0f, Main.myPlayer, 0f, 0f); - } - } - player.moveSpeed += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 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(); - } - } +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("8% increased summon damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 50000; + 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 = "5% increased movement speed\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"), 25, 0f, Main.myPlayer, 0f, 0f); + } + } + player.moveSpeed += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 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 diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index e26571db1d..c68379c918 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 = 50000; - 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(); - } - } +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 = 50000; + 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 diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs index 57bdd0e8e2..5f12ec5228 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 = 57500; - 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(); - } - } +using System; +using 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 = 57500; + 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 diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs index ddbd1dad61..8f0933a58e 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" + - "+2 max minions\n" + - "Creature detection"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 470000; - item.rare = 7; - item.defense = 23; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - player.maxMinions += 2; - player.detectCreature = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 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.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" + + "+2 max minions\n" + + "Creature detection"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 470000; + item.rare = 7; + item.defense = 23; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.statManaMax2 += 20; + player.maxMinions += 2; + player.detectCreature = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 327b8647bd..1f36e16450 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.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 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 = 500000; - item.rare = 7; - item.defense = 13; //53 - } - - 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" + - "22% increased damage and critical strike chance\n" + - "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + - "This effect has a 2 second cooldown before it can trigger again"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.astralStarRain = true; - player.moveSpeed += 0.25f; - player.meleeDamage += 0.22f; - player.meleeCrit += 22; - player.rangedDamage += 0.22f; - player.rangedCrit += 22; - player.magicDamage += 0.22f; - player.magicCrit += 22; - player.thrownDamage += 0.22f; - player.thrownCrit += 22; - player.minionDamage += 0.22f; - } - - 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.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.Armor; + +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 = 500000; + item.rare = 7; + item.defense = 13; //53 + } + + 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" + + "22% increased damage and critical strike chance\n" + + "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + + "This effect has a 2 second cooldown before it can trigger again"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.astralStarRain = true; + player.moveSpeed += 0.25f; + player.meleeDamage += 0.22f; + player.meleeCrit += 22; + player.rangedDamage += 0.22f; + player.rangedCrit += 22; + player.magicDamage += 0.22f; + player.magicCrit += 22; + player.thrownDamage += 0.22f; + player.thrownCrit += 22; + player.minionDamage += 0.22f; + } + + 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.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs index b68f11c58e..f38f4cba34 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 = 450000; - item.rare = 7; - item.defense = 17; - } - - 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.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.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 = 450000; + item.rare = 7; + item.defense = 17; + } + + 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.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/AstrumDeusMask.cs b/Items/Armor/AstrumDeusMask.cs index ec21437344..ae7053cd54 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; - } - } +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 diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index 539ef8be25..301ddbbea5 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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AtaxiaArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Armor"); - Tooltip.SetDefault("+20 max mana and life\n" + - "8% increased damage and 5% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 400000; - item.rare = 8; - item.defense = 20; - } - - public override void UpdateEquip(Player player) - { - player.statManaMax2 += 20; - player.statLifeMax2 += 20; - player.meleeCrit += 5; - player.meleeDamage += 0.08f; - player.magicCrit += 5; - player.magicDamage += 0.08f; - player.rangedCrit += 5; - player.rangedDamage += 0.08f; - player.thrownCrit += 5; - player.thrownDamage += 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(); - } - } +using System; +using 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.Body)] + public class AtaxiaArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Armor"); + Tooltip.SetDefault("+20 max mana and life\n" + + "8% increased damage and 5% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 400000; + item.rare = 8; + item.defense = 20; + } + + public override void UpdateEquip(Player player) + { + player.statManaMax2 += 20; + player.statLifeMax2 += 20; + player.meleeCrit += 5; + player.meleeDamage += 0.08f; + player.magicCrit += 5; + player.magicDamage += 0.08f; + player.rangedCrit += 5; + player.rangedDamage += 0.08f; + player.thrownCrit += 5; + player.thrownDamage += 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 diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index 209584b4b7..56afd53772 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.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 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 cost by 25%\n" + - "Immune to lava and fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 450000; - 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 and critical strike chance\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; - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.AddBuff(BuffID.Inferno, 2); - } - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ammoCost75 = true; - player.rangedDamage += 0.12f; - player.rangedCrit += 10; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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 cost by 25%\n" + + "Immune to lava and fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 450000; + 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 and critical strike chance\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; + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.AddBuff(BuffID.Inferno, 2); + } + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ammoCost75 = true; + player.rangedDamage += 0.12f; + player.rangedCrit += 10; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index c0e4f7001b..62910c28be 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.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.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" + - "Melee attacks inflict on fire\n" + - "Immune to lava and fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 450000; - 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 and critical strike chance\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; - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.AddBuff(BuffID.Inferno, 2); - } - player.meleeDamage += 0.05f; - player.meleeCrit += 5; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaFire = true; - player.meleeDamage += 0.12f; - player.meleeCrit += 10; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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" + + "Melee attacks inflict on fire\n" + + "Immune to lava and fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 450000; + 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 and critical strike chance\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; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Inferno, 2); + } + player.meleeDamage += 0.05f; + player.meleeCrit += 5; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaFire = true; + player.meleeDamage += 0.12f; + player.meleeCrit += 10; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 988de99d94..ab265789ed 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Helmet"); - Tooltip.SetDefault("12% increased summon damage and increased minion knockback\n" + - "+2 max minions\n" + - "Immune to lava and fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 450000; - 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 = "5% increased summon 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"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.AddBuff(BuffID.Inferno, 2); - } - player.minionDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.12f; - player.minionKB += 1.5f; - player.maxMinions += 2; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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("12% increased summon damage and increased minion knockback\n" + + "+2 max minions\n" + + "Immune to lava and fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 450000; + 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 = "5% increased summon 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"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.AddBuff(BuffID.Inferno, 2); + } + player.minionDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.12f; + player.minionKB += 1.5f; + player.maxMinions += 2; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 8eaccbd9fa..5b83179d25 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.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 AtaxiaHood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Hood"); - Tooltip.SetDefault("12% increased throwing damage and 10% increased throwing critical strike chance\n" + - "50% chance to not consume thrown items\n" + - "Immune to lava and fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 450000; - 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 throwing damage and critical strike chance\n" + - "Inferno effect when below 50% life\n" + - "Throwing 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"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.ataxiaVolley = true; - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.AddBuff(BuffID.Inferno, 2); - } - player.thrownDamage += 0.05f; - player.thrownCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.thrownCost50 = true; - player.thrownDamage += 0.12f; - player.thrownCrit += 10; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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 AtaxiaHood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Hood"); + Tooltip.SetDefault("12% increased throwing damage and 10% increased throwing critical strike chance\n" + + "50% chance to not consume thrown items\n" + + "Immune to lava and fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 450000; + 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 throwing damage and critical strike chance\n" + + "Inferno effect when below 50% life\n" + + "Throwing 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"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.ataxiaVolley = true; + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.AddBuff(BuffID.Inferno, 2); + } + player.thrownDamage += 0.05f; + player.thrownCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.thrownCost50 = true; + player.thrownDamage += 0.12f; + player.thrownCrit += 10; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 2c0d96caa6..7b905aec9b 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.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.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 10%, and 10% increased magic critical strike chance\n" + - "+100 Max Mana\n" + - "Immune to lava and fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 450000; - 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 and critical strike chance\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; - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.AddBuff(BuffID.Inferno, 2); - } - player.magicDamage += 0.05f; - player.magicCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.9f; - player.statManaMax2 += 100; - player.magicDamage += 0.12f; - player.magicCrit += 10; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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 10%, and 10% increased magic critical strike chance\n" + + "+100 Max Mana\n" + + "Immune to lava and fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 450000; + 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 and critical strike chance\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; + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.AddBuff(BuffID.Inferno, 2); + } + player.magicDamage += 0.05f; + player.magicCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.9f; + player.statManaMax2 += 100; + player.magicDamage += 0.12f; + player.magicCrit += 10; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index dc103aa76b..7b2336d333 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.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.Legs)] - public class AtaxiaSubligar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Subligar"); - Tooltip.SetDefault("5% increased critical strike chance\n" + - "15% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 412500; - item.rare = 8; - item.defense = 14; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 5; - 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(); - } - } +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.Legs)] + public class AtaxiaSubligar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Subligar"); + Tooltip.SetDefault("5% increased critical strike chance\n" + + "15% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 412500; + item.rare = 8; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 5; + 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 diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 60424effc8..7eb4a3728d 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.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.Armor; - -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 and mana\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 = 9250000; - item.defense = 48; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fBarrier = true; - modPlayer.godSlayerReflect = true; - player.statLifeMax2 += 100; - player.statManaMax2 += 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; - player.thrownDamage += 0.08f; - player.thrownCrit += 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(); - } - } +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 AuricTeslaBodyArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Body Armor"); + Tooltip.SetDefault("+100 max life and mana\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 = 9250000; + item.defense = 48; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fBarrier = true; + modPlayer.godSlayerReflect = true; + player.statLifeMax2 += 100; + player.statManaMax2 += 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; + player.thrownDamage += 0.08f; + player.thrownCrit += 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 diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 018538f048..2510b02373 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.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.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 10% increased critical strike chance\n" + - "Magic carpet effect"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 8750000; - item.defense = 44; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.5f; - player.carpet = true; - player.meleeDamage += 0.12f; - player.meleeCrit += 10; - player.rangedDamage += 0.12f; - player.rangedCrit += 10; - player.magicDamage += 0.12f; - player.magicCrit += 10; - player.thrownDamage += 0.12f; - player.thrownCrit += 10; - 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(); - } - } +using System; +using 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 AuricTeslaCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Cuisses"); + Tooltip.SetDefault("50% increased movement speed\n" + + "12% increased damage and 10% increased critical strike chance\n" + + "Magic carpet effect"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 8750000; + item.defense = 44; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.5f; + player.carpet = true; + player.meleeDamage += 0.12f; + player.meleeCrit += 10; + player.rangedDamage += 0.12f; + player.rangedCrit += 10; + player.magicDamage += 0.12f; + player.magicCrit += 10; + player.thrownDamage += 0.12f; + player.thrownCrit += 10; + 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 diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 464d4a1635..563be1cd0f 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.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; -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 = 10000000; - item.defense = 54; //132 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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" + - "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + - "Your melee damage is multiplied based on how high your HP is; at full HP this effect is at max"; - 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.lavaImmune = true; - 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(); - } - } +using System; +using 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 = 10000000; + item.defense = 54; //132 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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" + + "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%\n" + + "Your melee damage is multiplied based on how high your HP is; at full HP this effect is at max"; + 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.lavaImmune = true; + 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 diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index f70f43edb6..e981ffed8e 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.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.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 = 10000000; - item.defense = 40; //132 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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" + - "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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.lavaImmune = true; - 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(); - } - } +using System; +using 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 = 10000000; + item.defense = 40; //132 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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" + + "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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.lavaImmune = true; + 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 diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index d83d5b41a2..0567b3c12d 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaPlumedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Plumed Helm"); - Tooltip.SetDefault("20% increased throwing 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 = 10000000; - item.defense = 34; //132 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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 = "Throwing Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + - "Throwing weapon critical strikes will do 3.5 times damage while you are above 90% HP"; - 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; - player.thorns += 3f; - player.lavaImmune = true; - 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.thrownDamage += 0.2f; - player.thrownCrit += 20; - } - - 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(); - } - } +using System; +using 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 AuricTeslaPlumedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Plumed Helm"); + Tooltip.SetDefault("20% increased throwing 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 = 10000000; + item.defense = 34; //132 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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 = "Throwing Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%\n" + + "Throwing weapon critical strikes will do 3.5 times damage while you are above 90% HP"; + 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; + player.thorns += 3f; + player.lavaImmune = true; + 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.thrownDamage += 0.2f; + player.thrownCrit += 20; + } + + 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 diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 5ae53acf86..8c588e1ef2 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -1,239 +1,239 @@ -using System; -using 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("120% increased summon damage and +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 = 10000000; - item.defense = 12; //132 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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" + - "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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.lavaImmune = true; - player.ignoreWater = true; - player.crimsonRegen = true; - 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)((double)3000 * 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.minionDamage += 1.2f; - 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(); - } - } +using System; +using 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("120% increased summon damage and +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 = 10000000; + item.defense = 12; //132 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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" + + "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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.lavaImmune = true; + player.ignoreWater = true; + player.crimsonRegen = true; + 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)((double)3000 * 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.minionDamage += 1.2f; + 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 diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 3d6e7ae1e3..d8e4400060 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.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.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\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 10000000; - item.defense = 24; //132 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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" + - "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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.lavaImmune = true; - 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.magicDamage += 0.2f; - player.magicCrit += 20; - } - - 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(); - } - } +using System; +using 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\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 10000000; + item.defense = 24; //132 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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" + + "Reduces all damage taken by 10%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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.lavaImmune = true; + 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.magicDamage += 0.2f; + player.magicCrit += 20; + } + + 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 diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index 27ff793c4b..b512b8be0e 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.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.Body)] - public class BloodflareBodyArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Body Armor"); - Tooltip.SetDefault("12% increased damage and 7% increased critical strike chance\n" + - "You regenerate life quickly and gain +30 defense while in lava\n" + - "+40 max life and mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1900000; - item.defense = 35; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 40; - player.statManaMax2 += 40; - player.meleeDamage += 0.12f; - player.meleeCrit += 7; - player.magicDamage += 0.12f; - player.magicCrit += 7; - player.rangedDamage += 0.12f; - player.rangedCrit += 7; - player.thrownDamage += 0.12f; - player.thrownCrit += 7; - 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(); - } - } +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 BloodflareBodyArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Body Armor"); + Tooltip.SetDefault("12% increased damage and 7% increased critical strike chance\n" + + "You regenerate life quickly and gain +30 defense while in lava\n" + + "+40 max life and mana"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1900000; + item.defense = 35; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 40; + player.statManaMax2 += 40; + player.meleeDamage += 0.12f; + player.meleeCrit += 7; + player.magicDamage += 0.12f; + player.magicCrit += 7; + player.rangedDamage += 0.12f; + player.rangedCrit += 7; + player.thrownDamage += 0.12f; + player.thrownCrit += 7; + 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 diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index 4535d7a3d3..2b030a945f 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.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.Legs)] - public class BloodflareCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Cuisses"); - Tooltip.SetDefault("30% increased movement speed, 10% increased damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1762500; - item.defense = 29; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.3f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - player.magicDamage += 0.1f; - player.magicCrit += 10; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - 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(); - } - } +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.Legs)] + public class BloodflareCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Cuisses"); + Tooltip.SetDefault("30% increased movement speed, 10% increased damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1762500; + item.defense = 29; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.3f; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.magicDamage += 0.1f; + player.magicCrit += 10; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + 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 diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index 55370ceb83..f1752919c7 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.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.Armor; - -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 you are immune to lava\n" + - "10% increased throwing damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1750000; - item.defense = 28; //85 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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; - 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 throwing crit by 5%\n" + - "Being below 80% life boosts your throwing damage by 15%\n" + - "Every throwing critical strike will heal you"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.lavaImmune = true; - player.ignoreWater = true; - player.thrownDamage += 0.1f; - player.thrownCrit += 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(); - } - } +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 BloodflareHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Helm"); + Tooltip.SetDefault("You can move freely through liquids and you are immune to lava\n" + + "10% increased throwing damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1750000; + item.defense = 28; //85 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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; + 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 throwing crit by 5%\n" + + "Being below 80% life boosts your throwing damage by 15%\n" + + "Every throwing critical strike will heal you"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.lavaImmune = true; + player.ignoreWater = true; + player.thrownDamage += 0.1f; + player.thrownCrit += 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 diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index d257c1fcf0..ebba0eef9f 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.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.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 you are immune to lava\n" + - "10% increased summon damage and +3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1750000; - item.defense = 16; //85 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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 = "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 15% increased minion damage\n" + - "At 50% life and below you gain 20 defense and 3 life regen"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.lavaImmune = true; - player.ignoreWater = true; - player.minionDamage += 0.1f; - 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(); - } - } +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 you are immune to lava\n" + + "10% increased summon damage and +3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1750000; + item.defense = 16; //85 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 = "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 15% increased minion damage\n" + + "At 50% life and below you gain 20 defense and 3 life regen"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.lavaImmune = true; + player.ignoreWater = true; + player.minionDamage += 0.1f; + 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 diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 42f111267f..53baa11cd7 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.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.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 you are immune to lava\n" + - "10% increased ranged damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1750000; - item.defense = 34; //85 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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.lavaImmune = true; - 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(); - } - } +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 you are immune to lava\n" + + "10% increased ranged damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1750000; + item.defense = 34; //85 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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.lavaImmune = true; + 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 diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index a79149f062..6031b95ff9 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -1,85 +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.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 you are immune to lava\n" + - "10% increased magic damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1750000; - item.defense = 22; //85 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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" + - "For every magic critical hit you will gain a small magic damage boost\n" + - "This effect stacks up to 15%\n" + - "If you haven't gotten a crit in 2 seconds this effect will slowly wear off"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.lavaImmune = true; - player.ignoreWater = true; - player.magicDamage += 0.1f; - player.magicCrit += 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(); - } - } +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 you are immune to lava\n" + + "10% increased magic damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1750000; + item.defense = 22; //85 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.lavaImmune = true; + player.ignoreWater = true; + player.magicDamage += 0.1f; + player.magicCrit += 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 diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 535c1d8cea..bd625c8315 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.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.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 you are immune to lava\n" + - "10% increased melee damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1750000; - item.defense = 49; //85 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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.lavaImmune = true; - 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(); - } - } +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 you are immune to lava\n" + + "10% increased melee damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1750000; + item.defense = 49; //85 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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.lavaImmune = true; + 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 diff --git a/Items/Armor/CalamitasMask.cs b/Items/Armor/CalamitasMask.cs index 2f41170c44..0969164914 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; - } - } +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 diff --git a/Items/Armor/CrabulonMask.cs b/Items/Armor/CrabulonMask.cs index bd509ccc53..035db984de 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; - } - } +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 diff --git a/Items/Armor/CryogenMask.cs b/Items/Armor/CryogenMask.cs index bc215e1237..db29bc60b2 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; - } - } +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 diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index 5904dab9a2..161466a9e3 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.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; - -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 = 250000; - 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; - player.thrownCrit += 3; - player.thrownDamage += 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(); - } - } +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 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 = 250000; + 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; + player.thrownCrit += 3; + player.thrownDamage += 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 diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 1add94317b..93138a647f 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.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 DaedalusHat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Hood"); - Tooltip.SetDefault("10% increased magic damage and critical strike chance\n" + - "Immune to Cursed and gives control over gravity"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 300000; - 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 and critical strike chance\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; - player.magicCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.1f; - player.magicCrit += 10; - player.AddBuff(BuffID.Gravitation, 2); - player.buffImmune[BuffID.Cursed] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Hood"); + Tooltip.SetDefault("10% increased magic damage and critical strike chance\n" + + "Immune to Cursed and gives control over gravity"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 300000; + 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 and critical strike chance\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; + player.magicCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.1f; + player.magicCrit += 10; + player.AddBuff(BuffID.Gravitation, 2); + player.buffImmune[BuffID.Cursed] = true; + } + + 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 diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 2fad49b7c8..a4e11da902 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.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 DaedalusHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Circlet"); - Tooltip.SetDefault("10% increased minion damage and +2 max minions\n" + - "Immune to Cursed and gives control over gravity"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 300000; - 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 = "5% increased summon 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"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.1f; - player.maxMinions += 2; - player.AddBuff(BuffID.Gravitation, 2); - player.buffImmune[BuffID.Cursed] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Circlet"); + Tooltip.SetDefault("10% increased minion damage and +2 max minions\n" + + "Immune to Cursed and gives control over gravity"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 300000; + 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 = "5% increased summon 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"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.1f; + player.maxMinions += 2; + player.AddBuff(BuffID.Gravitation, 2); + player.buffImmune[BuffID.Cursed] = true; + } + + 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 diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index b46418b05a..6acda3c194 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.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 DaedalusHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Helm"); - Tooltip.SetDefault("10% increased melee damage and critical strike chance\n" + - "Immune to Cursed and gives control over gravity"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 300000; - 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 and critical strike chance\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; - player.meleeCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - player.AddBuff(BuffID.Gravitation, 2); - player.buffImmune[BuffID.Cursed] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - 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.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" + + "Immune to Cursed and gives control over gravity"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 300000; + 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 and critical strike chance\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; + player.meleeCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.AddBuff(BuffID.Gravitation, 2); + player.buffImmune[BuffID.Cursed] = true; + } + + 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 diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index 3691a6000e..7ea230bc2a 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.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 DaedalusHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Headgear"); - Tooltip.SetDefault("10% increased ranged damage and critical strike chance, reduces ammo cost by 20%\n" + - "Immune to Cursed and gives control over gravity"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 300000; - 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 and critical strike chance\n" + - "Getting hit causes you to emit a blast of crystal shards"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusShard = true; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ammoCost80 = true; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - player.AddBuff(BuffID.Gravitation, 2); - player.buffImmune[BuffID.Cursed] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Headgear"); + Tooltip.SetDefault("10% increased ranged damage and critical strike chance, reduces ammo cost by 20%\n" + + "Immune to Cursed and gives control over gravity"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 300000; + 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 and critical strike chance\n" + + "Getting hit causes you to emit a blast of crystal shards"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusShard = true; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ammoCost80 = true; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + player.AddBuff(BuffID.Gravitation, 2); + player.buffImmune[BuffID.Cursed] = true; + } + + 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 diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index fdba5bb9f0..68617ecfda 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class DaedalusLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Leggings"); - Tooltip.SetDefault("4% increased critical strike chance\n10% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 262500; - item.rare = 5; - item.defense = 13; //41 - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 4; - player.magicCrit += 4; - player.rangedCrit += 4; - player.thrownCrit += 4; - 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(); - } - } +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.Legs)] + public class DaedalusLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Leggings"); + Tooltip.SetDefault("4% increased critical strike chance\n10% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 262500; + item.rare = 5; + item.defense = 13; //41 + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 4; + player.magicCrit += 4; + player.rangedCrit += 4; + player.thrownCrit += 4; + 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 diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 6d3f51b36e..762f9f9b9f 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.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 DaedalusVisor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Facemask"); - Tooltip.SetDefault("10% increased throwing damage and critcal strike chance, increases throwing velocity by 15%\n" + - "Immune to Cursed and gives control over gravity"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 300000; - 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 throwing damage and critical strike chance\n" + - "Throwing projectiles split into crystal shards on enemy hits"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusSplit = true; - player.thrownDamage += 0.05f; - player.thrownCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.thrownVelocity += 0.15f; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - player.AddBuff(BuffID.Gravitation, 2); - player.buffImmune[BuffID.Cursed] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusVisor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Facemask"); + Tooltip.SetDefault("10% increased throwing damage and critcal strike chance, increases throwing velocity by 15%\n" + + "Immune to Cursed and gives control over gravity"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 300000; + 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 throwing damage and critical strike chance\n" + + "Throwing projectiles throw out crystal shards as they travel"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusSplit = true; + player.thrownDamage += 0.05f; + player.thrownCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.thrownVelocity += 0.15f; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + player.AddBuff(BuffID.Gravitation, 2); + player.buffImmune[BuffID.Cursed] = true; + } + + 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 diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index cccef92fed..48b758e57f 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.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.Armor; - -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, 20% 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 = 10000000; - item.defense = 50; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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 += 20; - player.magicDamage += 0.2f; - player.meleeCrit += 20; - player.meleeDamage += 0.2f; - player.thrownCrit += 20; - player.thrownDamage += 0.2f; - player.rangedCrit += 20; - player.rangedDamage += 0.2f; - player.minionDamage += 0.2f; - 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(); - } - } +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 DemonshadeBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonshade Breastplate"); + Tooltip.SetDefault("20% increased melee speed, 20% 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 = 10000000; + item.defense = 50; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 += 20; + player.magicDamage += 0.2f; + player.meleeCrit += 20; + player.meleeDamage += 0.2f; + player.thrownCrit += 20; + player.thrownDamage += 0.2f; + player.rangedCrit += 20; + player.rangedDamage += 0.2f; + player.minionDamage += 0.2f; + 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 diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 6bf8630838..e6d1bf7c62 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.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.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 = 10000000; - item.defense = 50; //15 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } +using System; +using 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 = 10000000; + item.defense = 50; //15 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 7b646f13b7..260b98f0b3 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.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.Armor; - -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 critical strike chance, +10 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 10000000; - item.defense = 50; //15 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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 = "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" + - "Removes the damage and critical strike chance caps\n" + - "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + - "This makes them do 1.5 times more damage but they also take three times as much damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dsSetBonus = true; - modPlayer.redDevil = true; - if (player.whoAmI == Main.myPlayer) - { - 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"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 10; - player.meleeDamage += 0.3f; - player.thrownDamage += 0.3f; - player.rangedDamage += 0.3f; - player.magicDamage += 0.3f; - player.minionDamage += 0.3f; - player.meleeCrit += 30; - player.magicCrit += 30; - player.rangedCrit += 30; - player.thrownCrit += 30; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 8); - 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.Armor; + +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 critical strike chance, +10 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 10000000; + item.defense = 50; //15 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 = "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" + + "Removes the damage and critical strike chance caps\n" + + "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + + "This makes them do 1.5 times more damage but they also take three times as much damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dsSetBonus = true; + modPlayer.redDevil = true; + if (player.whoAmI == Main.myPlayer) + { + 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"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 10; + player.meleeDamage += 0.3f; + player.thrownDamage += 0.3f; + player.rangedDamage += 0.3f; + player.magicDamage += 0.3f; + player.minionDamage += 0.3f; + player.meleeCrit += 30; + player.magicCrit += 30; + player.rangedCrit += 30; + player.thrownCrit += 30; + } + + 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 diff --git a/Items/Armor/DesertScourgeMask.cs b/Items/Armor/DesertScourgeMask.cs index 2a98f15446..baeaf5d6b9 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; - } - } +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 diff --git a/Items/Armor/DevourerofGodsMask.cs b/Items/Armor/DevourerofGodsMask.cs index 54966f91a3..5a66cc221b 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; - } - } +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 diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 36a71b0bde..974d260b99 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.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.Body)] - public class GodSlayerChestplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Chestplate"); - Tooltip.SetDefault("+60 max life and mana\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" + - "10% increased damage and 6% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 4250000; - item.defense = 41; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayerReflect = true; - player.thorns += 0.5f; - player.statLifeMax2 += 60; - player.statManaMax2 += 60; - player.moveSpeed += 0.15f; - player.meleeDamage += 0.1f; - player.meleeCrit += 6; - player.magicDamage += 0.1f; - player.magicCrit += 6; - player.rangedDamage += 0.1f; - player.rangedCrit += 6; - player.thrownDamage += 0.1f; - player.thrownCrit += 6; - player.minionDamage += 0.1f; - } - - 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(); - } - } +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 GodSlayerChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Chestplate"); + Tooltip.SetDefault("+60 max life and mana\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" + + "10% increased damage and 6% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 4250000; + item.defense = 41; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayerReflect = true; + player.thorns += 0.5f; + player.statLifeMax2 += 60; + player.statManaMax2 += 60; + player.moveSpeed += 0.15f; + player.meleeDamage += 0.1f; + player.meleeCrit += 6; + player.magicDamage += 0.1f; + player.magicCrit += 6; + player.rangedDamage += 0.1f; + player.rangedCrit += 6; + player.thrownDamage += 0.1f; + player.thrownCrit += 6; + player.minionDamage += 0.1f; + } + + 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 diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 5908918303..d78fc93f51 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.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.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 = 5000000; - item.defense = 48; //96 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 cause the attack to do no damage to you"; - 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(); - } - } +using System; +using 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 = 5000000; + item.defense = 48; //96 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 5296c62521..9a505a7620 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.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 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 = 5000000; - item.defense = 35; //96 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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(); - } - } +using System; +using 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 = 5000000; + item.defense = 35; //96 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs index 9e7df938bf..e11335893d 100644 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -1,202 +1,202 @@ -using System; -using 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("14% increased summon damage and +3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 5000000; - item.defense = 12; //96 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 = "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"; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 3; - player.minionDamage += 0.14f; - } - - 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(); - } - } +using System; +using 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("14% increased summon damage and +3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 5000000; + item.defense = 12; //96 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 = "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"; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 3; + player.minionDamage += 0.14f; + } + + 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 diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index ea2ffc5029..92ebaf9d03 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.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.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 critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 3750000; - item.defense = 35; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.35f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - player.magicDamage += 0.1f; - player.magicCrit += 10; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - 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(); - } - } +using System; +using 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 GodSlayerLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Leggings"); + Tooltip.SetDefault("35% increased movement speed\n" + + "10% increased damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 3750000; + item.defense = 35; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.35f; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.magicDamage += 0.1f; + player.magicCrit += 10; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + 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 diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index f77cdf6f47..77eaff9f63 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.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 GodSlayerMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Mask"); - Tooltip.SetDefault("14% increased throwing damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 5000000; - item.defense = 29; //96 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - 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 throwing stats are boosted by 15%\n" + - "If you take over 80 damage in one hit you will be given extra immunity frames"; - } - - public override void UpdateEquip(Player player) - { - player.thrownDamage += 0.14f; - player.thrownCrit += 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(); - } - } +using System; +using 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 GodSlayerMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Mask"); + Tooltip.SetDefault("14% increased throwing damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 5000000; + item.defense = 29; //96 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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; + 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 throwing stats are boosted by 15%\n" + + "If you take over 80 damage in one hit you will be given extra immunity frames"; + } + + public override void UpdateEquip(Player player) + { + player.thrownDamage += 0.14f; + player.thrownCrit += 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 diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index baf5aee07b..75c00188b5 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.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 GodSlayerVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Visage"); - Tooltip.SetDefault("14% increased magic damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 5000000; - item.defense = 21; //96 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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.magicDamage += 0.14f; - player.magicCrit += 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(); - } - } +using System; +using 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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 5000000; + item.defense = 21; //96 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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.magicDamage += 0.14f; + player.magicCrit += 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 diff --git a/Items/Armor/HiveMindMask.cs b/Items/Armor/HiveMindMask.cs index 01a88d0bfa..1c3c0539f6 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; - } - } +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 diff --git a/Items/Armor/LeviathanMask.cs b/Items/Armor/LeviathanMask.cs index 727e659f3a..e913f874bf 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; - } - } +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 diff --git a/Items/Armor/PerforatorMask.cs b/Items/Armor/PerforatorMask.cs index 0e69f86ece..0574975e9c 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; - } - } +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 diff --git a/Items/Armor/PlaguebringerGoliathMask.cs b/Items/Armor/PlaguebringerGoliathMask.cs index b4e45ce4f2..b0c5d63f92 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; - } - } +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 diff --git a/Items/Armor/ProvidenceMask.cs b/Items/Armor/ProvidenceMask.cs index da96d0a4bb..c45584f46c 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; - } - } +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 diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index 7c13b9daa3..70d2f1a85f 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverCap : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Headgear"); - Tooltip.SetDefault("10% increased throwing damage, 5% increased throwing velocity and 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 = 350000; - item.rare = 6; - 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; - player.setBonus = "5% increased throwing damage and critical strike chance\n" + - "You emit a cloud of spores when you are hit\n" + - "Rage activates when you are damaged"; - player.thrownDamage += 0.05f; - player.thrownCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.thrownDamage += 0.1f; - player.thrownCrit += 5; - player.thrownVelocity += 0.05f; - 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(); - } - } +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 ReaverCap : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Headgear"); + Tooltip.SetDefault("10% increased throwing damage, 5% increased throwing velocity and 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 = 350000; + item.rare = 6; + 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; + player.setBonus = "5% increased throwing damage and critical strike chance\n" + + "You emit a cloud of spores when you are hit\n" + + "Rage activates when you are damaged"; + player.thrownDamage += 0.05f; + player.thrownCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.thrownDamage += 0.1f; + player.thrownCrit += 5; + player.thrownVelocity += 0.05f; + 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 diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index 9fd1762b68..c297996506 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.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.Armor; - -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\n12% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 312500; - item.rare = 6; - item.defense = 14; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 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(); - } - } +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.Legs)] + public class ReaverCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Cuisses"); + Tooltip.SetDefault("5% increased critical strike chance\n12% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 312500; + item.rare = 6; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 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 diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index 619a65d501..3e928d2225 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Helm"); - Tooltip.SetDefault("10% increased melee damage, 5% increased melee speed and 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 = 350000; - item.rare = 6; - 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 and critical strike chance\n" + - "Melee projectiles explode on hit\n" + - "Reaver thorns\n" + - "Rage activates when you are damaged"; - player.meleeDamage += 0.05f; - player.meleeCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - player.meleeSpeed += 0.05f; - 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(); - } - } +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("10% increased melee damage, 5% increased melee speed and 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 = 350000; + item.rare = 6; + 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 and critical strike chance\n" + + "Melee projectiles explode on hit\n" + + "Reaver thorns\n" + + "Rage activates when you are damaged"; + player.meleeDamage += 0.05f; + player.meleeCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + player.meleeSpeed += 0.05f; + 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 diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs index d3f2aba01b..7e6873aede 100644 --- a/Items/Armor/ReaverHelmet.cs +++ b/Items/Armor/ReaverHelmet.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Helmet"); - Tooltip.SetDefault("10% increased summon 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 = 350000; - item.rare = 6; - 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 = "5% increased summon damage\n" + - "Summons a reaver orb that emits spore gas when enemies are near\n" + - "Rage activates when you are damaged"; - 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"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.minionDamage += 0.1f; - 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(); - } - } +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("10% increased summon 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 = 350000; + item.rare = 6; + 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 = "5% increased summon damage\n" + + "Summons a reaver orb that emits spore gas when enemies are near\n" + + "Rage activates when you are damaged"; + 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"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.minionDamage += 0.1f; + 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 diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs index 3687712c83..700bce5b09 100644 --- a/Items/Armor/ReaverMask.cs +++ b/Items/Armor/ReaverMask.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Mask"); - Tooltip.SetDefault("10% increased magic damage, 5% reduced mana cost, and 5% increased magic critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 350000; - item.rare = 6; - 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 and critical strike chance\n" + - "Your magic projectiles emit a burst of spore gas on enemy hits\n" + - "Rage activates when you are damaged"; - player.magicDamage += 0.05f; - player.magicCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.magicDamage += 0.1f; - player.magicCrit += 5; - player.manaCost *= 0.95f; - 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(); - } - } +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("10% increased magic damage, 5% reduced mana cost, and 5% increased magic critical strike chance\n" + + "10% increased movement speed and can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 350000; + item.rare = 6; + 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 and critical strike chance\n" + + "Your magic projectiles emit a burst of spore gas on enemy hits\n" + + "Rage activates when you are damaged"; + player.magicDamage += 0.05f; + player.magicCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.magicDamage += 0.1f; + player.magicCrit += 5; + player.manaCost *= 0.95f; + 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 diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 6016612135..3dc7a4720f 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.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.Armor; - -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\nProvides life regeneration\n+20 max life"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.lifeRegen = 1; - item.value = 300000; - item.rare = 6; - 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; - player.thrownCrit += 4; - player.thrownDamage += 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(); - } - } +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 ReaverScaleMail : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Scale Mail"); + Tooltip.SetDefault("9% increased damage and 4% increased critical strike chance\nProvides life regeneration\n+20 max life"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.lifeRegen = 1; + item.value = 300000; + item.rare = 6; + 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; + player.thrownCrit += 4; + player.thrownDamage += 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 diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index 7e854a0585..20df3d5442 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Visage"); - Tooltip.SetDefault("10% 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 = 350000; - item.rare = 6; - 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 and critical strike chance\n" + - "While using a ranged weapon you have a 10% chance to fire a powerful rocket\n" + - "Rage activates when you are damaged"; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.rangedDamage += 0.1f; - 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(); - } - } +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("10% 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 = 350000; + item.rare = 6; + 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 and critical strike chance\n" + + "While using a ranged weapon you have a 10% chance to fire a powerful rocket\n" + + "Rage activates when you are damaged"; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.rangedDamage += 0.1f; + 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 diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index 944251a430..bca07a4b53 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.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.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 = 375000; - 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(); - } +using System; +using 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 = 375000; + 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 diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 417e2a431b..01d9200cd1 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.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.Body)] - public class SilvaArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Armor"); - Tooltip.SetDefault("+80 max life and mana\n" + - "20% increased movement speed\n" + - "12% increased damage and 10% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 8250000; - item.defense = 44; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 80; - player.statManaMax2 += 80; - player.moveSpeed += 0.2f; - player.meleeDamage += 0.12f; - player.meleeCrit += 10; - player.rangedDamage += 0.12f; - player.rangedCrit += 10; - player.magicDamage += 0.12f; - player.magicCrit += 10; - player.thrownDamage += 0.12f; - player.thrownCrit += 10; - 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, "NightmareFuel", 16); - recipe.AddIngredient(null, "EndothermicEnergy", 16); - recipe.AddIngredient(null, "LeadCore"); - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class SilvaArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Armor"); + Tooltip.SetDefault("+80 max life and mana\n" + + "20% increased movement speed\n" + + "12% increased damage and 10% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 8250000; + item.defense = 44; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 80; + player.statManaMax2 += 80; + player.moveSpeed += 0.2f; + player.meleeDamage += 0.12f; + player.meleeCrit += 10; + player.rangedDamage += 0.12f; + player.rangedCrit += 10; + player.magicDamage += 0.12f; + player.magicCrit += 10; + player.thrownDamage += 0.12f; + player.thrownCrit += 10; + 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, "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 diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index a38942bcc2..757d8b281a 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.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.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 = 9000000; - item.defense = 52; //110 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + - "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 halved 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, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 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.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 = 9000000; + item.defense = 52; //110 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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" + + "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing leaf orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 5%\n" + + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + + "This effect only triggers once per life\n" + + "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 halved 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, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index a3580e90ef..8bf730da90 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.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 SilvaHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Helmet"); - Tooltip.SetDefault("13% increased summon damage and +5 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 9000000; - item.defense = 13; //110 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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 = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\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 15% 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)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.13f; - 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, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Helmet"); + Tooltip.SetDefault("13% increased summon damage and +5 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 9000000; + item.defense = 13; //110 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 = "You are immune to almost all debuffs\n" + + "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing leaf orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 5%\n" + + "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + + "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + + "This effect only triggers once per life\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 15% 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)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.13f; + 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, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index a2bd66b437..68f54a2a54 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.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; - -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 = 9000000; - item.defense = 36; //110 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\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 50% 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, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 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.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 = 9000000; + item.defense = 36; //110 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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" + + "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing leaf orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 5%\n" + + "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + + "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + + "This effect only triggers once per life\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 50% 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, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index ee9c94c797..571dcc014b 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.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.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 9% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 7750000; - item.defense = 39; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.45f; - player.meleeDamage += 0.12f; - player.meleeCrit += 9; - player.rangedDamage += 0.12f; - player.rangedCrit += 9; - player.magicDamage += 0.12f; - player.magicCrit += 9; - player.thrownDamage += 0.12f; - player.thrownCrit += 9; - 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, "NightmareFuel", 15); - recipe.AddIngredient(null, "EndothermicEnergy", 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.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 9% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 7750000; + item.defense = 39; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.45f; + player.meleeDamage += 0.12f; + player.meleeCrit += 9; + player.rangedDamage += 0.12f; + player.rangedCrit += 9; + player.magicDamage += 0.12f; + player.magicCrit += 9; + player.thrownDamage += 0.12f; + player.thrownCrit += 9; + 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, "NightmareFuel", 15); + recipe.AddIngredient(null, "EndothermicEnergy", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 2084647525..954bcf763b 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Mask"); - Tooltip.SetDefault("13% increased throwing damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 9000000; - item.defense = 30; //110 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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; - player.setBonus = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + - "Your max life will return to normal if you die\n" + - "Throwing weapons have a faster throwing rate while you are above 90% life\n" + - "After the silva invulnerability time your throwing weapons will do 20% more damage"; - } - - public override void UpdateEquip(Player player) - { - player.thrownDamage += 0.13f; - player.thrownCrit += 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, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Mask"); + Tooltip.SetDefault("13% increased throwing damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 9000000; + item.defense = 30; //110 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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; + player.setBonus = "You are immune to almost all debuffs\n" + + "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing leaf orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 5%\n" + + "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + + "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + + "This effect only triggers once per life\n" + + "Your max life will return to normal if you die\n" + + "Throwing weapons have a faster throwing rate while you are above 90% life\n" + + "After the silva invulnerability time your throwing weapons will do 20% more damage"; + } + + public override void UpdateEquip(Player player) + { + player.thrownDamage += 0.13f; + player.thrownCrit += 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, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 16bd811a9a..54f8a907bc 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.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; - -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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 9000000; - item.defense = 21; //110 - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\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 have 10% more critical strike chance and damage"; - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.13f; - player.magicCrit += 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, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 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.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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 9000000; + item.defense = 21; //110 + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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" + + "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + + "All projectiles spawn healing leaf orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 5%\n" + + "If you are reduced to 0 HP you will not die from any further damage for 10 seconds\n" + + "If you get reduced to 0 HP again while this effect is active you will lose 100 max life\n" + + "This effect only triggers once per life\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 have 10% more critical strike chance and damage"; + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.13f; + player.magicCrit += 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, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs index 7b465c5081..89b1b62a9b 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 25% 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 = 1000000; - 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; - } - } +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 25% 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 = 1000000; + 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 diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs index 1ab3374421..677e8f8432 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 25% 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 = 1000000; - 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; - } - } +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 25% 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 = 1000000; + 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 diff --git a/Items/Armor/SlimeGodMask.cs b/Items/Armor/SlimeGodMask.cs index b30aeb1338..d3410d3bc9 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; - } - } +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 diff --git a/Items/Armor/SlimeGodMask2.cs b/Items/Armor/SlimeGodMask2.cs index e7fae5ecf4..24320035e0 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; - } - } +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 diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 03ecc80e39..dcedd28cde 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.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.Armor; - -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 = 150000; - item.rare = 5; - item.defense = 10; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 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(); - } - } +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 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 = 150000; + item.rare = 5; + item.defense = 10; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 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 diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 3fb8b0abc3..b10c4897e8 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.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 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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 200000; - item.rare = 5; - 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; - } - - 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(); - } - } +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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 200000; + item.rare = 5; + 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; + } + + 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 diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index e86ae55276..ed5a96fdfd 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.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; - -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 = 122500; - item.rare = 5; - item.defense = 8; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.05f; - player.magicDamage += 0.05f; - player.rangedDamage += 0.05f; - player.thrownDamage += 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(); - } - } +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.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 = 122500; + item.rare = 5; + item.defense = 8; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.05f; + player.magicDamage += 0.05f; + player.rangedDamage += 0.05f; + player.thrownDamage += 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 diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index a546bc2889..0a76e0a991 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 = 200000; - item.rare = 5; - 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(); - } - } +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 = 200000; + item.rare = 5; + 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 diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index 57f2b3a9e1..bc224223fa 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 = 200000; - item.rare = 5; - 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(); - } - } +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 = 200000; + item.rare = 5; + 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 diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index b6b8c59bb7..2444e992aa 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("10% increased summon damage and increased minion knockback\n" + - "+1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 200000; - item.rare = 5; - 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 = "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; - 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"), 33, 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"), 33, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void UpdateEquip(Player player) - { - player.minionKB += 1.5f; - player.minionDamage += 0.1f; - 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(); - } - } +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("10% increased summon damage and increased minion knockback\n" + + "+1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 200000; + item.rare = 5; + 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 = "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; + 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"), 33, 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"), 33, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void UpdateEquip(Player player) + { + player.minionKB += 1.5f; + player.minionDamage += 0.1f; + 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 diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 3e8a20bfed..cf1a024d6a 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.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 StatigelMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Mask"); - Tooltip.SetDefault("10% increased throwing damage and 33% chance to not consume thrown items\n" + - "7% increased throwing critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 200000; - item.rare = 5; - 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"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - player.doubleJumpSail = true; - player.jumpBoost = true; - } - - public override void UpdateEquip(Player player) - { - player.thrownCost33 = true; - player.thrownDamage += 0.1f; - player.thrownCrit += 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(); - } - } +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 StatigelMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Mask"); + Tooltip.SetDefault("10% increased throwing damage and 33% chance to not consume thrown items\n" + + "7% increased throwing critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 200000; + item.rare = 5; + 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"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + player.doubleJumpSail = true; + player.jumpBoost = true; + } + + public override void UpdateEquip(Player player) + { + player.thrownCost33 = true; + player.thrownDamage += 0.1f; + player.thrownCrit += 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 diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 8b4b06abf6..b307e947dc 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.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.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" + - "+3 life regen\n" + - "+40 max life and mana\n" + - "Breastplate of the exiler"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.lifeRegen = 3; - item.value = 1500000; - item.defense = 37; - } - - 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 void UpdateEquip(Player player) - { - player.statLifeMax2 += 40; - player.statManaMax2 += 40; - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - player.magicDamage += 0.1f; - player.magicCrit += 5; - player.rangedDamage += 0.1f; - player.rangedCrit += 5; - player.thrownDamage += 0.1f; - player.thrownCrit += 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(); - } - } +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 TarragonBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Breastplate"); + Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\n" + + "+3 life regen\n" + + "+40 max life and mana\n" + + "Breastplate of the exiler"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.lifeRegen = 3; + item.value = 1500000; + item.defense = 37; + } + + 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 void UpdateEquip(Player player) + { + player.statLifeMax2 += 40; + player.statManaMax2 += 40; + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + player.magicDamage += 0.1f; + player.magicCrit += 5; + player.rangedDamage += 0.1f; + player.rangedCrit += 5; + player.thrownDamage += 0.1f; + player.thrownCrit += 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 diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index de195d8781..3818d8db25 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Helm"); - Tooltip.SetDefault("Immune to lava, 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 = 1550000; - item.defense = 33; //98 - } - - 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 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 regen health quickly 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.lavaImmune = true; - 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(); - } - } +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("Immune to lava, 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 = 1550000; + item.defense = 33; //98 + } + + 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 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 regen health quickly 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.lavaImmune = true; + 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 diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 0ba95cbdf8..78ec5508c7 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Helmet"); - Tooltip.SetDefault("Immune to lava, cursed inferno, fire, cursed, and chilled debuffs\n" + - "Can move freely through liquids\n" + - "10% increased throwing damage and critical strike chance\n" + - "5% increased damage reduction"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1550000; - item.defense = 15; //98 - } - - 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 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; - 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 throwing 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 throwing damage"; - } - - public override void UpdateEquip(Player player) - { - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - player.endurance += 0.05f; - player.lavaImmune = true; - 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(); - } - } +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 TarragonHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Helmet"); + Tooltip.SetDefault("Immune to lava, cursed inferno, fire, cursed, and chilled debuffs\n" + + "Can move freely through liquids\n" + + "10% increased throwing damage and critical strike chance\n" + + "5% increased damage reduction"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1550000; + item.defense = 15; //98 + } + + 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 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; + 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 throwing 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 throwing damage"; + } + + public override void UpdateEquip(Player player) + { + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + player.endurance += 0.05f; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index 70d86aeed3..26c3af3252 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Horned Helm"); - Tooltip.SetDefault("Immune to lava, cursed inferno, fire, cursed, and chilled debuffs\n" + - "Can move freely through liquids\n" + - "10% increased summon damage\n" + - "5% increased damage reduction and +3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1550000; - item.defense = 3; //98 - } - - 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 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 = "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 summon damage\n" + - "Summons a life aura around you that damages nearby enemies"; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.1f; - player.maxMinions += 3; - player.endurance += 0.05f; - player.lavaImmune = true; - 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(); - } - } +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("Immune to lava, cursed inferno, fire, cursed, and chilled debuffs\n" + + "Can move freely through liquids\n" + + "10% increased summon damage\n" + + "5% increased damage reduction and +3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1550000; + item.defense = 3; //98 + } + + 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 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 = "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 summon damage\n" + + "Summons a life aura around you that damages nearby enemies"; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.1f; + player.maxMinions += 3; + player.endurance += 0.05f; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index 5cbc70212f..c09f9d707c 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.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.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" + - "10% increased damage and critical strike chance\n" + - "Leggings of a fabled explorer"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1462500; - item.defense = 32; - } - - 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 void UpdateEquip(Player player) - { - player.moveSpeed += 0.20f; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.moveSpeed += 0.15f; - } - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - player.magicDamage += 0.1f; - player.magicCrit += 10; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - player.thrownDamage += 0.1f; - player.thrownCrit += 10; - player.minionDamage += 0.1f; - } - - 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(); - } - } +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.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" + + "10% increased damage and critical strike chance\n" + + "Leggings of a fabled explorer"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1462500; + item.defense = 32; + } + + 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 void UpdateEquip(Player player) + { + player.moveSpeed += 0.20f; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.moveSpeed += 0.15f; + } + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.magicDamage += 0.1f; + player.magicCrit += 10; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + player.thrownDamage += 0.1f; + player.thrownCrit += 10; + player.minionDamage += 0.1f; + } + + 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 diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 5c91b6fb2c..742f9afbc8 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.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; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Mask"); - Tooltip.SetDefault("Immune to lava, 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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 1550000; - item.defense = 10; //98 - } - - 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 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.magicDamage += 0.1f; - player.magicCrit += 10; - player.endurance += 0.05f; - player.lavaImmune = true; - 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(); - } - } +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("Immune to lava, 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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 1550000; + item.defense = 10; //98 + } + + 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 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.magicDamage += 0.1f; + player.magicCrit += 10; + player.endurance += 0.05f; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index 754f540904..cae96559c5 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -1,91 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Visage"); - Tooltip.SetDefault("Immune to lava, 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 = 1550000; - item.defense = 21; //98 - } - - 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 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" + - "For every ranged critical strike you get you will gain a small ranged damage boost\n" + - "This effect stacks up to 10%\n" + - "If you haven't gotten a crit in 2 seconds this effect will slowly wear off\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.lavaImmune = true; - 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(); - } - } +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("Immune to lava, 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 = 1550000; + item.defense = 21; //98 + } + + 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 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.lavaImmune = true; + 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 diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index 403c6412ba..b24927136b 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.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.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 = 38000; - item.rare = 2; - item.defense = 5; //9 - } - - public override void UpdateEquip(Player player) - { - player.endurance += 0.05f; - player.meleeCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 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(); - } - } +using System; +using 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.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 = 38000; + item.rare = 2; + item.defense = 5; //9 + } + + public override void UpdateEquip(Player player) + { + player.endurance += 0.05f; + player.meleeCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 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 diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index ee325c2207..fbea5c880d 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.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 VictideHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Headgear"); - Tooltip.SetDefault("5% increased throwing damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 40000; - 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 throwing 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.thrownDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.thrownDamage += 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(); - } - } +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 VictideHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Headgear"); + Tooltip.SetDefault("5% increased throwing damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 40000; + 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 throwing 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.thrownDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.thrownDamage += 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 diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 6e7454bf3c..93297c8c12 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 = 40000; - 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(); - } - } +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 = 40000; + 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 diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 34d28c04d7..372ed5f388 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Helmet"); - Tooltip.SetDefault("5% increased summon damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 40000; - 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 summon 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"), 0, 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.05f; - } - - 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.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Helmet"); + Tooltip.SetDefault("5% increased summon damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 40000; + 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 summon 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"), 0, 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.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 diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs index b0854c04d3..d04c28a621 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 = 37500; - 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(); - } - } +using System; +using 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 = 37500; + 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 diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index ae30d0ad13..a9888a6a91 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 = 40000; - 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(); - } - } +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 = 40000; + 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 diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 5f02794ece..5c23b2d649 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 = 40000; - 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(); - } - } +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 = 40000; + 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 diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index 5ccd5b17fb..4ef0d23643 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.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.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 = 18000; - item.rare = 1; - item.defense = 2; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.magicCrit += 3; - player.rangedCrit += 3; - player.thrownCrit += 3; - } - - 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.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 = 18000; + item.rare = 1; + item.defense = 2; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.magicCrit += 3; + player.rangedCrit += 3; + player.thrownCrit += 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 diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index 5eac51d970..aeac07b7ec 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 = 20000; - 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(); - } - } +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 = 20000; + 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 diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 21b1d9a1d7..0282d634cd 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 = 20000; - 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(); - } - } +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 = 20000; + 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 diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index 4f273109b7..3616186440 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("3% increased summon damage\n" + - "+1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 20000; - 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.03f; - 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(); - } - } +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("3% increased summon damage\n" + + "+1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 20000; + 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.03f; + 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 diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index a2491c17cc..bf820311f6 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 = 20000; - 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(); - } - } +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 = 20000; + 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 diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index cb1eb9bdca..afbf36189b 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 = 17500; - 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(); - } - } +using System; +using 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 = 17500; + 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 diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index d77ffb10ec..e602df790a 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.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 WulfrumMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Mask"); - Tooltip.SetDefault("3% increased throwing damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 20000; - 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.thrownDamage += 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(); - } - } +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 WulfrumMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Mask"); + Tooltip.SetDefault("3% increased throwing damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 20000; + 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.thrownDamage += 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 diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index d1fc30459e..58fc367f0e 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class XerocCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Cuisses"); - Tooltip.SetDefault("5% increased 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 = 375000; - item.rare = 9; - item.defense = 24; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.rangedCrit += 5; - player.thrownCrit += 5; - player.magicCrit += 5; - 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(); - } - } +using System; +using 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 XerocCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Cuisses"); + Tooltip.SetDefault("5% increased 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 = 375000; + item.rare = 9; + item.defense = 24; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.rangedCrit += 5; + player.thrownCrit += 5; + player.magicCrit += 5; + 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 diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 24cf81be73..62e8880267 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class XerocMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Mask"); - Tooltip.SetDefault("12% increased damage and critical strike chance and +3 max minions\n" + - "Immune to lava, cursed, fire, cursed inferno, and chilled\n" + - "Wrath of the cosmos"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 500000; - 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; - player.setBonus = "7% increased damage and critical strike chance\n" + - "All projectile types have special effects on enemy hits\n" + - "Imbued with cosmic wrath and rage when you are damaged"; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(BuffID.Wrath, 2); - player.AddBuff(BuffID.Rage, 2); - } - player.meleeDamage += 0.07f; - player.meleeCrit += 7; - player.rangedDamage += 0.07f; - player.rangedCrit += 7; - player.magicDamage += 0.07f; - player.magicCrit += 7; - player.thrownDamage += 0.07f; - player.thrownCrit += 7; - player.minionDamage += 0.07f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 3; - player.meleeDamage += 0.12f; - player.meleeCrit += 12; - player.rangedDamage += 0.12f; - player.rangedCrit += 12; - player.magicDamage += 0.12f; - player.magicCrit += 12; - player.thrownDamage += 0.12f; - player.thrownCrit += 12; - player.minionDamage += 0.12f; - player.lavaImmune = true; - 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(); - } - } +using System; +using 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 XerocMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Mask"); + Tooltip.SetDefault("12% increased damage and critical strike chance and +3 max minions\n" + + "Immune to lava, cursed, fire, cursed inferno, and chilled\n" + + "Wrath of the cosmos"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 500000; + 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; + player.setBonus = "7% increased damage and critical strike chance\n" + + "All projectile types have special effects on enemy hits\n" + + "Imbued with cosmic wrath and rage when you are damaged"; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Wrath, 2); + player.AddBuff(BuffID.Rage, 2); + } + player.meleeDamage += 0.07f; + player.meleeCrit += 7; + player.rangedDamage += 0.07f; + player.rangedCrit += 7; + player.magicDamage += 0.07f; + player.magicCrit += 7; + player.thrownDamage += 0.07f; + player.thrownCrit += 7; + player.minionDamage += 0.07f; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 3; + player.meleeDamage += 0.12f; + player.meleeCrit += 12; + player.rangedDamage += 0.12f; + player.rangedCrit += 12; + player.magicDamage += 0.12f; + player.magicCrit += 12; + player.thrownDamage += 0.12f; + player.thrownCrit += 12; + player.minionDamage += 0.12f; + player.lavaImmune = true; + 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 diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 8ba60825d2..d328763f2c 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.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.Armor; - -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 and mana\n" + - "6% increased movement speed\n" + - "6% increased damage and critical strike chance\n" + - "Armor of the cosmos"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = 425000; - item.rare = 9; - item.defense = 27; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - player.moveSpeed += 0.06f; - player.meleeCrit += 6; - player.meleeDamage += 0.06f; - player.magicCrit += 6; - player.magicDamage += 0.06f; - player.rangedCrit += 6; - player.rangedDamage += 0.06f; - player.thrownCrit += 6; - player.thrownDamage += 0.06f; - player.minionDamage += 0.06f; - } - - 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(); - } - } +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 XerocPlateMail : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Plate Mail"); + Tooltip.SetDefault("+20 max life and mana\n" + + "6% increased movement speed\n" + + "6% increased damage and critical strike chance\n" + + "Armor of the cosmos"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = 425000; + item.rare = 9; + item.defense = 27; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.statManaMax2 += 20; + player.moveSpeed += 0.06f; + player.meleeCrit += 6; + player.meleeDamage += 0.06f; + player.magicCrit += 6; + player.magicDamage += 0.06f; + player.rangedCrit += 6; + player.rangedDamage += 0.06f; + player.thrownCrit += 6; + player.thrownDamage += 0.06f; + player.minionDamage += 0.06f; + } + + 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 diff --git a/Items/Armor/YharonMask.cs b/Items/Armor/YharonMask.cs index 39c63691c4..72a5a4af61 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; - } - } +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 diff --git a/Items/AshenKey.cs b/Items/AshenKey.cs index cacf072e16..81878aa556 100644 --- a/Items/AshenKey.cs +++ b/Items/AshenKey.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class AshenKey : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Fragile key of the Profaned Crags. Can be used to remove the lock of an Ashen Chest, at the cost of the key"); - } - - 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(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldenKey); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } -} +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class AshenKey : ModItem + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Fragile key of the Profaned Crags. Can be used to remove the lock of an Ashen Chest, at the cost of the key"); + } + + 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(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldenKey); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Astrageldon/AstrageldonBag.cs b/Items/Astrageldon/AstrageldonBag.cs index e30de459ba..ba8e9edcaa 100644 --- a/Items/Astrageldon/AstrageldonBag.cs +++ b/Items/Astrageldon/AstrageldonBag.cs @@ -1,46 +1,46 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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 (NPC.downedMoonlord) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("SquishyBeanMount")); - } - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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 (NPC.downedMoonlord) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("SquishyBeanMount")); + } + } + } + } } \ No newline at end of file diff --git a/Items/Astrageldon/AstralChunk.cs b/Items/Astrageldon/AstralChunk.cs index 5f477bba3e..62f40dc3f6 100644 --- a/Items/Astrageldon/AstralChunk.cs +++ b/Items/Astrageldon/AstralChunk.cs @@ -1,51 +1,51 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Astrageldon -{ - public class AstralChunk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Chunk"); - } - - 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(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Astrageldon +{ + public class AstralChunk : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Chunk"); + } + + 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 diff --git a/Items/Astrageldon/AstralJelly.cs b/Items/Astrageldon/AstralJelly.cs index 5a5a2f1228..b974589682 100644 --- a/Items/Astrageldon/AstralJelly.cs +++ b/Items/Astrageldon/AstralJelly.cs @@ -1,44 +1,44 @@ -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"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.healMana = 200; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 7; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = 50000; - item.buffType = 26; - item.buffTime = 108000; - } - - public override bool UseItem(Player player) - { - player.AddBuff(BuffID.ManaRegeneration, 21600); - player.AddBuff(BuffID.MagicPower, 21600); - return true; - } - } +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"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.healMana = 200; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 7; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = 50000; + item.buffType = 26; + item.buffTime = 108000; + } + + public override bool UseItem(Player player) + { + player.AddBuff(BuffID.ManaRegeneration, 21600); + player.AddBuff(BuffID.MagicPower, 21600); + return true; + } + } } \ No newline at end of file diff --git a/Items/AstrumDeus/AstrumDeusBag.cs b/Items/AstrumDeus/AstrumDeusBag.cs index 9103512333..195f22d488 100644 --- a/Items/AstrumDeus/AstrumDeusBag.cs +++ b/Items/AstrumDeus/AstrumDeusBag.cs @@ -1,54 +1,54 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - player.TryGettingDevArmor(); - player.QuickSpawnItem(mod.ItemType("Stardust"), Main.rand.Next(60, 91)); - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(mod.ItemType("Starfall")); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(mod.ItemType("Nebulash")); - } - player.QuickSpawnItem(mod.ItemType("AstralBulwark")); - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("StarlightFuelCell")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("AstrumDeusMask")); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + player.TryGettingDevArmor(); + player.QuickSpawnItem(mod.ItemType("Stardust"), Main.rand.Next(60, 91)); + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(mod.ItemType("Starfall")); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(mod.ItemType("Nebulash")); + } + player.QuickSpawnItem(mod.ItemType("AstralBulwark")); + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("StarlightFuelCell")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("AstrumDeusMask")); + } + } + } } \ No newline at end of file diff --git a/Items/AstrumDeus/Starcore.cs b/Items/AstrumDeus/Starcore.cs index f6ae5041b1..721aa131e1 100644 --- a/Items/AstrumDeus/Starcore.cs +++ b/Items/AstrumDeus/Starcore.cs @@ -1,53 +1,53 @@ -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"); - } - - 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) - { - 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.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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"); + } + + 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) + { + 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.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/BarofLife.cs b/Items/BarofLife.cs index 66dc38c464..c7204df670 100644 --- a/Items/BarofLife.cs +++ b/Items/BarofLife.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 BarofLife : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bar of Life"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = 900000; - item.rare = 10; - } - - 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(); - } +using System; +using 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 = 15; + item.height = 12; + item.maxStack = 999; + item.value = 900000; + item.rare = 10; + } + + 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 diff --git a/Items/BeastialPickaxe.cs b/Items/BeastialPickaxe.cs index 4014c59cb0..d51dc58d09 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 = 177000; - item.rare = 6; - 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, 200); - } - } +using System; +using 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 = 177000; + item.rare = 6; + 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, 200); + } + } } \ No newline at end of file diff --git a/Items/BeetleJuice.cs b/Items/BeetleJuice.cs index 5dc6adf73f..340cbbf426 100644 --- a/Items/BeetleJuice.cs +++ b/Items/BeetleJuice.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 10000; - item.rare = 5; - } +using System; +using 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 = 10000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/BerserkerWaraxe.cs b/Items/BerserkerWaraxe.cs index fde07e1185..2d1501b5da 100644 --- a/Items/BerserkerWaraxe.cs +++ b/Items/BerserkerWaraxe.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 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 = 650000; - item.rare = 6; - 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, 200); - } +using System; +using 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 = 650000; + item.rare = 6; + 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, 200); + } }} \ No newline at end of file diff --git a/Items/BlightedLens.cs b/Items/BlightedLens.cs index aaf42afd5f..eb8bbdf629 100644 --- a/Items/BlightedLens.cs +++ b/Items/BlightedLens.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 5000; - item.rare = 2; - } +using System; +using 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 = 5000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/BloodIdol.cs b/Items/BloodIdol.cs index 6a7a9126f2..ad32126f2e 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(); - } - } +using System; +using 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 diff --git a/Items/BloodOrange.cs b/Items/BloodOrange.cs index 3a088bc2c8..2b32bc6812 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(); - } - } +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 diff --git a/Items/BloodOrb.cs b/Items/BloodOrb.cs index a8c8f511c7..de60afb9c9 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 = 37500; - 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); - } - } +using System; +using 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 = 37500; + 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 diff --git a/Items/BloodlettingEssence.cs b/Items/BloodlettingEssence.cs index b95d12bdf0..296f5759e3 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 = 5000; - item.rare = 1; - } - } +using System; +using 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 = 5000; + item.rare = 1; + } + } } \ No newline at end of file diff --git a/Items/Bloodstone.cs b/Items/Bloodstone.cs index f55e862f77..0d759d7990 100644 --- a/Items/Bloodstone.cs +++ b/Items/Bloodstone.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 Bloodstone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodstone"); - } - - public override void SetDefaults() - { - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = 37500; - item.rare = 10; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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 = 37500; + item.rare = 10; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } } \ No newline at end of file diff --git a/Items/BloodstoneCore.cs b/Items/BloodstoneCore.cs index d4a5a9ef53..47b3601702 100644 --- a/Items/BloodstoneCore.cs +++ b/Items/BloodstoneCore.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 -{ - 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.value = 187500; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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(); - } - } +using System; +using 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.value = 187500; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/BlossomPickaxe.cs b/Items/BlossomPickaxe.cs index d8995449bb..12ea523fb4 100644 --- a/Items/BlossomPickaxe.cs +++ b/Items/BlossomPickaxe.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 -{ - public class BlossomPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blossom Pickaxe"); - } - - 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 = 300000; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 6; - } - - 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 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); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using 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"); + } + + 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 = 300000; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 6; + } + + 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 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); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Items/BossRush.cs b/Items/BossRush.cs index 6b9556b1fd..7e2388c01f 100644 --- a/Items/BossRush.cs +++ b/Items/BossRush.cs @@ -1,81 +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 BossRush : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boss Rush"); - } - - 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) - { - CalamityPlayer.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 - { - CalamityPlayer.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(CalamityPlayer.bossRushStage); - netMessage.Send(); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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 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"); + } + + 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) + { + CalamityPlayer.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 + { + CalamityPlayer.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(CalamityPlayer.bossRushStage); + netMessage.Send(); + } + return true; + } + } } \ No newline at end of file diff --git a/Items/BossRush.png b/Items/BossRush.png index 1f2977cc99..9693d24bb8 100644 Binary files a/Items/BossRush.png and b/Items/BossRush.png differ diff --git a/Items/Brimrose.cs b/Items/Brimrose.cs index 4860a73ee5..ea243e906c 100644 --- a/Items/Brimrose.cs +++ b/Items/Brimrose.cs @@ -1,31 +1,31 @@ -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 = 1000000; - 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 = 1000000; + 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 67ea78004a..67ca5a5881 100644 --- a/Items/BrimstoneKey.cs +++ b/Items/BrimstoneKey.cs @@ -1,36 +1,36 @@ -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(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShadowKey); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - 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(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ShadowKey); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BrimstoneWaifu/Abaddon.cs b/Items/BrimstoneWaifu/Abaddon.cs index 6839d3c1b0..3365551575 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 = 100000; - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.buffImmune[mod.BuffType("BrimstoneFlames")] = 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.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 = 100000; + 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 diff --git a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs index 756a43104a..81b5f96691 100644 --- a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs +++ b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs @@ -1,60 +1,60 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - player.TryGettingDevArmor(); - int choice = Main.rand.Next(3); - if (choice == 0) - { - player.QuickSpawnItem(mod.ItemType("Abaddon")); - } - else if (choice == 1) - { - player.QuickSpawnItem(mod.ItemType("Brimlance")); - } - else - { - player.QuickSpawnItem(mod.ItemType("SeethingDischarge")); - } - player.QuickSpawnItem(ItemID.SoulofFright, Main.rand.Next(25, 41)); - player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(3, 5)); - player.QuickSpawnItem(mod.ItemType("Gehenna")); - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("CharredRelic")); - if (CalamityWorld.downedProvidence) - { - player.QuickSpawnItem(mod.ItemType("Brimrose")); - } - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + player.TryGettingDevArmor(); + int choice = Main.rand.Next(3); + if (choice == 0) + { + player.QuickSpawnItem(mod.ItemType("Abaddon")); + } + else if (choice == 1) + { + player.QuickSpawnItem(mod.ItemType("Brimlance")); + } + else + { + player.QuickSpawnItem(mod.ItemType("SeethingDischarge")); + } + player.QuickSpawnItem(ItemID.SoulofFright, Main.rand.Next(25, 41)); + player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(3, 5)); + player.QuickSpawnItem(mod.ItemType("Gehenna")); + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("CharredRelic")); + if (CalamityWorld.downedProvidence) + { + player.QuickSpawnItem(mod.ItemType("Brimrose")); + } + } + } + } } \ No newline at end of file diff --git a/Items/BrimstoneWaifu/CharredIdol.cs b/Items/BrimstoneWaifu/CharredIdol.cs index fd9ff6b250..548b8455cd 100644 --- a/Items/BrimstoneWaifu/CharredIdol.cs +++ b/Items/BrimstoneWaifu/CharredIdol.cs @@ -1,50 +1,50 @@ -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 Calamity biome at your own risk"); - } - - 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(); - } - } +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 Calamity biome at your own risk"); + } + + 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 diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs index 03cee30964..45483f407e 100644 --- a/Items/BrimstoneWaifu/Gehenna.cs +++ b/Items/BrimstoneWaifu/Gehenna.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.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 = 100000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (FireCountdown == 0) - { - FireCountdown = 300; - } - 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; - } - } - } - } - } - } +using System; +using 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 = 100000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (FireCountdown == 0) + { + FireCountdown = 300; + } + 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 diff --git a/Items/BrimstoneWaifu/RoseStone.cs b/Items/BrimstoneWaifu/RoseStone.cs index 14ef9a6b9f..a414cd7fe5 100644 --- a/Items/BrimstoneWaifu/RoseStone.cs +++ b/Items/BrimstoneWaifu/RoseStone.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 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 2, and all damage and crit chance by 2%\n" + - "Summons a brimstone elemental to protect you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = 500000; - 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 += 2; - player.statLifeMax2 += 20; - player.meleeCrit += 2; - player.meleeDamage += 0.02f; - player.magicCrit += 2; - player.magicDamage += 0.02f; - player.rangedCrit += 2; - player.rangedDamage += 0.02f; - player.thrownCrit += 2; - player.thrownDamage += 0.02f; - player.minionDamage += 0.02f; - 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"), 45, 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; + +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 2, and all damage and crit chance by 2%\n" + + "Summons a brimstone elemental to protect you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = 500000; + 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 += 2; + player.statLifeMax2 += 20; + player.meleeCrit += 2; + player.meleeDamage += 0.02f; + player.magicCrit += 2; + player.magicDamage += 0.02f; + player.rangedCrit += 2; + player.rangedDamage += 0.02f; + player.thrownCrit += 2; + player.thrownDamage += 0.02f; + player.minionDamage += 0.02f; + 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"), 45, 2f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/BulbofDoom.cs b/Items/BulbofDoom.cs index 6cf183aa39..b6ce9ea7c9 100644 --- a/Items/BulbofDoom.cs +++ b/Items/BulbofDoom.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 -{ - public class BulbofDoom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Portable Bulb"); - 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(null, "BarofLife", 3); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - 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 +{ + public class BulbofDoom : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Portable Bulb"); + 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(null, "BarofLife", 3); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Bumblefuck/BirbPheromones.cs b/Items/Bumblefuck/BirbPheromones.cs index 27796e0bfa..5449089f99 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(); - } - } +using System; +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 diff --git a/Items/Bumblefuck/BumblebirbBag.cs b/Items/Bumblefuck/BumblebirbBag.cs index 5ca8fc008c..a99c212f34 100644 --- a/Items/Bumblefuck/BumblebirbBag.cs +++ b/Items/Bumblefuck/BumblebirbBag.cs @@ -1,50 +1,50 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - player.TryGettingDevArmor(); - player.QuickSpawnItem(mod.ItemType("EffulgentFeather"), Main.rand.Next(9, 15)); - int choice = Main.rand.Next(3); - if (choice == 0) - { - player.QuickSpawnItem(mod.ItemType("RougeSlash")); - } - else if (choice == 1) - { - player.QuickSpawnItem(mod.ItemType("GildedProboscis")); - } - else - { - player.QuickSpawnItem(mod.ItemType("GoldenEagle")); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + player.TryGettingDevArmor(); + player.QuickSpawnItem(mod.ItemType("EffulgentFeather"), Main.rand.Next(9, 15)); + int choice = Main.rand.Next(3); + if (choice == 0) + { + player.QuickSpawnItem(mod.ItemType("RougeSlash")); + } + else if (choice == 1) + { + player.QuickSpawnItem(mod.ItemType("GildedProboscis")); + } + else + { + player.QuickSpawnItem(mod.ItemType("GoldenEagle")); + } + } + } } \ No newline at end of file diff --git a/Items/Bumblefuck/EffulgentFeather.cs b/Items/Bumblefuck/EffulgentFeather.cs index 6c024ed90e..01321d8373 100644 --- a/Items/Bumblefuck/EffulgentFeather.cs +++ b/Items/Bumblefuck/EffulgentFeather.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.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 = 150000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } +using System; +using 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 = 150000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } }} \ No newline at end of file diff --git a/Items/CadencePotion.cs b/Items/CadencePotion.cs index 6bf49b87d5..d0ca29648c 100644 --- a/Items/CadencePotion.cs +++ b/Items/CadencePotion.cs @@ -1,53 +1,53 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class CadencePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cadance Potion"); - Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + - "Increases life regen and increases max life by 10%\n" + - "Increases heart pickup range"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Cadence"); - item.buffTime = 18000; - item.value = 10000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LovePotion); - recipe.AddIngredient(ItemID.HeartreachPotion); - recipe.AddIngredient(ItemID.LifeforcePotion); - recipe.AddIngredient(ItemID.RegenerationPotion); - recipe.AddIngredient(ItemID.CalmingPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class CadencePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cadance Potion"); + Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + + "Increases life regen and increases max life by 10%\n" + + "Increases heart pickup range"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Cadence"); + item.buffTime = 18000; + item.value = 10000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LovePotion); + recipe.AddIngredient(ItemID.HeartreachPotion); + recipe.AddIngredient(ItemID.LifeforcePotion); + recipe.AddIngredient(ItemID.RegenerationPotion); + recipe.AddIngredient(ItemID.CalmingPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Calamitas/BlightedEyeball.cs b/Items/Calamitas/BlightedEyeball.cs index 8a9ec57a04..30eebd42f4 100644 --- a/Items/Calamitas/BlightedEyeball.cs +++ b/Items/Calamitas/BlightedEyeball.cs @@ -1,51 +1,51 @@ -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..."); - } - - 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) - { - 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(); - } - } +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..."); + } + + 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) + { + 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 diff --git a/Items/Calamitas/CalamitasBag.cs b/Items/Calamitas/CalamitasBag.cs index 33a7df9dc3..46f1c3e70d 100644 --- a/Items/Calamitas/CalamitasBag.cs +++ b/Items/Calamitas/CalamitasBag.cs @@ -1,68 +1,68 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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(30, 41)); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("ChaosStone")); - } - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("Animosity")); - } - player.QuickSpawnItem(mod.ItemType("CalamityDust"), Main.rand.Next(14, 19)); - player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 6)); - player.QuickSpawnItem(mod.ItemType("BlightedLens"), Main.rand.Next(1, 4)); - player.QuickSpawnItem(mod.ItemType("CalamityRing")); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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(30, 41)); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("ChaosStone")); + } + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("Animosity")); + } + player.QuickSpawnItem(mod.ItemType("CalamityDust"), Main.rand.Next(14, 19)); + player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 6)); + player.QuickSpawnItem(mod.ItemType("BlightedLens"), Main.rand.Next(1, 4)); + player.QuickSpawnItem(mod.ItemType("CalamityRing")); + } + } } \ No newline at end of file diff --git a/Items/Calamitas/CalamityDust.cs b/Items/Calamitas/CalamityDust.cs index 8ce6901df2..a81a088731 100644 --- a/Items/Calamitas/CalamityDust.cs +++ b/Items/Calamitas/CalamityDust.cs @@ -1,33 +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 = 20000; - 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 = 20000; + 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 diff --git a/Items/Calamitas/CalamityRing.cs b/Items/Calamitas/CalamityRing.cs index df066abed9..127b42eec8 100644 --- a/Items/Calamitas/CalamityRing.cs +++ b/Items/Calamitas/CalamityRing.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.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 = 500000; - item.rare = 7; - 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 *= 1.15f; - player.thrownDamage *= 1.15f; - player.rangedDamage *= 1.15f; - player.magicDamage *= 1.15f; - player.minionDamage *= 1.15f; - player.endurance -= 0.3f; - if (player.whoAmI == Main.myPlayer) - { - if (player.immune) - { - if (Main.rand.Next(8) == 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; - } - } - } - } - } - } +using System; +using 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 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 = 500000; + item.rare = 7; + 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 *= 1.15f; + player.thrownDamage *= 1.15f; + player.rangedDamage *= 1.15f; + player.magicDamage *= 1.15f; + player.minionDamage *= 1.15f; + player.endurance -= 0.3f; + if (player.whoAmI == Main.myPlayer) + { + if (player.immune) + { + if (Main.rand.Next(8) == 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 diff --git a/Items/Calamitas/ChaosStone.cs b/Items/Calamitas/ChaosStone.cs index 97dd973615..9add4125e8 100644 --- a/Items/Calamitas/ChaosStone.cs +++ b/Items/Calamitas/ChaosStone.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.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 and crit chance by 2%, 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 = 500000; - 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.meleeCrit += 2; - player.meleeDamage += 0.02f; - player.magicCrit += 2; - player.magicDamage += 0.02f; - player.rangedCrit += 2; - player.rangedDamage += 0.02f; - player.thrownCrit += 2; - player.thrownDamage += 0.02f; - player.minionDamage += 0.02f; - } - } -} +using System; +using 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 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 and crit chance by 2%, 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 = 500000; + 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.meleeCrit += 2; + player.meleeDamage += 0.02f; + player.magicCrit += 2; + player.magicDamage += 0.02f; + player.rangedCrit += 2; + player.rangedDamage += 0.02f; + player.thrownCrit += 2; + player.thrownDamage += 0.02f; + player.minionDamage += 0.02f; + } + } +} diff --git a/Items/CalamitasBrew.cs b/Items/CalamitasBrew.cs index c34729f4b2..847394152a 100644 --- a/Items/CalamitasBrew.cs +++ b/Items/CalamitasBrew.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class CalamitasBrew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas' Brew"); - Tooltip.SetDefault("Adds abyssal flames to your melee weapons\n" + - "Increases your movement speed by 15%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("AbyssalWeapon"); - item.buffTime = 36000; - item.value = 2000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CalamityDust"); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class CalamitasBrew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas' Brew"); + Tooltip.SetDefault("Adds abyssal flames to your melee weapons\n" + + "Increases your movement speed by 15%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AbyssalWeapon"); + item.buffTime = 36000; + item.value = 2000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CalamityDust"); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.ImbuingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/CalamitousEssence.cs b/Items/CalamitousEssence.cs index 0aedb61677..4d78528899 100644 --- a/Items/CalamitousEssence.cs +++ b/Items/CalamitousEssence.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.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.value = 125000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - } +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.value = 125000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + } } \ No newline at end of file diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8d2cbcd926..6fcacbe0fd 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,306 +1,316 @@ -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.Utilities; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class CalamityGlobalItem : GlobalItem - { - public override bool OnPickup(Item item, Player player) - { - if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) - { - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - player.statLife -= 10; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-10, true); - } - } - } - return true; - } - - public override bool CanUseItem(Item item, Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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 (CalamityWorld.revenge) - { - if (item.type == ItemID.RodofDiscord && modPlayer.scarfCooldown) - { - player.AddBuff(BuffID.ChaosState, 720); - } - } - return true; - } - - public override void ModifyTooltips(Item item, List tooltips) - { - 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.CelestialEmblem) - { - 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"; - } - } - } - } - - 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; - } - } - - /// - /// 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 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; + +namespace CalamityMod.Items +{ + public class CalamityGlobalItem : GlobalItem + { + public override bool OnPickup(Item item, Player player) + { + if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) + { + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + player.statLife -= 10; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-10, true); + } + } + } + return true; + } + + public override bool CanUseItem(Item item, Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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 (CalamityWorld.revenge) + { + if (item.type == ItemID.RodofDiscord && modPlayer.scarfCooldown) + { + player.AddBuff(BuffID.ChaosState, 720); + } + } + return true; + } + + public override void ModifyTooltips(Item item, List tooltips) + { + 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%"; + } + } + } + } + + 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; + } + } + + /// + /// 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 9b7fb82109..84ee2874d8 100644 --- a/Items/ChaoswarpedSlashaxe.cs +++ b/Items/ChaoswarpedSlashaxe.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 ChaoswarpedSlashaxe : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaoswarped Slashaxe"); - } - - public override void SetDefaults() - { - item.damage = 68; - item.melee = true; - item.width = 42; - item.height = 42; - item.useTime = 31; - item.useAnimation = 31; - item.useTurn = true; - item.axe = 40; - item.useStyle = 1; - item.knockBack = 7; - item.value = 750000; - 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); - } +using System; +using 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 = 42; + item.height = 42; + item.useTime = 31; + item.useAnimation = 31; + item.useTurn = true; + item.axe = 40; + item.useStyle = 1; + item.knockBack = 7; + item.value = 750000; + 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 diff --git a/Items/CharredRelic.cs b/Items/CharredRelic.cs index aeecae70cd..566fcf5a87 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); - } - } - } +using System; +using 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 diff --git a/Items/CometShard.cs b/Items/CometShard.cs index 64933e18fc..d8b81c7a99 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(); - } - } +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 diff --git a/Items/CoreofCalamity.cs b/Items/CoreofCalamity.cs index 3acdfdd08e..8c773da19c 100644 --- a/Items/CoreofCalamity.cs +++ b/Items/CoreofCalamity.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 { -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 = 69; - item.value = 500000; - item.rare = 10; - } - - 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(); - } +using System; +using 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 = 69; + item.value = 500000; + item.rare = 10; + } + + 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 diff --git a/Items/CoreofChaos.cs b/Items/CoreofChaos.cs index 7fdf1ec804..dabcf5b3d1 100644 --- a/Items/CoreofChaos.cs +++ b/Items/CoreofChaos.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 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 = 50000; - 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(); - } +using System; +using 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 = 50000; + 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 diff --git a/Items/CoreofCinder.cs b/Items/CoreofCinder.cs index ca03d3ff30..b69b6a6f91 100644 --- a/Items/CoreofCinder.cs +++ b/Items/CoreofCinder.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 CoreofCinder : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Cinder"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = 50000; - 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(); - } +using System; +using 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 Cinder"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; + item.value = 50000; + 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 diff --git a/Items/CoreofEleum.cs b/Items/CoreofEleum.cs index a85e5b67ea..5d3dad1aa8 100644 --- a/Items/CoreofEleum.cs +++ b/Items/CoreofEleum.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 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 = 50000; - 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(); - } +using System; +using 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 = 50000; + 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 diff --git a/Items/CosmicPlushie.cs b/Items/CosmicPlushie.cs index a7920fbae4..03115b8cad 100644 --- a/Items/CosmicPlushie.cs +++ b/Items/CosmicPlushie.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 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 = 14; - 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 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 = 14; + 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/Cosmolight.cs b/Items/Cosmolight.cs index bfea1334a7..b8bbe774bf 100644 --- a/Items/Cosmolight.cs +++ b/Items/Cosmolight.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.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) - { - if (!Main.dayTime) - { - Main.time = 0.0; - Main.dayTime = true; - } - else - { - Main.time = 0.0; - Main.dayTime = false; - Main.moonPhase++; - 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(); - } - } +using System; +using System.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) + { + if (!Main.dayTime) + { + Main.time = 0.0; + Main.dayTime = true; + } + else + { + Main.time = 0.0; + Main.dayTime = false; + Main.moonPhase++; + 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 diff --git a/Items/Crabulon/CrabulonBag.cs b/Items/Crabulon/CrabulonBag.cs index 82c7a41ec0..cccd33534b 100644 --- a/Items/Crabulon/CrabulonBag.cs +++ b/Items/Crabulon/CrabulonBag.cs @@ -1,62 +1,62 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 (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")); - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("MushroomPlasmaRoot")); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 (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")); + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("MushroomPlasmaRoot")); + } + } + } } \ No newline at end of file diff --git a/Items/Crabulon/DecapoditaSprout.cs b/Items/Crabulon/DecapoditaSprout.cs index c867339bb4..e7fdcb2c38 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 the giant mushroom crab"); - } - - 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(); - } - } +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 the giant mushroom crab"); + } + + 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 diff --git a/Items/Crabulon/FungalClump.cs b/Items/Crabulon/FungalClump.cs index ec5b68c20f..fd0a220c84 100644 --- a/Items/Crabulon/FungalClump.cs +++ b/Items/Crabulon/FungalClump.cs @@ -1,63 +1,63 @@ -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 = 40000; - item.expert = true; - 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"), 10, 1f, Main.myPlayer, 0f, 0f); - } - } - } - } +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 = 40000; + item.expert = true; + 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"), 10, 1f, Main.myPlayer, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Items/CruptixBar.cs b/Items/CruptixBar.cs index 20e69415ce..f4ec9c027b 100644 --- a/Items/CruptixBar.cs +++ b/Items/CruptixBar.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 CruptixBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotic Bar"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = 150000; - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ChaoticOre", 12); - recipe.AddIngredient(null, "CoreofChaos"); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 4); - 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 +{ + public class CruptixBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = 150000; + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticOre", 12); + recipe.AddIngredient(null, "CoreofChaos"); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Cryogen/CryoBar.cs b/Items/Cryogen/CryoBar.cs index 53c1d45865..2f6e3b319f 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 = 15; - item.height = 12; - item.maxStack = 999; - item.value = 28750; - item.rare = 5; - } - } +using System; +using 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 = 15; + item.height = 12; + item.maxStack = 999; + item.value = 28750; + item.rare = 5; + } + } } \ No newline at end of file diff --git a/Items/Cryogen/CryoKey.cs b/Items/Cryogen/CryoKey.cs index 4fd00a7fb3..3807cabf4c 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 the magic of the ancient ice castle"); - } - - 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(); - } - } +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 the magic of the ancient ice castle"); + } + + 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 diff --git a/Items/Cryogen/CryoStone.cs b/Items/Cryogen/CryoStone.cs index 0ace91cfb6..ccd8c36a17 100644 --- a/Items/Cryogen/CryoStone.cs +++ b/Items/Cryogen/CryoStone.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.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 and crit chance by 2%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = 500000; - 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.meleeCrit += 2; - player.meleeDamage += 0.02f; - player.magicCrit += 2; - player.magicDamage += 0.02f; - player.rangedCrit += 2; - player.rangedDamage += 0.02f; - player.thrownCrit += 2; - player.thrownDamage += 0.02f; - player.minionDamage += 0.02f; - } - } -} +using System; +using 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 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 and crit chance by 2%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = 500000; + 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.meleeCrit += 2; + player.meleeDamage += 0.02f; + player.magicCrit += 2; + player.magicDamage += 0.02f; + player.rangedCrit += 2; + player.rangedDamage += 0.02f; + player.thrownCrit += 2; + player.thrownDamage += 0.02f; + player.minionDamage += 0.02f; + } + } +} diff --git a/Items/Cryogen/CryogenBag.cs b/Items/Cryogen/CryogenBag.cs index b4fd3647c8..b7cdfbe767 100644 --- a/Items/Cryogen/CryogenBag.cs +++ b/Items/Cryogen/CryogenBag.cs @@ -1,85 +1,85 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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("Permafrost")); - } - 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(5) == 0) - { - player.QuickSpawnItem(ItemID.FrozenKey); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("CryoStone")); - } - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("FrostFlare")); - } - 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(4, 6)); - player.QuickSpawnItem(mod.ItemType("SoulofCryogen")); - player.QuickSpawnItem(ItemID.FrostCore); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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("Permafrost")); + } + 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(5) == 0) + { + player.QuickSpawnItem(ItemID.FrozenKey); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("CryoStone")); + } + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("FrostFlare")); + } + 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(4, 6)); + player.QuickSpawnItem(mod.ItemType("SoulofCryogen")); + player.QuickSpawnItem(ItemID.FrostCore); + } + } } \ No newline at end of file diff --git a/Items/Cryogen/SoulofCryogen.cs b/Items/Cryogen/SoulofCryogen.cs index bd23e21d6f..2dcc974af4 100644 --- a/Items/Cryogen/SoulofCryogen.cs +++ b/Items/Cryogen/SoulofCryogen.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.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" + - "Decent acceleration: 1.35\n" + - "Decent flight time: 60\n" + - "10% increase to all damage and pick speed\n" + - "Frost damage added to melee swings"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 500000; - item.expert = true; - 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.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } - - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 8f; - acceleration *= 1.35f; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.cryogenSoul = true; - player.pickSpeed -= 0.1f; - player.magicDamage *= 1.1f; - player.rangedDamage *= 1.1f; - player.meleeDamage *= 1.1f; - player.minionDamage *= 1.1f; - player.thrownDamage *= 1.1f; - player.wingTimeMax = 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.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" + + "Decent acceleration: 1.35\n" + + "Decent flight time: 60\n" + + "5% increase to all damage and pick speed\n" + + "Frost damage added to melee swings"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 500000; + item.expert = true; + 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.85f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 3f; + constantAscend = 0.135f; + } + + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 8f; + acceleration *= 1.35f; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.cryogenSoul = true; + player.pickSpeed -= 0.05f; + player.magicDamage += 0.05f; + player.rangedDamage += 0.05f; + player.meleeDamage += 0.05f; + player.minionDamage += 0.05f; + player.thrownDamage += 0.05f; + player.wingTimeMax = 60; + } + } } \ No newline at end of file diff --git a/Items/CrystylCrusher.cs b/Items/CrystylCrusher.cs index c69c032f4d..d01ef9d4c9 100644 --- a/Items/CrystylCrusher.cs +++ b/Items/CrystylCrusher.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 -{ - 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 = 9; - item.value = 10000000; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 50; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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); - } - } - } +using System; +using 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 = 9; + item.value = 10000000; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 50; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/DarksunFragment.cs b/Items/DarksunFragment.cs index efe371c194..7a44d07fbe 100644 --- a/Items/DarksunFragment.cs +++ b/Items/DarksunFragment.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.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.value = 80000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } +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.value = 80000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } }} \ No newline at end of file diff --git a/Items/Daylight.cs b/Items/Daylight.cs index 5be1c149d7..192f9c9d9a 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(); - } - } +using System; +using System.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 diff --git a/Items/Death.cs b/Items/Death.cs index 37d7a4ce81..d92be9b3ea 100644 --- a/Items/Death.cs +++ b/Items/Death.cs @@ -1,91 +1,91 @@ -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 Death : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death"); - Tooltip.SetDefault("Makes bosses even more EXTREME\n" + - "Effect can be toggled on and off\n" + - "Effect will only work if revengeance mode is active\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss"); - } - - public override void SetDefaults() - { - item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - if (!CalamityWorld.revenge) - { - 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.death) - { - CalamityWorld.death = true; - string key = "Mods.CalamityMod.DeathText"; - Color messageColor = Color.Crimson; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.death = false; - string key = "Mods.CalamityMod.DeathText2"; - Color messageColor = Color.Crimson; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - } +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 Death : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death"); + Tooltip.SetDefault("Makes bosses even more EXTREME\n" + + "Effect can be toggled on and off\n" + + "Effect will only work if revengeance mode is active\n" + + "Using this while a boss is alive will instantly kill you and despawn the boss"); + } + + public override void SetDefaults() + { + item.rare = 11; + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + if (!CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.death) + { + CalamityWorld.death = true; + string key = "Mods.CalamityMod.DeathText"; + Color messageColor = Color.Crimson; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else + { + CalamityWorld.death = false; + string key = "Mods.CalamityMod.DeathText2"; + Color messageColor = Color.Crimson; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + 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 diff --git a/Items/DefiledRune.cs b/Items/DefiledRune.cs index 6e6ef50f76..961e025a65 100644 --- a/Items/DefiledRune.cs +++ b/Items/DefiledRune.cs @@ -1,86 +1,95 @@ -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 DefiledRune : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Defiled Rune"); - Tooltip.SetDefault("Halves your max HP and increases enemy damage resistance by 50%\n" + - "Increases most rare item drop chances and enemies drop 2 times the cash\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss\n" + - "Can only be used in revengeance and death mode\n" + - "Can be toggled on and off"); - } - - public override void SetDefaults() - { - item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item100; - 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) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (CalamityWorld.revenge) - { - if (!CalamityWorld.defiled) - { - CalamityWorld.defiled = true; - string key = "Mods.CalamityMod.DefiledText"; - Color messageColor = Color.DarkSeaGreen; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.defiled = false; - string key = "Mods.CalamityMod.DefiledText2"; - Color messageColor = Color.DarkSeaGreen; - 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; - } - } +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 DefiledRune : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Defiled Rune"); + Tooltip.SetDefault("Halves your max HP and increases enemy damage resistance by 50%\n" + + "Increases most rare item drop chances and enemies drop 2 times the cash\n" + + "Using this while a boss is alive will instantly kill you and despawn the boss\n" + + "Can only be used in revengeance and death mode\n" + + "Can be toggled on and off"); + } + + public override void SetDefaults() + { + item.rare = 11; + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item100; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + if (CalamityWorld.bossRushActive) + { + 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.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (CalamityWorld.revenge) + { + if (!CalamityWorld.defiled) + { + CalamityWorld.defiled = true; + string key = "Mods.CalamityMod.DefiledText"; + Color messageColor = Color.DarkSeaGreen; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else + { + CalamityWorld.defiled = false; + string key = "Mods.CalamityMod.DefiledText2"; + Color messageColor = Color.DarkSeaGreen; + 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 diff --git a/Items/DemonicBoneAsh.cs b/Items/DemonicBoneAsh.cs index d3f943d7ae..c058e85e5e 100644 --- a/Items/DemonicBoneAsh.cs +++ b/Items/DemonicBoneAsh.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 20000; - item.rare = 3; - } +using System; +using 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 = 20000; + item.rare = 3; + } }} \ No newline at end of file diff --git a/Items/DesertFeather.cs b/Items/DesertFeather.cs index e68e09cd49..83e433d560 100644 --- a/Items/DesertFeather.cs +++ b/Items/DesertFeather.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 5000; - item.rare = 2; - } +using System; +using 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 = 5000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/DesertScourge/AeroStone.cs b/Items/DesertScourge/AeroStone.cs index e0a0507a68..cb79aa3251 100644 --- a/Items/DesertScourge/AeroStone.cs +++ b/Items/DesertScourge/AeroStone.cs @@ -1,45 +1,45 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod; - -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 and crit chance by 2%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = 500000; - 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, 0f, 0.425f, 0.425f); - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 2.0f; - player.meleeCrit += 2; - player.meleeDamage += 0.02f; - player.magicCrit += 2; - player.magicDamage += 0.02f; - player.rangedCrit += 2; - player.rangedDamage += 0.02f; - player.thrownCrit += 2; - player.thrownDamage += 0.02f; - player.minionDamage += 0.02f; - } - } -} +using System; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod; + +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 and crit chance by 2%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = 500000; + 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, 0f, 0.425f, 0.425f); + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 2.0f; + player.meleeCrit += 2; + player.meleeDamage += 0.02f; + player.magicCrit += 2; + player.magicDamage += 0.02f; + player.rangedCrit += 2; + player.rangedDamage += 0.02f; + player.thrownCrit += 2; + player.thrownDamage += 0.02f; + player.minionDamage += 0.02f; + } + } +} diff --git a/Items/DesertScourge/DesertScourgeBag.cs b/Items/DesertScourge/DesertScourgeBag.cs index 91eb31f13d..b9484be2a6 100644 --- a/Items/DesertScourge/DesertScourgeBag.cs +++ b/Items/DesertScourge/DesertScourgeBag.cs @@ -1,127 +1,127 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 (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(15) == 0) - { - player.QuickSpawnItem(ItemID.HighTestFishingLine); - } - if (Main.rand.Next(30) == 0) - { - player.QuickSpawnItem(ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - player.QuickSpawnItem(ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("AeroStone")); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 0) - { - player.QuickSpawnItem(ItemID.GoldenBugNet); - } - } - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("ScourgeoftheDesert")); - } - 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)); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 (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(15) == 0) + { + player.QuickSpawnItem(ItemID.HighTestFishingLine); + } + if (Main.rand.Next(30) == 0) + { + player.QuickSpawnItem(ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + player.QuickSpawnItem(ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("AeroStone")); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 0) + { + player.QuickSpawnItem(ItemID.GoldenBugNet); + } + } + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("ScourgeoftheDesert")); + } + 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 diff --git a/Items/DesertScourge/DriedSeafood.cs b/Items/DesertScourge/DriedSeafood.cs index 41230915b7..3c95e34b1e 100644 --- a/Items/DesertScourge/DriedSeafood.cs +++ b/Items/DesertScourge/DriedSeafood.cs @@ -1,56 +1,56 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.DesertScourge -{ - public class DriedSeafood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Medallion"); - Tooltip.SetDefault("The desert sand stirs..."); - } - - 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(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DesertScourge +{ + public class DriedSeafood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Medallion"); + Tooltip.SetDefault("The desert sand stirs..."); + } + + 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 diff --git a/Items/DesertScourge/OceanCrest.cs b/Items/DesertScourge/OceanCrest.cs index 5a3cf16c89..d2bc8f3419 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 = 100000; - item.rare = 2; - 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; - } - } +using System; +using 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 = 100000; + item.rare = 2; + 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 diff --git a/Items/DesertScourge/VictoryShard.cs b/Items/DesertScourge/VictoryShard.cs index 80de2d7d0b..682cdc5f6c 100644 --- a/Items/DesertScourge/VictoryShard.cs +++ b/Items/DesertScourge/VictoryShard.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 5000; - item.rare = 2; - } +using System; +using 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 = 5000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/DevourerMunsters/ArmoredShell.cs b/Items/DevourerMunsters/ArmoredShell.cs index 950dfaf828..ddce8b586b 100644 --- a/Items/DevourerMunsters/ArmoredShell.cs +++ b/Items/DevourerMunsters/ArmoredShell.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.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 = 15000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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 = 15000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } }} \ No newline at end of file diff --git a/Items/DevourerMunsters/DarkPlasma.cs b/Items/DevourerMunsters/DarkPlasma.cs index 99ad63971f..465807a1ba 100644 --- a/Items/DevourerMunsters/DarkPlasma.cs +++ b/Items/DevourerMunsters/DarkPlasma.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.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 = 508750; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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); - } - } +using System; +using 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 = 508750; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/DevourerMunsters/RuneofCos.cs b/Items/DevourerMunsters/RuneofCos.cs index d632c0927c..c6bae0d777 100644 --- a/Items/DevourerMunsters/RuneofCos.cs +++ b/Items/DevourerMunsters/RuneofCos.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.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"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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(); - } - } +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"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/DevourerMunsters/TwistingNether.cs b/Items/DevourerMunsters/TwistingNether.cs index 3593773858..fb1481c85e 100644 --- a/Items/DevourerMunsters/TwistingNether.cs +++ b/Items/DevourerMunsters/TwistingNether.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.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 = 9; - item.value = 508750; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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); - } +using System; +using 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 = 9; + item.value = 508750; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/DimensionalSoulArtifact.cs b/Items/DimensionalSoulArtifact.cs index 58b352b162..6946be7490 100644 --- a/Items/DimensionalSoulArtifact.cs +++ b/Items/DimensionalSoulArtifact.cs @@ -1,58 +1,58 @@ -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 and critical strike chance by 15%\n" + - "This boost bypasses the damage and critical strike chance caps, but at what cost?"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = 5000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } +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 and critical strike chance by 15%\n" + + "This boost bypasses the damage and critical strike chance caps, but at what cost?"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = 5000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/DraedonBar.cs b/Items/DraedonBar.cs index 9edc9c7e3e..d5ba5339e3 100644 --- a/Items/DraedonBar.cs +++ b/Items/DraedonBar.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 DraedonBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perennial Bar"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = 120000; - item.rare = 6; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PerennialOre", 15); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 5); - 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 +{ + public class DraedonBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perennial Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = 120000; + item.rare = 6; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PerennialOre", 15); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 5); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/DraedonsRemote.cs b/Items/DraedonsRemote.cs index 20672b3877..384f6c49f0 100644 --- a/Items/DraedonsRemote.cs +++ b/Items/DraedonsRemote.cs @@ -1,68 +1,68 @@ -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 = 1; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.AddIngredient(ItemID.SoulofLight, 15); - recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddIngredient(null, "MeldBlob", 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LeadBar, 10); - recipe.AddIngredient(ItemID.SoulofLight, 15); - recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddIngredient(null, "MeldBlob", 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.AddIngredient(ItemID.SoulofLight, 15); + recipe.AddIngredient(ItemID.SoulofNight, 15); + recipe.AddIngredient(null, "MeldBlob", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LeadBar, 10); + recipe.AddIngredient(ItemID.SoulofLight, 15); + recipe.AddIngredient(ItemID.SoulofNight, 15); + recipe.AddIngredient(null, "MeldBlob", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Dragonfruit.cs b/Items/Dragonfruit.cs index d887b89910..60425e83e9 100644 --- a/Items/Dragonfruit.cs +++ b/Items/Dragonfruit.cs @@ -1,84 +1,84 @@ -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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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, "EffulgentFeather", 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(); - } - } +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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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, "EffulgentFeather", 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 diff --git a/Items/EbonianGel.cs b/Items/EbonianGel.cs index 9e3dcadc4c..1661b02884 100644 --- a/Items/EbonianGel.cs +++ b/Items/EbonianGel.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 1000; - item.rare = 2; - } +using System; +using 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 = 1000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/Ectoblood.cs b/Items/Ectoblood.cs index 9e813b1b6b..2b29c11d62 100644 --- a/Items/Ectoblood.cs +++ b/Items/Ectoblood.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 3500; - item.rare = 8; - } +using System; +using 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 = 3500; + item.rare = 8; + } }} \ No newline at end of file diff --git a/Items/Ectoheart.cs b/Items/Ectoheart.cs index d118720ecf..eb0da68a1a 100644 --- a/Items/Ectoheart.cs +++ b/Items/Ectoheart.cs @@ -1,66 +1,66 @@ -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, 4)); - } - - 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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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; - } - } +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, 4)); + } + + 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/EidolonTablet.cs b/Items/EidolonTablet.cs index b48a5271bc..2a646c52d6 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 - 2, 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; - } - } +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 - 2, 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 diff --git a/Items/Elderberry.cs b/Items/Elderberry.cs index bc329e1add..3c3c25f762 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(); - } - } +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 diff --git a/Items/EldritchSoulArtifact.cs b/Items/EldritchSoulArtifact.cs index 70fd7d897c..548a695cc7 100644 --- a/Items/EldritchSoulArtifact.cs +++ b/Items/EldritchSoulArtifact.cs @@ -1,57 +1,57 @@ -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%, throwing 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 = 5000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } +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%, throwing damage by 10%, max minions by 2, and reduces mana cost by 15%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = 5000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/ElectrolyteGelPack.cs b/Items/ElectrolyteGelPack.cs index aca289ec1b..932c6fac8c 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; - } - } +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 diff --git a/Items/EndothermicEnergy.cs b/Items/EndothermicEnergy.cs index 2ffc65f8a0..8cee90732f 100644 --- a/Items/EndothermicEnergy.cs +++ b/Items/EndothermicEnergy.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.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.value = 50000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } +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.value = 50000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } }} \ No newline at end of file diff --git a/Items/EssenceofChaos.cs b/Items/EssenceofChaos.cs index c6a15ea39d..9429947e94 100644 --- a/Items/EssenceofChaos.cs +++ b/Items/EssenceofChaos.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 { -public class EssenceofChaos : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Chaos"); - Tooltip.SetDefault("The essence of underworld 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.scale = 1.25f; - item.maxStack = 999; - item.value = 25000; - item.rare = 5; - } +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 underworld 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.scale = 1.25f; + item.maxStack = 999; + item.value = 25000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/EssenceofCinder.cs b/Items/EssenceofCinder.cs index 718ee806a6..03620d9fd0 100644 --- a/Items/EssenceofCinder.cs +++ b/Items/EssenceofCinder.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; -using CalamityMod.NPCs; - -namespace CalamityMod.Items { -public class EssenceofCinder : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Cinder"); - Tooltip.SetDefault("The essence of sky 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 = 25000; - item.rare = 5; - } +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 Cinder"); + Tooltip.SetDefault("The essence of sky 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 = 25000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/EssenceofEleum.cs b/Items/EssenceofEleum.cs index d340d97b53..7ba7f1f9d3 100644 --- a/Items/EssenceofEleum.cs +++ b/Items/EssenceofEleum.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.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 = 25000; - item.rare = 5; - } +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 = 25000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/EtherealCore.cs b/Items/EtherealCore.cs index 26711afc63..cfd2fd5517 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(); - } - } +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 diff --git a/Items/Fabsol.cs b/Items/Fabsol.cs index 745b6e16db..45399e9438 100644 --- a/Items/Fabsol.cs +++ b/Items/Fabsol.cs @@ -1,30 +1,30 @@ -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.value = 100000000; - 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.value = 100000000; + 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 new file mode 100644 index 0000000000..c86c0932d2 --- /dev/null +++ b/Items/FabsolStuff/BloodyMary.cs @@ -0,0 +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, critical strike chance, movement speed, and melee speed by 15% during a Blood Moon +Reduces life regen by 3 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/BloodyMary.png b/Items/FabsolStuff/BloodyMary.png new file mode 100644 index 0000000000..935c52c03a Binary files /dev/null and b/Items/FabsolStuff/BloodyMary.png differ diff --git a/Items/FabsolStuff/BlueCandle.png b/Items/FabsolStuff/BlueCandle.png new file mode 100644 index 0000000000..4acebe2e89 Binary files /dev/null and b/Items/FabsolStuff/BlueCandle.png differ diff --git a/Items/FabsolStuff/CaribbeanRum.cs b/Items/FabsolStuff/CaribbeanRum.cs new file mode 100644 index 0000000000..4e64dd1287 --- /dev/null +++ b/Items/FabsolStuff/CaribbeanRum.cs @@ -0,0 +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); + } + } +} diff --git a/Items/FabsolStuff/CaribbeanRum.png b/Items/FabsolStuff/CaribbeanRum.png new file mode 100644 index 0000000000..dbbd84b161 Binary files /dev/null and b/Items/FabsolStuff/CaribbeanRum.png differ diff --git a/Items/FabsolStuff/CinnamonRoll.cs b/Items/FabsolStuff/CinnamonRoll.cs new file mode 100644 index 0000000000..3536dfc13e --- /dev/null +++ b/Items/FabsolStuff/CinnamonRoll.cs @@ -0,0 +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); + } + } +} diff --git a/Items/FabsolStuff/CinnamonRoll.png b/Items/FabsolStuff/CinnamonRoll.png new file mode 100644 index 0000000000..6fb460058f Binary files /dev/null and b/Items/FabsolStuff/CinnamonRoll.png differ diff --git a/Items/FabsolStuff/Everclear.cs b/Items/FabsolStuff/Everclear.cs new file mode 100644 index 0000000000..2e28e53083 --- /dev/null +++ b/Items/FabsolStuff/Everclear.cs @@ -0,0 +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 and critical strike chance by 20% +Reduces life regen by 20 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/Everclear.png b/Items/FabsolStuff/Everclear.png new file mode 100644 index 0000000000..2c12189e6b Binary files /dev/null and b/Items/FabsolStuff/Everclear.png differ diff --git a/Items/FabsolStuff/EvergreenGin.cs b/Items/FabsolStuff/EvergreenGin.cs new file mode 100644 index 0000000000..c06f3359ea --- /dev/null +++ b/Items/FabsolStuff/EvergreenGin.cs @@ -0,0 +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 3 +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/EvergreenGin.png b/Items/FabsolStuff/EvergreenGin.png new file mode 100644 index 0000000000..82e4638877 Binary files /dev/null and b/Items/FabsolStuff/EvergreenGin.png differ diff --git a/Items/FabsolStuff/FabsolsVodka.cs b/Items/FabsolStuff/FabsolsVodka.cs new file mode 100644 index 0000000000..8913069435 --- /dev/null +++ b/Items/FabsolStuff/FabsolsVodka.cs @@ -0,0 +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 10% 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 diff --git a/Items/FabsolStuff/FabsolsVodka.png b/Items/FabsolStuff/FabsolsVodka.png new file mode 100644 index 0000000000..e7658efa01 Binary files /dev/null and b/Items/FabsolStuff/FabsolsVodka.png differ diff --git a/Items/FabsolStuff/Fireball.cs b/Items/FabsolStuff/Fireball.cs new file mode 100644 index 0000000000..a226063359 --- /dev/null +++ b/Items/FabsolStuff/Fireball.cs @@ -0,0 +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 3 +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/Fireball.png b/Items/FabsolStuff/Fireball.png new file mode 100644 index 0000000000..2c90f8f28c Binary files /dev/null and b/Items/FabsolStuff/Fireball.png differ diff --git a/Items/FabsolStuff/GrapeBeer.cs b/Items/FabsolStuff/GrapeBeer.cs new file mode 100644 index 0000000000..90a26ba571 --- /dev/null +++ b/Items/FabsolStuff/GrapeBeer.cs @@ -0,0 +1,48 @@ +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 life regen by 1, defense by 2, and movement speed by 5% +This crap is abhorrent but you might like it"); + } + + 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.healLife = 100; + item.healMana = 100; + 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 UseItem(Player player) + { + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + return true; + } + } +} diff --git a/Items/FabsolStuff/GrapeBeer.png b/Items/FabsolStuff/GrapeBeer.png new file mode 100644 index 0000000000..27c0b23a27 Binary files /dev/null and b/Items/FabsolStuff/GrapeBeer.png differ diff --git a/Items/FabsolStuff/Margarita.cs b/Items/FabsolStuff/Margarita.cs new file mode 100644 index 0000000000..4f8f77855a --- /dev/null +++ b/Items/FabsolStuff/Margarita.cs @@ -0,0 +1,49 @@ +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 3 +One of the best drinks ever created, enjoy it while it lasts"); + } + + 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.healLife = 200; + item.healMana = 200; + 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 UseItem(Player player) + { + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + return true; + } + } +} diff --git a/Items/FabsolStuff/Margarita.png b/Items/FabsolStuff/Margarita.png new file mode 100644 index 0000000000..b440e0aebc Binary files /dev/null and b/Items/FabsolStuff/Margarita.png differ diff --git a/Items/FabsolStuff/Moonshine.cs b/Items/FabsolStuff/Moonshine.cs new file mode 100644 index 0000000000..76a9b2ae07 --- /dev/null +++ b/Items/FabsolStuff/Moonshine.cs @@ -0,0 +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 2 +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/Moonshine.png b/Items/FabsolStuff/Moonshine.png new file mode 100644 index 0000000000..a8721c640e Binary files /dev/null and b/Items/FabsolStuff/Moonshine.png differ diff --git a/Items/FabsolStuff/MoscowMule.cs b/Items/FabsolStuff/MoscowMule.cs new file mode 100644 index 0000000000..cdd1831b52 --- /dev/null +++ b/Items/FabsolStuff/MoscowMule.cs @@ -0,0 +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, critical strike chance, and knockback by 12% +Reduces life regen by 3 +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/MoscowMule.png b/Items/FabsolStuff/MoscowMule.png new file mode 100644 index 0000000000..98d2e9f48a Binary files /dev/null and b/Items/FabsolStuff/MoscowMule.png differ diff --git a/Items/FabsolStuff/OddMushroom.png b/Items/FabsolStuff/OddMushroom.png new file mode 100644 index 0000000000..81c156989f Binary files /dev/null and b/Items/FabsolStuff/OddMushroom.png differ diff --git a/Items/FabsolStuff/PinkCandle.png b/Items/FabsolStuff/PinkCandle.png new file mode 100644 index 0000000000..fb18c15f40 Binary files /dev/null and b/Items/FabsolStuff/PinkCandle.png differ diff --git a/Items/FabsolStuff/PurpleCandle.png b/Items/FabsolStuff/PurpleCandle.png new file mode 100644 index 0000000000..6cf43cd129 Binary files /dev/null and b/Items/FabsolStuff/PurpleCandle.png differ diff --git a/Items/FabsolStuff/RedWine.cs b/Items/FabsolStuff/RedWine.cs new file mode 100644 index 0000000000..37a2c13f4f --- /dev/null +++ b/Items/FabsolStuff/RedWine.cs @@ -0,0 +1,47 @@ +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 2 +Too dry for my taste"); + } + + 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.healLife = 200; + item.buffType = mod.BuffType("RedWine"); + item.buffTime = 900; //3600 = 1 minute + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool UseItem(Player player) + { + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + return true; + } + } +} diff --git a/Items/FabsolStuff/RedWine.png b/Items/FabsolStuff/RedWine.png new file mode 100644 index 0000000000..5ff9311c80 Binary files /dev/null and b/Items/FabsolStuff/RedWine.png differ diff --git a/Items/FabsolStuff/Rum.cs b/Items/FabsolStuff/Rum.cs new file mode 100644 index 0000000000..a5bacff209 --- /dev/null +++ b/Items/FabsolStuff/Rum.cs @@ -0,0 +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); + } + } +} diff --git a/Items/FabsolStuff/Rum.png b/Items/FabsolStuff/Rum.png new file mode 100644 index 0000000000..3daa5a32f3 Binary files /dev/null and b/Items/FabsolStuff/Rum.png differ diff --git a/Items/FabsolStuff/Screwdriver.cs b/Items/FabsolStuff/Screwdriver.cs new file mode 100644 index 0000000000..579cb35c4c --- /dev/null +++ b/Items/FabsolStuff/Screwdriver.cs @@ -0,0 +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 3 +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/Screwdriver.png b/Items/FabsolStuff/Screwdriver.png new file mode 100644 index 0000000000..ed17ab97fa Binary files /dev/null and b/Items/FabsolStuff/Screwdriver.png differ diff --git a/Items/FabsolStuff/StarBeamRye.cs b/Items/FabsolStuff/StarBeamRye.cs new file mode 100644 index 0000000000..63dcc4f125 --- /dev/null +++ b/Items/FabsolStuff/StarBeamRye.cs @@ -0,0 +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 and critical strike chance by 5%, +and reduces mana usage by 10% +Reduces defense by 6 and life regen by 3 +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/StarBeamRye.png b/Items/FabsolStuff/StarBeamRye.png new file mode 100644 index 0000000000..4ff80ee153 Binary files /dev/null and b/Items/FabsolStuff/StarBeamRye.png differ diff --git a/Items/FabsolStuff/Tequila.cs b/Items/FabsolStuff/Tequila.cs new file mode 100644 index 0000000000..d939431e75 --- /dev/null +++ b/Items/FabsolStuff/Tequila.cs @@ -0,0 +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, critical strike chance, damage reduction, and knockback by 3% and defense by 5 during daytime +Reduces life regen by 2 +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/Tequila.png b/Items/FabsolStuff/Tequila.png new file mode 100644 index 0000000000..fbc599e369 Binary files /dev/null and b/Items/FabsolStuff/Tequila.png differ diff --git a/Items/FabsolStuff/TequilaSunrise.cs b/Items/FabsolStuff/TequilaSunrise.cs new file mode 100644 index 0000000000..ec4169ca0e --- /dev/null +++ b/Items/FabsolStuff/TequilaSunrise.cs @@ -0,0 +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, critical strike chance, damage reduction, and knockback by 9% and defense by 15 during daytime +Reduces life regen by 3 +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/TequilaSunrise.png b/Items/FabsolStuff/TequilaSunrise.png new file mode 100644 index 0000000000..481020aafa Binary files /dev/null and b/Items/FabsolStuff/TequilaSunrise.png differ diff --git a/Items/FabsolStuff/Vodka.cs b/Items/FabsolStuff/Vodka.cs new file mode 100644 index 0000000000..b42f60357d --- /dev/null +++ b/Items/FabsolStuff/Vodka.cs @@ -0,0 +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 and critical strike chance by 5% +Reduces life regen by 2 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/Vodka.png b/Items/FabsolStuff/Vodka.png new file mode 100644 index 0000000000..2e89309b90 Binary files /dev/null and b/Items/FabsolStuff/Vodka.png differ diff --git a/Items/FabsolStuff/Whiskey.cs b/Items/FabsolStuff/Whiskey.cs new file mode 100644 index 0000000000..31e3682806 --- /dev/null +++ b/Items/FabsolStuff/Whiskey.cs @@ -0,0 +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, critical strike chance, and knockback by 3% +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/Whiskey.png b/Items/FabsolStuff/Whiskey.png new file mode 100644 index 0000000000..f22e44b9f7 Binary files /dev/null and b/Items/FabsolStuff/Whiskey.png differ diff --git a/Items/FabsolStuff/WhiteWine.cs b/Items/FabsolStuff/WhiteWine.cs new file mode 100644 index 0000000000..a5d8cbd9a4 --- /dev/null +++ b/Items/FabsolStuff/WhiteWine.cs @@ -0,0 +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 3 +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/WhiteWine.png b/Items/FabsolStuff/WhiteWine.png new file mode 100644 index 0000000000..0c5132fa34 Binary files /dev/null and b/Items/FabsolStuff/WhiteWine.png differ diff --git a/Items/FabsolStuff/YellowCandle.png b/Items/FabsolStuff/YellowCandle.png new file mode 100644 index 0000000000..2c512cef6c Binary files /dev/null and b/Items/FabsolStuff/YellowCandle.png differ diff --git a/Items/FetidEssence.cs b/Items/FetidEssence.cs index f5a1a392e9..9a9f4e1335 100644 --- a/Items/FetidEssence.cs +++ b/Items/FetidEssence.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 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 = 5000; - item.rare = 1; - } +using System; +using 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 = 5000; + item.rare = 1; + } }} \ No newline at end of file diff --git a/Items/FlamebeakHampick.cs b/Items/FlamebeakHampick.cs index 39207c4259..fbdb26276d 100644 --- a/Items/FlamebeakHampick.cs +++ b/Items/FlamebeakHampick.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 -{ - public class FlamebeakHampick : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flamebeak Hampick"); - } - - public override void SetDefaults() - { - item.damage = 58; - item.melee = true; - item.width = 36; - item.height = 36; - item.useTime = 6; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 210; - item.hammer = 130; - item.useStyle = 1; - item.knockBack = 3.5f; - item.value = 197000; - 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); - } - } +using System; +using 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"); + } + + public override void SetDefaults() + { + item.damage = 58; + item.melee = true; + item.width = 36; + item.height = 36; + item.useTime = 6; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 210; + item.hammer = 130; + item.useStyle = 1; + item.knockBack = 3.5f; + item.value = 197000; + 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 diff --git a/Items/FoxDrive.cs b/Items/FoxDrive.cs index 8302e39dc6..6eeb029873 100644 --- a/Items/FoxDrive.cs +++ b/Items/FoxDrive.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 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.expert = true; - } - - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, 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 +{ + 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.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 diff --git a/Items/GalacticaSingularity.cs b/Items/GalacticaSingularity.cs index 5f542a1447..4772a57d64 100644 --- a/Items/GalacticaSingularity.cs +++ b/Items/GalacticaSingularity.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 { -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 = 69; - item.value = 500000; - 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 *= 0.0001f; - 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); - } +using System; +using 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 = 69; + item.value = 500000; + 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 *= 0.0001f; + 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 diff --git a/Items/GallantPickaxe.cs b/Items/GallantPickaxe.cs index f78d7bd87d..eed1cfdb48 100644 --- a/Items/GallantPickaxe.cs +++ b/Items/GallantPickaxe.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 -{ - 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 = 200000; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 5; - } - - 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 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, 500); - } - } +using System; +using 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 = 200000; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 5; + } + + 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 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, 500); + } + } } \ No newline at end of file diff --git a/Items/Gelpick.cs b/Items/Gelpick.cs index b412a82004..d040fb5b5c 100644 --- a/Items/Gelpick.cs +++ b/Items/Gelpick.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 { -public class Gelpick : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gelpick"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.melee = true; - item.width = 46; - item.height = 46; - item.useTime = 15; - item.useAnimation = 15; - item.pick = 100; - item.useStyle = 1; - item.knockBack = 4; - item.value = 107000; - 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, 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 { +public class Gelpick : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gelpick"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.melee = true; + item.width = 46; + item.height = 46; + item.useTime = 15; + item.useAnimation = 15; + item.pick = 100; + item.useStyle = 1; + item.knockBack = 4; + item.value = 107000; + 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, 100); + } }} \ No newline at end of file diff --git a/Items/GodlySoulArtifact.cs b/Items/GodlySoulArtifact.cs index 7caf45f75b..494b211ae7 100644 --- a/Items/GodlySoulArtifact.cs +++ b/Items/GodlySoulArtifact.cs @@ -1,57 +1,57 @@ -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 = 5000000; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } +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 = 5000000; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/GreatSandShark/GrandScale.cs b/Items/GreatSandShark/GrandScale.cs index 9e3c887042..262030e3de 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 = 50000; - item.rare = 7; - } - } +using System; +using 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 = 50000; + item.rare = 7; + } + } } \ No newline at end of file diff --git a/Items/GreatSandShark/SandstormsCore.cs b/Items/GreatSandShark/SandstormsCore.cs index 262bac2d3c..7a237d0f29 100644 --- a/Items/GreatSandShark/SandstormsCore.cs +++ b/Items/GreatSandShark/SandstormsCore.cs @@ -1,49 +1,49 @@ -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"); - } - - 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(); - } - } +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"); + } + + 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 diff --git a/Items/GreatbayPickaxe.cs b/Items/GreatbayPickaxe.cs index 33909a867c..de2e4a69eb 100644 --- a/Items/GreatbayPickaxe.cs +++ b/Items/GreatbayPickaxe.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 GreatbayPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatbay Pickaxe"); - } - - public override void SetDefaults() - { - item.damage = 13; - item.melee = true; - item.width = 32; - item.height = 32; - item.useTime = 15; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 60; - item.useStyle = 1; - item.knockBack = 2; - item.value = 57000; - 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(); - } - } +using System; +using 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"); + } + + public override void SetDefaults() + { + item.damage = 13; + item.melee = true; + item.width = 32; + item.height = 32; + item.useTime = 15; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 60; + item.useStyle = 1; + item.knockBack = 2; + item.value = 57000; + 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 diff --git a/Items/GypsyPowder.cs b/Items/GypsyPowder.cs index 80b657fe2e..bbd9d9470c 100644 --- a/Items/GypsyPowder.cs +++ b/Items/GypsyPowder.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 50000; - item.rare = 5; - } +using System; +using 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 = 50000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/HiveMind/HiveMindBag.cs b/Items/HiveMind/HiveMindBag.cs index 10e5f63454..a0e2d84970 100644 --- a/Items/HiveMind/HiveMindBag.cs +++ b/Items/HiveMind/HiveMindBag.cs @@ -1,75 +1,75 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 (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)); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 (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 diff --git a/Items/HiveMind/RottenBrain.cs b/Items/HiveMind/RottenBrain.cs index 89da591e37..c472209f48 100644 --- a/Items/HiveMind/RottenBrain.cs +++ b/Items/HiveMind/RottenBrain.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.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 = 100000; - item.expert = true; - 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; - } - } - } - } - if (player.statLife <= (player.statLifeMax2 * 0.75f)) - { - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.rangedDamage += 0.1f; - player.thrownDamage += 0.1f; - player.minionDamage += 0.1f; - } - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.moveSpeed -= 0.05f; - } - } - } +using System; +using 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 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 = 100000; + item.expert = true; + 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; + } + } + } + } + if (player.statLife <= (player.statLifeMax2 * 0.75f)) + { + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.rangedDamage += 0.1f; + player.thrownDamage += 0.1f; + player.minionDamage += 0.1f; + } + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.moveSpeed -= 0.05f; + } + } + } } \ No newline at end of file diff --git a/Items/HiveMind/Teratoma.cs b/Items/HiveMind/Teratoma.cs index 81d49c0b8d..28f0c311ce 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(); - } - } +using System; +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 diff --git a/Items/HiveMind/TrueShadowScale.cs b/Items/HiveMind/TrueShadowScale.cs index 2c3ceb0dec..8c80a7a68e 100644 --- a/Items/HiveMind/TrueShadowScale.cs +++ b/Items/HiveMind/TrueShadowScale.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 2500; - item.rare = 2; - } +using System; +using 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 = 2500; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/InfernalBlood.cs b/Items/InfernalBlood.cs index 5863178e30..1146fd6f3a 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 20% (80% 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; - } - } +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 20% (80% 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 diff --git a/Items/IronHeart.cs b/Items/IronHeart.cs index 0cd80826ba..f8d6b4ba05 100644 --- a/Items/IronHeart.cs +++ b/Items/IronHeart.cs @@ -1,67 +1,67 @@ -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 IronHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + - "This mode cannot 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.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = true; - } - - 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; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - return true; - } - } +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 IronHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iron Heart"); + Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + "This mode cannot 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.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = true; + } + + 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; + 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 diff --git a/Items/Knowledge.cs b/Items/Knowledge.cs index 766b5207ad..979e99ef1a 100644 --- a/Items/Knowledge.cs +++ b/Items/Knowledge.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Desert Scourge"); - Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + - "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + - "gluttonous husk on a constant and voracious search for its next meal."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Desert Scourge"); + Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + + "gluttonous husk on a constant and voracious search for its next meal."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge10.cs b/Items/Knowledge10.cs index f22285f4e7..7d0c8ab644 100644 --- a/Items/Knowledge10.cs +++ b/Items/Knowledge10.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge10 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ocean"); - Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + - "You may awaken something more terrifying than death itself."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge10 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ocean"); + Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + + "You may awaken something more terrifying than death itself."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge11.cs b/Items/Knowledge11.cs index a0c535801e..75c25507b0 100644 --- a/Items/Knowledge11.cs +++ b/Items/Knowledge11.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge11 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Brain of Cthulhu"); - Tooltip.SetDefault("An eye and now a brain.\n" + - "Most likely another abomination spawned from this inchoate mass of flesh."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge11 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Brain of Cthulhu"); + Tooltip.SetDefault("An eye and now a brain.\n" + + "Most likely another abomination spawned from this inchoate mass of flesh."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge12.cs b/Items/Knowledge12.cs index 79c9a559f4..d55f478f0c 100644 --- a/Items/Knowledge12.cs +++ b/Items/Knowledge12.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge12 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eater of Worlds"); - Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe.\n" + - "Seems likely given the origins of this place."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge12 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eater of Worlds"); + Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe.\n" + + "Seems likely given the origins of this place."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge13.cs b/Items/Knowledge13.cs index df5d04b388..b8de7336c7 100644 --- a/Items/Knowledge13.cs +++ b/Items/Knowledge13.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge13 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforators and their Hive"); - Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ; infested primarily by blood-slurping worms.\n" + - "The chunks left over from the brain must have been absorbed by the crimson and reconstituted into that thing."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge13 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforators and their Hive"); + Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ; infested primarily by blood-slurping worms.\n" + + "The chunks left over from the brain must have been absorbed by the crimson and reconstituted into that thing."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge14.cs b/Items/Knowledge14.cs index fa983d3bc4..15f4c14e7a 100644 --- a/Items/Knowledge14.cs +++ b/Items/Knowledge14.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge14 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + - "Sadly I do not believe killing it will lessen the corruption here."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge14 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + + "Sadly I do not believe killing it will lessen the corruption here."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge15.cs b/Items/Knowledge15.cs index 0ebe1cb4ac..ea2cc3d39b 100644 --- a/Items/Knowledge15.cs +++ b/Items/Knowledge15.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge15 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever born.\n" + - "If this creature were allowed to combine every slime on the planet then it would be nearly unstoppable."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge15 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever born.\n" + + "If this creature were allowed to combine every slime on the planet then it would be nearly unstoppable."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge16.cs b/Items/Knowledge16.cs index f69c0fccb9..81d58214ac 100644 --- a/Items/Knowledge16.cs +++ b/Items/Knowledge16.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge16 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations.\n" + - "...given the ability to control them."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge16 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Queen Bee"); + Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations.\n" + + "...given the ability to control them."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge17.cs b/Items/Knowledge17.cs index b7a7e6e87a..ba6bfcc9e0 100644 --- a/Items/Knowledge17.cs +++ b/Items/Knowledge17.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge17 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron"); - Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + - "After they are afflicted they become an immortal vessel for an ancient demon of the underworld."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge17 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron"); + Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge18.cs b/Items/Knowledge18.cs index 8b5530a2ae..c45d7c5d6f 100644 --- a/Items/Knowledge18.cs +++ b/Items/Knowledge18.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge18 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wall of Flesh"); - Tooltip.SetDefault("I see the deed is done.\n" + - "The unholy amalgamation of flesh and hatred has been defeated.\n" + - "Prepare to face the true terrors that lurk in the light and dark parts of this world."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge18 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wall of Flesh"); + Tooltip.SetDefault("I see the deed is done.\n" + + "The unholy amalgamation of flesh and hatred has been defeated.\n" + + "Prepare to face the true terrors that lurk in the light and dark parts of this world."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge19.cs b/Items/Knowledge19.cs index 1f3936c296..4704bd7131 100644 --- a/Items/Knowledge19.cs +++ b/Items/Knowledge19.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge19 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - Tooltip.SetDefault("You managed to bring down what dozens of sorcerers long ago could not.\n" + - "I am unsure if it has grown weaker over the decades of imprisonment."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge19 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen"); + Tooltip.SetDefault("You managed to bring down what dozens of sorcerers long ago could not.\n" + + "I am unsure if it has grown weaker over the decades of imprisonment."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge2.cs b/Items/Knowledge2.cs index fe55092a5d..c1265af4d2 100644 --- a/Items/Knowledge2.cs +++ b/Items/Knowledge2.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duke Fishron"); - Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king who tamed it using its favorite treat.\n" + - "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duke Fishron"); + Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king who tamed it using its favorite treat.\n" + + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge20.cs b/Items/Knowledge20.cs index afd7c5c219..500a1e6cc1 100644 --- a/Items/Knowledge20.cs +++ b/Items/Knowledge20.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge20 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Mechanical Bosses"); - Tooltip.SetDefault("I see you have awakened Draedon's toys.\n" + - "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge20 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Mechanical Bosses"); + Tooltip.SetDefault("I see you have awakened Draedon's toys.\n" + + "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge21.cs b/Items/Knowledge21.cs index 3f3acc2e9b..0590484d96 100644 --- a/Items/Knowledge21.cs +++ b/Items/Knowledge21.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge21 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Destroyer"); - Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors and built to excavate massive tunnels in planets to gather resources.\n" + - "Could have proven useful if he didn't have an obsession with turning everything into a tool of destruction."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge21 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Destroyer"); + Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors and built to excavate massive tunnels in planets to gather resources.\n" + + "Could have proven useful if he didn't have an obsession with turning everything into a tool of destruction."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge22.cs b/Items/Knowledge22.cs index b0a87a716f..c95adb526b 100644 --- a/Items/Knowledge22.cs +++ b/Items/Knowledge22.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge22 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Twins"); - Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + - "These creatures did not belong in this world, it's best to be rid of them."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge22 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Twins"); + Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + + "These creatures did not belong in this world, it's best to be rid of them."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge23.cs b/Items/Knowledge23.cs index ab37a93acb..c25ba767b2 100644 --- a/Items/Knowledge23.cs +++ b/Items/Knowledge23.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge23 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron Prime"); - Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + - "Draedon obviously took several liberties with his design of this thing...I am not impressed. Better off destroyed."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge23 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron Prime"); + Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + + "Draedon obviously took several liberties with his design of this thing...I am not impressed. Better off destroyed."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge24.cs b/Items/Knowledge24.cs index 85f571d94c..2b3a8af4d6 100644 --- a/Items/Knowledge24.cs +++ b/Items/Knowledge24.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge24 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Doppelganger"); - Tooltip.SetDefault("You are indeed stronger than I thought.\n" + - "Though the bloody inferno still lingers, observing your progress..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge24 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Doppelganger"); + Tooltip.SetDefault("You are indeed stronger than I thought.\n" + + "Though the bloody inferno still lingers, observing your progress..."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge25.cs b/Items/Knowledge25.cs index 44b65f56f3..a920486e75 100644 --- a/Items/Knowledge25.cs +++ b/Items/Knowledge25.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge25 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantera"); - Tooltip.SetDefault("Well done, you killed a plant.\n" + - "However, this plant was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + - "I wish you luck in dealing with the fallout."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 6; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge25 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plantera"); + Tooltip.SetDefault("Well done, you killed a plant.\n" + + "However, this plant was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + + "I wish you luck in dealing with the fallout."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 6; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge26.cs b/Items/Knowledge26.cs index 15ce28e378..598e238427 100644 --- a/Items/Knowledge26.cs +++ b/Items/Knowledge26.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge26 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + - "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge26 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge27.cs b/Items/Knowledge27.cs index ecf2aa16f7..c76585b4d0 100644 --- a/Items/Knowledge27.cs +++ b/Items/Knowledge27.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge27 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + - "These Scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge27 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + + "These Scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge28.cs b/Items/Knowledge28.cs index e92d71389b..55a95747f3 100644 --- a/Items/Knowledge28.cs +++ b/Items/Knowledge28.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge28 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan and Siren"); - Tooltip.SetDefault("An odd pair of creatures. One seeking companionship and the other seeking sustenance.\n" + - "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge28 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan and Siren"); + Tooltip.SetDefault("An odd pair of creatures. One seeking companionship and the other seeking sustenance.\n" + + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge29.cs b/Items/Knowledge29.cs index 25c370fb6f..c861d4d670 100644 --- a/Items/Knowledge29.cs +++ b/Items/Knowledge29.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge29 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - Tooltip.SetDefault("God of the stars and spreader of the astral infection.\n" + - "Though it was not the progenitor of the infection, that scaleless beast is still out there, devouring celestial bodies by the dozens."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge29 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + Tooltip.SetDefault("God of the stars and spreader of the astral infection.\n" + + "Though it was not the progenitor of the infection, that scaleless beast is still out there, devouring celestial bodies by the dozens."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge3.cs b/Items/Knowledge3.cs index df6158ab87..3373a5ff52 100644 --- a/Items/Knowledge3.cs +++ b/Items/Knowledge3.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge3 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eye of Cthulhu"); - Tooltip.SetDefault("That eye...how peculiar.\n" + - "I sensed it watching you more intensely as you grew stronger."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge3 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eye of Cthulhu"); + Tooltip.SetDefault("That eye...how peculiar.\n" + + "I sensed it watching you more intensely as you grew stronger."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge30.cs b/Items/Knowledge30.cs index cd43c7d0dd..ca831ff967 100644 --- a/Items/Knowledge30.cs +++ b/Items/Knowledge30.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge30 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrageldon Slime"); - Tooltip.SetDefault("A titanic slime infected by a star-borne disease expelled from the belly of an ancient god.\n" + - "The destruction of this creature will not prevent the spread of the disease."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge30 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + + "The destruction of this creature will not prevent the spread of the disease."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge31.cs b/Items/Knowledge31.cs index f5f93bf965..c1e2024d8a 100644 --- a/Items/Knowledge31.cs +++ b/Items/Knowledge31.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge31 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golem"); - Tooltip.SetDefault("To think my people once worshipped this thing as a god...\n" + - "We have come far since those ancient times."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge31 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golem"); + Tooltip.SetDefault("To think my people once worshipped this thing as a god...\n" + + "We have come far since those ancient times."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge32.cs b/Items/Knowledge32.cs index 8f31ed4c8b..ef3ec36b9c 100644 --- a/Items/Knowledge32.cs +++ b/Items/Knowledge32.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge32 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Tooltip.SetDefault("A beautiful amalgam of steel, flesh, and infection. Capable of destroying an entire civilization in just one onslaught.\n" + - "Its plague nuke barrage can leave an entire area uninhabitable for months...at least concerning certain species."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge32 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Tooltip.SetDefault("A beautiful amalgam of steel, flesh, and infection. Capable of destroying an entire civilization in just one onslaught.\n" + + "Its plague nuke barrage can leave an entire area uninhabitable for months...at least concerning certain species."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge33.cs b/Items/Knowledge33.cs index 92672a1035..57b7011e5b 100644 --- a/Items/Knowledge33.cs +++ b/Items/Knowledge33.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge33 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Tooltip.SetDefault("One of many flesh golems crafted through forbidden necromancy to counter my unstoppable forces.\n" + - "Its creators were slaughtered by it moments after its conception. It's for the best that is has been destroyed."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge33 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Tooltip.SetDefault("One of many flesh golems crafted through forbidden necromancy to counter my unstoppable forces.\n" + + "Its creators were slaughtered by it moments after its conception. It's for the best that is has been destroyed."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge34.cs b/Items/Knowledge34.cs index 4c27afd974..c758db88c1 100644 --- a/Items/Knowledge34.cs +++ b/Items/Knowledge34.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge34 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Red Moon"); - Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + - "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge34 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Red Moon"); + Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + + "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge4.cs b/Items/Knowledge4.cs index 6863531b0a..2d206c24d1 100644 --- a/Items/Knowledge4.cs +++ b/Items/Knowledge4.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge4 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunatic Cultist"); - Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + - "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + - "Your impending doom approaches..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge4 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lunatic Cultist"); + Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + + "Your impending doom approaches..."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge5.cs b/Items/Knowledge5.cs index a3d87af99f..810ffe25b0 100644 --- a/Items/Knowledge5.cs +++ b/Items/Knowledge5.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge5 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + - "It's interesting how creatures can adapt given certain circumstances."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge5 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + + "It's interesting how creatures can adapt given certain circumstances."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge6.cs b/Items/Knowledge6.cs index 28dd5f6e63..ba302a60e7 100644 --- a/Items/Knowledge6.cs +++ b/Items/Knowledge6.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge6 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Crag"); - Tooltip.SetDefault("Ah...this place.\n" + - "The scent of broken promises, pain, and eventual death is heavy in the air..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge6 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Crag"); + Tooltip.SetDefault("Ah...this place.\n" + + "The scent of broken promises, pain, and eventual death is heavy in the air..."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge7.cs b/Items/Knowledge7.cs index 005e21f2d2..b97a6d8469 100644 --- a/Items/Knowledge7.cs +++ b/Items/Knowledge7.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge7 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Underworld"); - Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + - "Unfortunately for them they were twisted by their inner demons until they were beyond saving."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge7 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Underworld"); + Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + + "Unfortunately for them they were twisted by their inner demons until they were beyond saving."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge8.cs b/Items/Knowledge8.cs index 52779a93cb..0a3d5b6614 100644 --- a/Items/Knowledge8.cs +++ b/Items/Knowledge8.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge8 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Crimson"); - Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + - "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge8 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Crimson"); + Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge9.cs b/Items/Knowledge9.cs index b60d9d8cbf..382136e18b 100644 --- a/Items/Knowledge9.cs +++ b/Items/Knowledge9.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge9 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Corruption"); - Tooltip.SetDefault("Ah, the rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + - "It is rumored that this microbe was created by a race predating the Terrarians."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge9 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Corruption"); + Tooltip.SetDefault("Ah, the rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + + "It is rumored that this microbe was created by a race predating the Terrarians."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/LORED/NO.cs b/Items/LORED/NO.cs index 9ca619a9f0..7796cb871d 100644 --- a/Items/LORED/NO.cs +++ b/Items/LORED/NO.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LORED -{ - public class NO : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SYNTAX ERROR"); - Tooltip.SetDefault("asdhgjhrew8943923203lajflfjndg89w34ut8340ofjaur823u31r"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 10; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } - - public override bool UseItem(Player player) - { - /*NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("THELORDE")); - Main.PlaySound(SoundID.Roar, player.position, 0);*/ - Main.instance = null; - return true; - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LORED +{ + public class NO : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SYNTAX ERROR"); + Tooltip.SetDefault("asdhgjhrew8943923203lajflfjndg89w34ut8340ofjaur823u31r"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override bool UseItem(Player player) + { + /*NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("THELORDE")); + Main.PlaySound(SoundID.Roar, player.position, 0);*/ + Main.instance = null; + return true; + } + } } \ No newline at end of file diff --git a/Items/Levi.cs b/Items/Levi.cs index d0b3940a47..a5a2a075d3 100644 --- a/Items/Levi.cs +++ b/Items/Levi.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 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"); - } - - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, 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 +{ + 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"); + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } } \ No newline at end of file diff --git a/Items/Leviathan/EnchantedPearl.cs b/Items/Leviathan/EnchantedPearl.cs index 6db501c4fd..9471259816 100644 --- a/Items/Leviathan/EnchantedPearl.cs +++ b/Items/Leviathan/EnchantedPearl.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.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 = 150000; - item.rare = 7; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.fishingSkill += 10; - player.cratePotion = 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.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 = 150000; + 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 diff --git a/Items/Leviathan/IOU.cs b/Items/Leviathan/IOU.cs index 5c94d39c8e..766b5c2122 100644 --- a/Items/Leviathan/IOU.cs +++ b/Items/Leviathan/IOU.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 100; - item.rare = 1; - } +using System; +using 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 = 100; + item.rare = 1; + } }} \ No newline at end of file diff --git a/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs index c047a50860..11475b3a16 100644 --- a/Items/Leviathan/LeviathanAmbergris.cs +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -1,101 +1,101 @@ -using System; -using 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 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 decreases all damage done by 5% but increases damage reduction by 5%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 22; - item.value = 900000; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.ignoreWater = true; - if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.endurance += 0.05f; - player.meleeDamage -= 0.05f; - player.thrownDamage -= 0.05f; - player.rangedDamage -= 0.05f; - player.magicDamage -= 0.05f; - player.minionDamage -= 0.05f; - } - else - { - player.meleeDamage += 0.1f; - player.thrownDamage += 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) - { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); - Main.projectile[projectile1].timeLeft = 10; - } - } - 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; - } - } - } +using System; +using 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 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 decreases all damage done by 5% but increases damage reduction by 5%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = 900000; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.ignoreWater = true; + if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.endurance += 0.05f; + player.meleeDamage -= 0.05f; + player.thrownDamage -= 0.05f; + player.rangedDamage -= 0.05f; + player.magicDamage -= 0.05f; + player.minionDamage -= 0.05f; + } + else + { + player.meleeDamage += 0.1f; + player.thrownDamage += 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) + { + int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); + Main.projectile[projectile1].timeLeft = 10; + } + } + 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 diff --git a/Items/Leviathan/LeviathanBag.cs b/Items/Leviathan/LeviathanBag.cs index 1fde104b34..f9b154a20d 100644 --- a/Items/Leviathan/LeviathanBag.cs +++ b/Items/Leviathan/LeviathanBag.cs @@ -1,65 +1,65 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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 - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("LeviathanMask")); - } - player.QuickSpawnItem(mod.ItemType("LeviathanAmbergris")); //done - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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 + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("LeviathanMask")); + } + player.QuickSpawnItem(mod.ItemType("LeviathanAmbergris")); //done + } + } } \ No newline at end of file diff --git a/Items/LivingShard.cs b/Items/LivingShard.cs index 63d5d7d06b..2bd277f7fb 100644 --- a/Items/LivingShard.cs +++ b/Items/LivingShard.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; -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 = 15000; - item.rare = 7; - } +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 = 15000; + item.rare = 7; + } }} \ No newline at end of file diff --git a/Items/LivingShard.png b/Items/LivingShard.png index 2ff00179b0..cf231fbd93 100644 Binary files a/Items/LivingShard.png and b/Items/LivingShard.png differ diff --git a/Items/ManeaterBulb.cs b/Items/ManeaterBulb.cs index b56a3bb047..95e0ee3afb 100644 --- a/Items/ManeaterBulb.cs +++ b/Items/ManeaterBulb.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 10000; - item.rare = 2; - } +using System; +using 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 = 10000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/MarniteObliterator.cs b/Items/MarniteObliterator.cs index 223096d79b..3e0022bb2f 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, 1, 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(); - } - } +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, 1, 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 diff --git a/Items/MeldBlob.cs b/Items/MeldBlob.cs index ae4f76f5f3..797c50c1f4 100644 --- a/Items/MeldBlob.cs +++ b/Items/MeldBlob.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 23750; - item.rare = 8; - } +using System; +using 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 = 23750; + item.rare = 8; + } }} \ No newline at end of file diff --git a/Items/MeldiateBar.cs b/Items/MeldiateBar.cs index b9a2cb0d4d..40f75d3900 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 = 75000; - item.rare = 9; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddIngredient(ItemID.HallowedBar); - recipe.AddIngredient(null, "MeldBlob", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 5); - 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 +{ + 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 = 75000; + item.rare = 9; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddIngredient(ItemID.HallowedBar); + recipe.AddIngredient(null, "MeldBlob", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 5); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/MiracleFruit.cs b/Items/MiracleFruit.cs index 3bb27df479..472e6caf68 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, "AstralBar", 5); - recipe.AddIngredient(null, "LivingShard", 10); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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, "AstralBar", 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 diff --git a/Items/Moonlight.cs b/Items/Moonlight.cs index d449cb1c74..d734951ec0 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(); - } - } +using System; +using System.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 diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs index ef8f3d203b..dfe8de9d53 100644 --- a/Items/Mounts/Fab.cs +++ b/Items/Mounts/Fab.cs @@ -1,100 +1,100 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; -using System; -using CalamityMod.Items; - -namespace CalamityMod.Items.Mounts -{ - class Fab : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 234; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("Fab"); - mountData.heightBoost = 20; - mountData.fallDamage = 0f; //0.5 - mountData.runSpeed = 18f; //12 - mountData.dashSpeed = 12f; //8 - mountData.flightTimeMax = 50000; - mountData.fatigueMax = 0; - mountData.jumpHeight = 20; - mountData.acceleration = 0.75f; - mountData.jumpSpeed = 15f; //10 - mountData.blockExtraJumps = false; - mountData.totalFrames = 15; - mountData.constantJump = false; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 30; - } - mountData.playerYOffsets = array; - mountData.xOffset = 0; - mountData.bodyFrame = 3; - mountData.yOffset = 0; //-8 - mountData.playerHeadOffset = 26; //30 - mountData.standingFrameCount = 1; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 8; //7 - mountData.runningFrameDelay = 36; //36 - mountData.runningFrameStart = 1; //9 - mountData.flyingFrameCount = 6; //0 - mountData.flyingFrameDelay = 4; //0 - mountData.flyingFrameStart = 9; //0 - mountData.inAirFrameCount = 1; //1 - mountData.inAirFrameDelay = 12; //12 - mountData.inAirFrameStart = 10; //10 - mountData.idleFrameCount = 5; //4 - mountData.idleFrameDelay = 12; //12 - mountData.idleFrameStart = 0; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.inAirFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != 2) - { - mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } - - 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; - player.thrownDamage += 0.1f; - } - if (Math.Abs(player.velocity.X) > 15f) - { - int rand = Main.rand.Next(2); - bool momo = false; - if (rand == 1) - { - momo = true; - } - Color meme; - if (momo) - { - meme = new Color(255, 68, 242); - } - else - { - meme = new Color(25, 105, 255); - } - Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); - Main.dust[dust].noGravity = true; - } - } - } -} +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; + +namespace CalamityMod.Items.Mounts +{ + class Fab : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 234; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("Fab"); + mountData.heightBoost = 20; + mountData.fallDamage = 0f; //0.5 + mountData.runSpeed = 18f; //12 + mountData.dashSpeed = 12f; //8 + mountData.flightTimeMax = 50000; + mountData.fatigueMax = 0; + mountData.jumpHeight = 20; + mountData.acceleration = 0.75f; + mountData.jumpSpeed = 15f; //10 + mountData.blockExtraJumps = false; + mountData.totalFrames = 15; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 30; + } + mountData.playerYOffsets = array; + mountData.xOffset = 0; + mountData.bodyFrame = 3; + mountData.yOffset = 0; //-8 + mountData.playerHeadOffset = 26; //30 + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 8; //7 + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = 1; //9 + mountData.flyingFrameCount = 6; //0 + mountData.flyingFrameDelay = 4; //0 + mountData.flyingFrameStart = 9; //0 + mountData.inAirFrameCount = 1; //1 + mountData.inAirFrameDelay = 12; //12 + mountData.inAirFrameStart = 10; //10 + mountData.idleFrameCount = 5; //4 + mountData.idleFrameDelay = 12; //12 + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != 2) + { + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + + 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; + player.thrownDamage += 0.1f; + } + if (Math.Abs(player.velocity.X) > 15f) + { + int rand = Main.rand.Next(2); + bool momo = false; + if (rand == 1) + { + momo = true; + } + Color meme; + if (momo) + { + meme = new Color(255, 68, 242); + } + else + { + meme = new Color(25, 105, 255); + } + Rectangle rect = player.getRect(); + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs index e2a728aa13..6457b23356 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 ef589f10ce..75100cd3b1 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 = 18; - 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 = 18; + 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 12535ad8d6..66e0b39343 100644 --- a/Items/MurkyPaste.cs +++ b/Items/MurkyPaste.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 5000; - item.rare = 1; - } +using System; +using 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 = 5000; + item.rare = 1; + } }} \ No newline at end of file diff --git a/Items/MurkySludge.cs b/Items/MurkySludge.cs index 1ae6a649da..95e3201c0d 100644 --- a/Items/MurkySludge.cs +++ b/Items/MurkySludge.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 20000; - item.rare = 1; - } +using System; +using 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 = 20000; + item.rare = 1; + } }} \ No newline at end of file diff --git a/Items/MushroomPlasmaRoot.cs b/Items/MushroomPlasmaRoot.cs index 107aa277d8..aede14ec85 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 20% (80% 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; - } - } +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 20% (80% 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 diff --git a/Items/NightmareFuel.cs b/Items/NightmareFuel.cs index 4b471fbce2..bd7602cf0f 100644 --- a/Items/NightmareFuel.cs +++ b/Items/NightmareFuel.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; -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.value = 50000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } +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.value = 50000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } }} \ No newline at end of file diff --git a/Items/OldPowerCell.cs b/Items/OldPowerCell.cs index eb8fc8a839..43381a079f 100644 --- a/Items/OldPowerCell.cs +++ b/Items/OldPowerCell.cs @@ -1,61 +1,61 @@ -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) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - 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(); - } - } +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) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + 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 diff --git a/Items/OmegaHealingPotion.cs b/Items/OmegaHealingPotion.cs index 1ad9c25aef..7ee1e72f0c 100644 --- a/Items/OmegaHealingPotion.cs +++ b/Items/OmegaHealingPotion.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 -{ - public class OmegaHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Healing Potion"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.healLife = 300; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.value = 100000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SupremeHealingPotion"); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items +{ + public class OmegaHealingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Healing Potion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.healLife = 300; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.value = 100000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SupremeHealingPotion"); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Perforator/BloodSample.cs b/Items/Perforator/BloodSample.cs index 6f9f4ad396..4078ca4772 100644 --- a/Items/Perforator/BloodSample.cs +++ b/Items/Perforator/BloodSample.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.Perforator { -public class BloodSample : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Sample"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.scale = 0.5f; - item.maxStack = 999; - item.value = 2500; - item.rare = 2; - } +using System; +using 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.scale = 0.5f; + item.maxStack = 999; + item.value = 2500; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/Perforator/BloodyWormFood.cs b/Items/Perforator/BloodyWormFood.cs index 65e99c9e70..b417c8743d 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(); - } - } +using System; +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 diff --git a/Items/Perforator/BloodyWormTooth.cs b/Items/Perforator/BloodyWormTooth.cs index 21170b8850..f3f138dee4 100644 --- a/Items/Perforator/BloodyWormTooth.cs +++ b/Items/Perforator/BloodyWormTooth.cs @@ -1,44 +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.Perforator { -public class BloodyWormTooth : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Tooth"); - Tooltip.SetDefault("6% increased damage reduction and increased melee stats\n" + - "12% increased damage reduction and melee stats when below 50% life"); - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 15; - item.value = 100000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if(player.statLife < (player.statLifeMax2 * 0.5f)) - { - player.meleeDamage *= 1.2f; - player.meleeSpeed += 0.1f; - player.endurance += 0.12f; - } - else - { - player.meleeDamage *= 1.1f; - player.meleeSpeed += 0.05f; - player.endurance += 0.06f; - } - } -}} \ No newline at end of file +using System; +using 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 = 100000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + 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; + } + } + } +} \ No newline at end of file diff --git a/Items/Perforator/PerforatorBag.cs b/Items/Perforator/PerforatorBag.cs index 4d201bd04b..72f869a800 100644 --- a/Items/Perforator/PerforatorBag.cs +++ b/Items/Perforator/PerforatorBag.cs @@ -1,79 +1,79 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 (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)); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 (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 diff --git a/Items/Permafrost/AbsoluteZero.cs b/Items/Permafrost/AbsoluteZero.cs index fb7888a6a7..5a83fecaa4 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 = 56; - 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, 50, 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 / 3, knockBack * 3, 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 = 56; + 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, 50, 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 / 3, knockBack * 3, player.whoAmI); + Main.projectile[p].Kill(); + } + } +} diff --git a/Items/Permafrost/ArcticBearPaw.cs b/Items/Permafrost/ArcticBearPaw.cs index b67bd94e74..5244b24453 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 = 77; - 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, 40, 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 = 77; + 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, 40, 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 7545f32daf..29a0aa4d33 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, 35, 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.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, 35, 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.life -= target.lifeMax * 2 / 100; + target.checkDead(); + } + } +} diff --git a/Items/Permafrost/CryogenicStaff.cs b/Items/Permafrost/CryogenicStaff.cs index 89689b44f8..7d57768144 100644 --- a/Items/Permafrost/CryogenicStaff.cs +++ b/Items/Permafrost/CryogenicStaff.cs @@ -1,60 +1,60 @@ -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.sellPrice(0, 9, 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.sellPrice(0, 9, 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 92e6f2b138..efab98bce3 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 5325807d71..37d629d6b2 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 8eb666bbae..43f2210e2d 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, 45, 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, 45, 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 c411d1e2ce..4cb1610c3e 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, 45, 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, 45, 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/FrostyFlare.cs b/Items/Permafrost/FrostyFlare.cs index e30e65789b..b09ef3bb65 100644 --- a/Items/Permafrost/FrostyFlare.cs +++ b/Items/Permafrost/FrostyFlare.cs @@ -1,39 +1,39 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class FrostyFlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); - Tooltip.SetDefault("Sticks to enemies\nGenerates a localized hailstorm\n'Do not insert in flare gun'"); - } - public override void SetDefaults() - { - item.damage = 32; - item.noUseGraphic = true; - item.noMelee = true; - item.thrown = 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; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class FrostyFlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + Tooltip.SetDefault("Sticks to enemies\nGenerates a localized hailstorm\n'Do not insert in flare gun'"); + } + public override void SetDefaults() + { + item.damage = 32; + item.noUseGraphic = true; + item.noMelee = true; + item.thrown = 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; + } + } +} diff --git a/Items/Permafrost/IcicleArrow.cs b/Items/Permafrost/IcicleArrow.cs index a0fa711a05..0a9ebb85b5 100644 --- a/Items/Permafrost/IcicleArrow.cs +++ b/Items/Permafrost/IcicleArrow.cs @@ -1,31 +1,32 @@ -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.width = 14; - item.height = 50; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 0, 0, 15); - item.rare = 5; - 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 = 5; + 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 be3a435ef8..bb45cb16b8 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, 40, 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, 40, 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 8c4e3d7a27..5fafbf882a 100644 --- a/Items/Permafrost/IcyBullet.cs +++ b/Items/Permafrost/IcyBullet.cs @@ -1,31 +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.width = 18; - item.height = 16; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 0, 15); - item.rare = 5; - 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 = 5; + 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 9c92a45db7..a7be2ad83d 100644 --- a/Items/Permafrost/PermafrostsConcoction.cs +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -1,34 +1,34 @@ -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/WintersFury.cs b/Items/Permafrost/WintersFury.cs index 0687723545..1b6a66a3cf 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, 40, 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, 40, 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 dd50f427fd..91004871fe 100644 --- a/Items/PhantomHeart.cs +++ b/Items/PhantomHeart.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; - -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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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, "Phantoplasm", 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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, "Phantoplasm", 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Phantoplasm.cs b/Items/Phantoplasm.cs index f2eec0ff81..ccc16d54c4 100644 --- a/Items/Phantoplasm.cs +++ b/Items/Phantoplasm.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 { -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.value = 97500; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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.value = 97500; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 0); + } }} \ No newline at end of file diff --git a/Items/Placeables/AbyssBath.cs b/Items/Placeables/AbyssBath.cs index c6eac95325..f338ef95b1 100644 --- a/Items/Placeables/AbyssBath.cs +++ b/Items/Placeables/AbyssBath.cs @@ -1,35 +1,35 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AbyssBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AbyssBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssBed.cs b/Items/Placeables/AbyssBed.cs index eee1e1505d..a146892842 100644 --- a/Items/Placeables/AbyssBed.cs +++ b/Items/Placeables/AbyssBed.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("AbyssBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("AbyssBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssBookcase.cs b/Items/Placeables/AbyssBookcase.cs index 9f1b4f8805..03ce37ad13 100644 --- a/Items/Placeables/AbyssBookcase.cs +++ b/Items/Placeables/AbyssBookcase.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AbyssBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AbyssBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssCandelabra.cs b/Items/Placeables/AbyssCandelabra.cs index e1467b7b33..d9ecc4d71c 100644 --- a/Items/Placeables/AbyssCandelabra.cs +++ b/Items/Placeables/AbyssCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssCandelabra : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 5); - recipe.AddIngredient(null, "Lumenite", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssCandelabra : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 5); + recipe.AddIngredient(null, "Lumenite", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssCandle.cs b/Items/Placeables/AbyssCandle.cs index 0e58fe44c1..aba14a3a66 100644 --- a/Items/Placeables/AbyssCandle.cs +++ b/Items/Placeables/AbyssCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssCandle : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 4); - recipe.AddIngredient(null, "Lumenite"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssCandle : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 4); + recipe.AddIngredient(null, "Lumenite"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssChair.cs b/Items/Placeables/AbyssChair.cs index c135f27062..7f992eadd9 100644 --- a/Items/Placeables/AbyssChair.cs +++ b/Items/Placeables/AbyssChair.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("AbyssChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("AbyssChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssChandelier.cs b/Items/Placeables/AbyssChandelier.cs index f704cef2d5..18a7dc2a88 100644 --- a/Items/Placeables/AbyssChandelier.cs +++ b/Items/Placeables/AbyssChandelier.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssChandelier : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 4); - recipe.AddIngredient(null, "Lumenite", 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssChandelier : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 4); + recipe.AddIngredient(null, "Lumenite", 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssChest.cs b/Items/Placeables/AbyssChest.cs index 18ac3be6cf..954a5a1c7e 100644 --- a/Items/Placeables/AbyssChest.cs +++ b/Items/Placeables/AbyssChest.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssChest : 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("AbyssChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssChest : 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("AbyssChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssClock.cs b/Items/Placeables/AbyssClock.cs index 883bcdf47f..89d1d8e5f5 100644 --- a/Items/Placeables/AbyssClock.cs +++ b/Items/Placeables/AbyssClock.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssClock : 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("AbyssClock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(null, "SmoothAbyssGravel", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssClock : 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("AbyssClock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.AddIngredient(null, "SmoothAbyssGravel", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssDoor.cs b/Items/Placeables/AbyssDoor.cs index 3dc76de613..0ffd04ad14 100644 --- a/Items/Placeables/AbyssDoor.cs +++ b/Items/Placeables/AbyssDoor.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AbyssDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AbyssDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssDresser.cs b/Items/Placeables/AbyssDresser.cs index ed136c0467..ddb0632365 100644 --- a/Items/Placeables/AbyssDresser.cs +++ b/Items/Placeables/AbyssDresser.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssDresser : 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("AbyssDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssDresser : 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("AbyssDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs index 529e865c68..ac52f5e258 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/AbyssGravel.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 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; - item.value = 1000; - item.rare = 0; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + item.value = 1000; + item.rare = 0; + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssLamp.cs b/Items/Placeables/AbyssLamp.cs index a6cda0c7ed..5d15dcff84 100644 --- a/Items/Placeables/AbyssLamp.cs +++ b/Items/Placeables/AbyssLamp.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssLamp : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Lumenite"); - recipe.AddIngredient(null, "SmoothAbyssGravel", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssLamp : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Lumenite"); + recipe.AddIngredient(null, "SmoothAbyssGravel", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssLantern.cs b/Items/Placeables/AbyssLantern.cs index a4b8c82216..343292b4e4 100644 --- a/Items/Placeables/AbyssLantern.cs +++ b/Items/Placeables/AbyssLantern.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssLantern : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 6); - recipe.AddIngredient(null, "Lumenite"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssLantern : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 6); + recipe.AddIngredient(null, "Lumenite"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssPiano.cs b/Items/Placeables/AbyssPiano.cs index a74684089c..693e72c6ca 100644 --- a/Items/Placeables/AbyssPiano.cs +++ b/Items/Placeables/AbyssPiano.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssPiano : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "SmoothAbyssGravel", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssPiano : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "SmoothAbyssGravel", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssSink.cs b/Items/Placeables/AbyssSink.cs index b89d05816b..35d794d01d 100644 --- a/Items/Placeables/AbyssSink.cs +++ b/Items/Placeables/AbyssSink.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssSink : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssSink : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 6); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssSofa.cs b/Items/Placeables/AbyssSofa.cs index 9de91d9061..a734078f41 100644 --- a/Items/Placeables/AbyssSofa.cs +++ b/Items/Placeables/AbyssSofa.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssSofa : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssSofa : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssTable.cs b/Items/Placeables/AbyssTable.cs index 1caa912e72..17c9fc4428 100644 --- a/Items/Placeables/AbyssTable.cs +++ b/Items/Placeables/AbyssTable.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssTable : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AbyssTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssTable : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AbyssTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssTorch.cs b/Items/Placeables/AbyssTorch.cs index 435d69bf38..99e7008202 100644 --- a/Items/Placeables/AbyssTorch.cs +++ b/Items/Placeables/AbyssTorch.cs @@ -1,59 +1,59 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssTorch : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 10; - item.height = 12; - item.maxStack = 99; - item.holdStyle = 1; - item.noWet = false; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AbyssTorch"); - item.flame = false; - item.value = 50; - } - - public override void HoldItem(Player player) - { - if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0) - { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, mod.DustType("Sparkle")); - } - Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); - Lighting.AddLight(position, 1f, 1f, 1f); - } - - public override void PostUpdate() - { - if (!item.wet) - { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 1f); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.AddIngredient(null, "Lumenite"); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssTorch : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 10; + item.height = 12; + item.maxStack = 99; + item.holdStyle = 1; + item.noWet = false; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AbyssTorch"); + item.flame = false; + item.value = 50; + } + + public override void HoldItem(Player player) + { + if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, mod.DustType("Sparkle")); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 1f, 1f, 1f); + } + + public override void PostUpdate() + { + if (!item.wet) + { + Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 1f); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.AddIngredient(null, "Lumenite"); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AbyssWorkbench.cs b/Items/Placeables/AbyssWorkbench.cs index c106f293d3..d8c28822a0 100644 --- a/Items/Placeables/AbyssWorkbench.cs +++ b/Items/Placeables/AbyssWorkbench.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AbyssWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AbyssWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AbyssWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AbyssWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index 38391129de..004e85f5a2 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AerialiteBrick : 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("AerialiteBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "AerialiteOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AerialiteBrick : 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("AerialiteBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "AerialiteOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AerialiteBrickWall.cs b/Items/Placeables/AerialiteBrickWall.cs index 1074e9b2e1..ccdee5a25f 100644 --- a/Items/Placeables/AerialiteBrickWall.cs +++ b/Items/Placeables/AerialiteBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AerialiteBrickWall : 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("AerialiteBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AerialiteBrickWall : 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("AerialiteBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AerialiteOre.cs b/Items/Placeables/AerialiteOre.cs index 792b38af13..d93f43ac46 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 = 3750; - item.rare = 1; - } - } +using System; +using 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 = 3750; + item.rare = 1; + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientAltar.cs b/Items/Placeables/AncientAltar.cs index 1f2b012a08..73c2fb3f3b 100644 --- a/Items/Placeables/AncientAltar.cs +++ b/Items/Placeables/AncientAltar.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientAltar : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientAltar"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 25); - recipe.AddIngredient(null, "CharredOre", 25); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenAltar", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenAltar", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientAltar : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientAltar"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 25); + recipe.AddIngredient(null, "CharredOre", 25); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenAltar", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenAltar", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientBasin.cs b/Items/Placeables/AncientBasin.cs index 2b6d1fe290..4e4a938dda 100644 --- a/Items/Placeables/AncientBasin.cs +++ b/Items/Placeables/AncientBasin.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientBasin : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientBasin"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 25); - recipe.AddIngredient(null, "CharredOre", 25); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBasin", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBasin", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientBasin : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientBasin"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 25); + recipe.AddIngredient(null, "CharredOre", 25); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBasin", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBasin", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientBath.cs b/Items/Placeables/AncientBath.cs index fb9190a60e..e13cbc1b15 100644 --- a/Items/Placeables/AncientBath.cs +++ b/Items/Placeables/AncientBath.cs @@ -1,47 +1,47 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AncientBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBath", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBath", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AncientBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBath", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBath", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientBed.cs b/Items/Placeables/AncientBed.cs index 6fa0fb6e34..11f3f54f4c 100644 --- a/Items/Placeables/AncientBed.cs +++ b/Items/Placeables/AncientBed.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("AncientBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBed", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBed", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("AncientBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBed", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBed", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientBookcase.cs b/Items/Placeables/AncientBookcase.cs index db28303edd..31f1735bd6 100644 --- a/Items/Placeables/AncientBookcase.cs +++ b/Items/Placeables/AncientBookcase.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AncientBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBookcase", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenBookcase", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AncientBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBookcase", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenBookcase", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientChair.cs b/Items/Placeables/AncientChair.cs index 2554460ad0..d954fa7105 100644 --- a/Items/Placeables/AncientChair.cs +++ b/Items/Placeables/AncientChair.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("AncientChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenChair", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenChair", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("AncientChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenChair", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenChair", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientChandelier.cs b/Items/Placeables/AncientChandelier.cs index 1073c6453e..dc389dfda9 100644 --- a/Items/Placeables/AncientChandelier.cs +++ b/Items/Placeables/AncientChandelier.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 4); - recipe.AddIngredient(null, "UnholyCore", 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenChandelier", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenChandelier", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 4); + recipe.AddIngredient(null, "UnholyCore", 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenChandelier", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenChandelier", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientDoor.cs b/Items/Placeables/AncientDoor.cs index 1299882306..037246fdb6 100644 --- a/Items/Placeables/AncientDoor.cs +++ b/Items/Placeables/AncientDoor.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AncientDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenDoor", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenDoor", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AncientDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenDoor", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenDoor", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientDresser.cs b/Items/Placeables/AncientDresser.cs index 18134d26e2..80a88c71c7 100644 --- a/Items/Placeables/AncientDresser.cs +++ b/Items/Placeables/AncientDresser.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientDresser: 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("AncientDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenDresser", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenDresser", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientDresser: 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("AncientDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenDresser", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenDresser", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientLamp.cs b/Items/Placeables/AncientLamp.cs index e732883a09..0c08cdfef4 100644 --- a/Items/Placeables/AncientLamp.cs +++ b/Items/Placeables/AncientLamp.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.AddIngredient(null, "BrimstoneSlag", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenLamp", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenLamp", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.AddIngredient(null, "BrimstoneSlag", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenLamp", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenLamp", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientLantern.cs b/Items/Placeables/AncientLantern.cs index 173da19442..ba8fe1150a 100644 --- a/Items/Placeables/AncientLantern.cs +++ b/Items/Placeables/AncientLantern.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenLantern", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenLantern", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 6); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenLantern", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenLantern", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientMonolith.cs b/Items/Placeables/AncientMonolith.cs index e38e4b48ae..0cf44900b8 100644 --- a/Items/Placeables/AncientMonolith.cs +++ b/Items/Placeables/AncientMonolith.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientMonolith: 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("AncientMonolith"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CharredOre", 3); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddIngredient(null, "BrimstoneSlag", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenMonolith", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenMonolith", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientMonolith: 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("AncientMonolith"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CharredOre", 3); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.AddIngredient(null, "BrimstoneSlag", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenMonolith", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenMonolith", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientPiano.cs b/Items/Placeables/AncientPiano.cs index 47f9b2d07d..e02c90015f 100644 --- a/Items/Placeables/AncientPiano.cs +++ b/Items/Placeables/AncientPiano.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientPiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "BrimstoneSlag", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenPiano", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenPiano", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientPiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "BrimstoneSlag", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenPiano", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenPiano", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientSink.cs b/Items/Placeables/AncientSink.cs index fffae05996..bd1b53dad7 100644 --- a/Items/Placeables/AncientSink.cs +++ b/Items/Placeables/AncientSink.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientSink: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 6); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenSink", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenSink", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientSink: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 6); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenSink", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenSink", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientSofa.cs b/Items/Placeables/AncientSofa.cs index 4edf7d71a6..f9eef9e33b 100644 --- a/Items/Placeables/AncientSofa.cs +++ b/Items/Placeables/AncientSofa.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientSofa: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenSofa", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenSofa", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientSofa: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenSofa", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenSofa", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientTable.cs b/Items/Placeables/AncientTable.cs index 039d17ea33..9cb7f3517b 100644 --- a/Items/Placeables/AncientTable.cs +++ b/Items/Placeables/AncientTable.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientTable: ModItem - { - public override void SetStaticDefaults() - { - - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AncientTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenTable", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenTable", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientTable: ModItem + { + public override void SetStaticDefaults() + { + + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AncientTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenTable", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenTable", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AncientWorkbench.cs b/Items/Placeables/AncientWorkbench.cs index ec9802330e..2372a06304 100644 --- a/Items/Placeables/AncientWorkbench.cs +++ b/Items/Placeables/AncientWorkbench.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AncientWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AncientWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenWorkbench", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AshenWorkbench", 1); - recipe.AddIngredient(null, "EssenceofChaos", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AncientWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AncientWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenWorkbench", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AshenWorkbench", 1); + recipe.AddIngredient(null, "EssenceofChaos", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AquaticScourgeMusicbox.cs b/Items/Placeables/AquaticScourgeMusicbox.cs index f279a76d2b..8ce1c344e0 100644 --- a/Items/Placeables/AquaticScourgeMusicbox.cs +++ b/Items/Placeables/AquaticScourgeMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AquaticScourgeMusicbox: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Aquatic Scourge)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("AquaticScourgeMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AquaticScourgeMusicbox: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Aquatic Scourge)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("AquaticScourgeMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenAltar.cs b/Items/Placeables/AshenAltar.cs index 9cf4b5f098..f5b1f8e11b 100644 --- a/Items/Placeables/AshenAltar.cs +++ b/Items/Placeables/AshenAltar.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenAltar : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenAltar"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 25); - recipe.AddIngredient(null, "Cinderplate", 25); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientAltar", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientAltar", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenAltar : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenAltar"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 25); + recipe.AddIngredient(null, "Cinderplate", 25); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientAltar", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientAltar", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenBasin.cs b/Items/Placeables/AshenBasin.cs index bb3807b53c..4ac3cd5ea1 100644 --- a/Items/Placeables/AshenBasin.cs +++ b/Items/Placeables/AshenBasin.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenBasin : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenBasin"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 25); - recipe.AddIngredient(null, "Cinderplate", 25); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBasin", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBasin", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenBasin : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenBasin"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 25); + recipe.AddIngredient(null, "Cinderplate", 25); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBasin", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBasin", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenBath.cs b/Items/Placeables/AshenBath.cs index ffce06be4d..cb4b39ca76 100644 --- a/Items/Placeables/AshenBath.cs +++ b/Items/Placeables/AshenBath.cs @@ -1,47 +1,47 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AshenBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBath", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBath", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AshenBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBath", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBath", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenBed.cs b/Items/Placeables/AshenBed.cs index a3173a766e..81fccdadf7 100644 --- a/Items/Placeables/AshenBed.cs +++ b/Items/Placeables/AshenBed.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("AshenBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBed", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBed", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("AshenBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBed", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBed", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenBookcase.cs b/Items/Placeables/AshenBookcase.cs index 53b1175434..9811e06fbc 100644 --- a/Items/Placeables/AshenBookcase.cs +++ b/Items/Placeables/AshenBookcase.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("AshenBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBookcase", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientBookcase", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("AshenBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBookcase", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientBookcase", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenCandelabra.cs b/Items/Placeables/AshenCandelabra.cs index fbd9950075..aead30c32e 100644 --- a/Items/Placeables/AshenCandelabra.cs +++ b/Items/Placeables/AshenCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); - recipe.AddIngredient(null, "UnholyCore", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenCandelabra: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); + recipe.AddIngredient(null, "UnholyCore", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenCandle.cs b/Items/Placeables/AshenCandle.cs index b7e09dace5..020187259b 100644 --- a/Items/Placeables/AshenCandle.cs +++ b/Items/Placeables/AshenCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenCandle: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); - recipe.AddIngredient(null, "UnholyCore"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenCandle: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); + recipe.AddIngredient(null, "UnholyCore"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenChair.cs b/Items/Placeables/AshenChair.cs index 467e72c578..c0e3db0cb4 100644 --- a/Items/Placeables/AshenChair.cs +++ b/Items/Placeables/AshenChair.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("AshenChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientChair", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientChair", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("AshenChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientChair", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientChair", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenChandelier.cs b/Items/Placeables/AshenChandelier.cs index 6a4cf636c1..5d9f015fd6 100644 --- a/Items/Placeables/AshenChandelier.cs +++ b/Items/Placeables/AshenChandelier.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); - recipe.AddIngredient(null, "UnholyCore"); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientChandelier", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientChandelier", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 4); + recipe.AddIngredient(null, "UnholyCore"); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientChandelier", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientChandelier", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenChest.cs b/Items/Placeables/AshenChest.cs index a632d9725a..61023d02e0 100644 --- a/Items/Placeables/AshenChest.cs +++ b/Items/Placeables/AshenChest.cs @@ -1,44 +1,44 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenChest : 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("AshenChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LockedAshenChest", 1); - recipe.AddIngredient(null, "AshenKey", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenChest : 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("AshenChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LockedAshenChest", 1); + recipe.AddIngredient(null, "AshenKey", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenDoor.cs b/Items/Placeables/AshenDoor.cs index d0a183be59..04392a2dca 100644 --- a/Items/Placeables/AshenDoor.cs +++ b/Items/Placeables/AshenDoor.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AshenDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientDoor", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientDoor", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AshenDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientDoor", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientDoor", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenDresser.cs b/Items/Placeables/AshenDresser.cs index 332e8de65f..ca789c4bc8 100644 --- a/Items/Placeables/AshenDresser.cs +++ b/Items/Placeables/AshenDresser.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenDresser: 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("AshenDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientDresser", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientDresser", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenDresser: 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("AshenDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientDresser", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientDresser", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenLamp.cs b/Items/Placeables/AshenLamp.cs index 2e6ef2757e..006bf33f94 100644 --- a/Items/Placeables/AshenLamp.cs +++ b/Items/Placeables/AshenLamp.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 3); - recipe.AddIngredient(null, "UnholyCore"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientLamp", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientLamp", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 3); + recipe.AddIngredient(null, "UnholyCore"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientLamp", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientLamp", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenLantern.cs b/Items/Placeables/AshenLantern.cs index 3943c3d120..47921b4f13 100644 --- a/Items/Placeables/AshenLantern.cs +++ b/Items/Placeables/AshenLantern.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); - recipe.AddIngredient(null, "UnholyCore"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientLantern", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientLantern", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); + recipe.AddIngredient(null, "UnholyCore"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientLantern", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientLantern", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenMonolith.cs b/Items/Placeables/AshenMonolith.cs index 6d4baaca46..9a188322ce 100644 --- a/Items/Placeables/AshenMonolith.cs +++ b/Items/Placeables/AshenMonolith.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenMonolith: 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("AshenMonolith"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); - recipe.AddIngredient(null, "Cinderplate", 3); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientMonolith", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientMonolith", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenMonolith: 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("AshenMonolith"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); + recipe.AddIngredient(null, "Cinderplate", 3); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientMonolith", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientMonolith", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenPiano.cs b/Items/Placeables/AshenPiano.cs index 56b14264a4..854ff44ef0 100644 --- a/Items/Placeables/AshenPiano.cs +++ b/Items/Placeables/AshenPiano.cs @@ -1,50 +1,50 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenPiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientPiano", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientPiano", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenPiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientPiano", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientPiano", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenPlatform.cs b/Items/Placeables/AshenPlatform.cs index bd1e84fc88..fc15f1cd65 100644 --- a/Items/Placeables/AshenPlatform.cs +++ b/Items/Placeables/AshenPlatform.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenPlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("AshenPlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate"); - recipe.SetResult(this, 2); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenPlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("AshenPlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate"); + recipe.SetResult(this, 2); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenSink.cs b/Items/Placeables/AshenSink.cs index 599166f643..b8cff8b1b5 100644 --- a/Items/Placeables/AshenSink.cs +++ b/Items/Placeables/AshenSink.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenSink: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientSink", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientSink", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenSink: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 6); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientSink", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientSink", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenSlab.cs b/Items/Placeables/AshenSlab.cs index f5e456f04e..d0acce26b5 100644 --- a/Items/Placeables/AshenSlab.cs +++ b/Items/Placeables/AshenSlab.cs @@ -1,43 +1,43 @@ -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 AshenSlab : 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("AshenSlab"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 1); - recipe.SetResult(this); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - //recipe = new ModRecipe(mod); - //recipe.AddIngredient(null, "CinderplateWall", 4); - //recipe.SetResult(this); - //recipe.AddTile(18); - //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 AshenSlab : 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("AshenSlab"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 1); + recipe.SetResult(this); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + //recipe = new ModRecipe(mod); + //recipe.AddIngredient(null, "CinderplateWall", 4); + //recipe.SetResult(this); + //recipe.AddTile(18); + //recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/AshenSofa.cs b/Items/Placeables/AshenSofa.cs index 4fe8764fde..ef0304ccce 100644 --- a/Items/Placeables/AshenSofa.cs +++ b/Items/Placeables/AshenSofa.cs @@ -1,49 +1,49 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenSofa: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientSofa", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientSofa", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenSofa: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientSofa", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientSofa", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenTable.cs b/Items/Placeables/AshenTable.cs index fd338cda8c..816e77baa6 100644 --- a/Items/Placeables/AshenTable.cs +++ b/Items/Placeables/AshenTable.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenTable: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("AshenTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientTable", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientTable", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenTable: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("AshenTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientTable", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientTable", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AshenWorkbench.cs b/Items/Placeables/AshenWorkbench.cs index aa5b69c987..b5dd86fae5 100644 --- a/Items/Placeables/AshenWorkbench.cs +++ b/Items/Placeables/AshenWorkbench.cs @@ -1,48 +1,48 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AshenWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("AshenWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientWorkbench", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientWorkbench", 1); - recipe.AddIngredient(null, "UnholyCore", 1); - recipe.SetResult(this, 1); - recipe.AddTile(null, "AncientAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AshenWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("AshenWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientWorkbench", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientWorkbench", 1); + recipe.AddIngredient(null, "UnholyCore", 1); + recipe.SetResult(this, 1); + recipe.AddTile(null, "AncientAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AstrageldonMusicbox.cs b/Items/Placeables/AstrageldonMusicbox.cs index 97a1de97a9..ed92d4863a 100644 --- a/Items/Placeables/AstrageldonMusicbox.cs +++ b/Items/Placeables/AstrageldonMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstrageldonMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Astrageldon)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("AstrageldonMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstrageldonMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Astrum Aureus)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("AstrageldonMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/AstrageldonTrophy.cs b/Items/Placeables/AstrageldonTrophy.cs index 57ec7634e4..b24080578e 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; - } - } +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 diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs index 31a05f98f2..df5e34b9f4 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/AstralBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralBrick : 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("AstralBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "AstralOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstralBrick : 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("AstralBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "AstralOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AstralBrickWall.cs b/Items/Placeables/AstralBrickWall.cs index e731f6aa3b..1c3b5303b1 100644 --- a/Items/Placeables/AstralBrickWall.cs +++ b/Items/Placeables/AstralBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralBrickWall : 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("AstralBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstralBrickWall : 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("AstralBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/AstralIceWall.cs b/Items/Placeables/AstralIceWall.cs index 5ad77da533..abbfaa2656 100644 --- a/Items/Placeables/AstralIceWall.cs +++ b/Items/Placeables/AstralIceWall.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("AstralIce")); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/AstralMusicbox.cs b/Items/Placeables/AstralMusicbox.cs index cf9f730272..cff6b6c0a5 100644 --- a/Items/Placeables/AstralMusicbox.cs +++ b/Items/Placeables/AstralMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Astral Biome)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("AstralMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstralMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Astral Biome)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("AstralMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/AstralMusicbox.png b/Items/Placeables/AstralMusicbox.png index e53533ffb1..3352db4715 100644 Binary files a/Items/Placeables/AstralMusicbox.png and b/Items/Placeables/AstralMusicbox.png differ diff --git a/Items/Placeables/AstralSandstone.cs b/Items/Placeables/AstralSandstone.cs index 875e694f7c..4875f65a92 100644 --- a/Items/Placeables/AstralSandstone.cs +++ b/Items/Placeables/AstralSandstone.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("AstralSandstoneWall"), 4); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/AstralSandstoneWall.cs b/Items/Placeables/AstralSandstoneWall.cs index c1bb865486..37143b2c11 100644 --- a/Items/Placeables/AstralSandstoneWall.cs +++ b/Items/Placeables/AstralSandstoneWall.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("AstralSandstone")); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/AstralStone.cs b/Items/Placeables/AstralStone.cs index 476b9d5960..d30e80154f 100644 --- a/Items/Placeables/AstralStone.cs +++ b/Items/Placeables/AstralStone.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("AstralStoneWall"), 4); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/AstralStoneWall.cs b/Items/Placeables/AstralStoneWall.cs index e375bc4bd0..61ff3a53ac 100644 --- a/Items/Placeables/AstralStoneWall.cs +++ b/Items/Placeables/AstralStoneWall.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("AstralStone")); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/AstrumDeusTrophy.cs b/Items/Placeables/AstrumDeusTrophy.cs index 0af64978e9..0ede4a15f9 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; - } - } +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 diff --git a/Items/Placeables/AuricOre.cs b/Items/Placeables/AuricOre.cs index a4439a8495..927d847f73 100644 --- a/Items/Placeables/AuricOre.cs +++ b/Items/Placeables/AuricOre.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.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 = 50000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - } +using System; +using 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 = 50000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + } } \ No newline at end of file diff --git a/Items/Placeables/BlueBrickWallUnsafe.cs b/Items/Placeables/BlueBrickWallUnsafe.cs index a96bda4c05..3db5a68ebe 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; - } - } +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 diff --git a/Items/Placeables/BlueSlabWallUnsafe.cs b/Items/Placeables/BlueSlabWallUnsafe.cs index ccce267edc..9f17fd3f37 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; - } - } +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 diff --git a/Items/Placeables/BlueTiledWallUnsafe.cs b/Items/Placeables/BlueTiledWallUnsafe.cs index 2cabe5c9ef..951af9fd66 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; - } - } +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 diff --git a/Items/Placeables/BrimstoneElementalTrophy.cs b/Items/Placeables/BrimstoneElementalTrophy.cs index aa9bbe73bb..28074e400b 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; - } - } +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 diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index cf1c25797e..715bd42dd2 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; - } - } +using System; +using 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 diff --git a/Items/Placeables/BrimstoneSlagWall.cs b/Items/Placeables/BrimstoneSlagWall.cs index ad8f28ada5..63077777b5 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(); - } - } +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 diff --git a/Items/Placeables/BumblebirbTrophy.cs b/Items/Placeables/BumblebirbTrophy.cs index 27847b3851..d05fd14d18 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; - } - } +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 diff --git a/Items/Placeables/CalamitasMusicbox.cs b/Items/Placeables/CalamitasMusicbox.cs index 9f0a748c6e..0364c58692 100644 --- a/Items/Placeables/CalamitasMusicbox.cs +++ b/Items/Placeables/CalamitasMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CalamitasMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Calamitas)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("CalamitasMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CalamitasMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Calamitas)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("CalamitasMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CalamitasTrophy.cs b/Items/Placeables/CalamitasTrophy.cs index 3cc84a5720..dd7eadbb0b 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; - } - } +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 diff --git a/Items/Placeables/CataclysmTrophy.cs b/Items/Placeables/CataclysmTrophy.cs index d699743dbf..0a722a0d5d 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; - } - } +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 diff --git a/Items/Placeables/CatastropheTrophy.cs b/Items/Placeables/CatastropheTrophy.cs index ce8b1888c9..14111278e4 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; - } - } +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 diff --git a/Items/Placeables/CeaselessVoidMusicbox.cs b/Items/Placeables/CeaselessVoidMusicbox.cs index f51ad4d9e7..7d26507b19 100644 --- a/Items/Placeables/CeaselessVoidMusicbox.cs +++ b/Items/Placeables/CeaselessVoidMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CeaselessVoidMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Ceaseless Void)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("CeaselessVoidMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CeaselessVoidMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Ceaseless Void)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("CeaselessVoidMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CeaselessVoidTrophy.cs b/Items/Placeables/CeaselessVoidTrophy.cs index b6277d6357..2bb3e973f1 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; - } - } +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 diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ChaoticBrick.cs index 1a5d22d39b..037036de85 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(); - } - } +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 diff --git a/Items/Placeables/ChaoticBrickWall.cs b/Items/Placeables/ChaoticBrickWall.cs index 70cd535c5c..332580d1e6 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(); - } - } +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 diff --git a/Items/Placeables/ChaoticOre.cs b/Items/Placeables/ChaoticOre.cs index 1129c8c1ac..6ed59038ae 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 = 8750; - item.rare = 8; - } - } +using System; +using 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 = 8750; + item.rare = 8; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CharredOre.cs b/Items/Placeables/CharredOre.cs index f02b742cbd..3635ffb449 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 = 9750; - item.rare = 6; - } - } +using System; +using 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 = 9750; + item.rare = 6; + } + } } \ No newline at end of file diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Cinderplate.cs index 797cf4d453..f5e558bab7 100644 --- a/Items/Placeables/Cinderplate.cs +++ b/Items/Placeables/Cinderplate.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.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 = 5000; - item.rare = 3; - } - } +using System; +using 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 = 5000; + item.rare = 3; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CinderplateWall.cs b/Items/Placeables/CinderplateWall.cs index 45ce621768..467b1d1782 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(); - } - } +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 diff --git a/Items/Placeables/CosmiliteBath.cs b/Items/Placeables/CosmiliteBath.cs index f2fdaab5eb..4f244cb820 100644 --- a/Items/Placeables/CosmiliteBath.cs +++ b/Items/Placeables/CosmiliteBath.cs @@ -1,35 +1,35 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("CosmiliteBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("CosmiliteBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBed.cs b/Items/Placeables/CosmiliteBed.cs index 39aacffc69..131603051c 100644 --- a/Items/Placeables/CosmiliteBed.cs +++ b/Items/Placeables/CosmiliteBed.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("CosmiliteBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("CosmiliteBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBookcase.cs b/Items/Placeables/CosmiliteBookcase.cs index 3cf3371155..bda0706b40 100644 --- a/Items/Placeables/CosmiliteBookcase.cs +++ b/Items/Placeables/CosmiliteBookcase.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("CosmiliteBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("CosmiliteBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBrick.cs b/Items/Placeables/CosmiliteBrick.cs index 89df8b61ac..7306786cea 100644 --- a/Items/Placeables/CosmiliteBrick.cs +++ b/Items/Placeables/CosmiliteBrick.cs @@ -1,48 +1,48 @@ -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 CosmiliteBrick : 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("CosmiliteBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar"); - recipe.AddIngredient(ItemID.StoneBlock, 20); - recipe.SetResult(this, 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrickWall", 4); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmilitePlatform", 2); - recipe.SetResult(this); - 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 CosmiliteBrick : 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("CosmiliteBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar"); + recipe.AddIngredient(ItemID.StoneBlock, 20); + recipe.SetResult(this, 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrickWall", 4); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmilitePlatform", 2); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/CosmiliteBrickWall.cs b/Items/Placeables/CosmiliteBrickWall.cs index 91e7653fd5..a65929e3f1 100644 --- a/Items/Placeables/CosmiliteBrickWall.cs +++ b/Items/Placeables/CosmiliteBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteBrickWall : 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("CosmiliteBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteBrickWall : 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("CosmiliteBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteCandelabra.cs b/Items/Placeables/CosmiliteCandelabra.cs index bedb1e5670..15d49413b9 100644 --- a/Items/Placeables/CosmiliteCandelabra.cs +++ b/Items/Placeables/CosmiliteCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteCandelabra: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 5); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteCandle.cs b/Items/Placeables/CosmiliteCandle.cs index bae33ec212..9a69625882 100644 --- a/Items/Placeables/CosmiliteCandle.cs +++ b/Items/Placeables/CosmiliteCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteCandle: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteCandle: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 4); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChair.cs b/Items/Placeables/CosmiliteChair.cs index d30924e9d5..70c7f28826 100644 --- a/Items/Placeables/CosmiliteChair.cs +++ b/Items/Placeables/CosmiliteChair.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("CosmiliteChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("CosmiliteChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChandelier.cs b/Items/Placeables/CosmiliteChandelier.cs index 9b683fa5f5..6136af95ef 100644 --- a/Items/Placeables/CosmiliteChandelier.cs +++ b/Items/Placeables/CosmiliteChandelier.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 4); + recipe.AddIngredient(ItemID.Torch, 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChest.cs b/Items/Placeables/CosmiliteChest.cs index d69696fb36..6859482d5d 100644 --- a/Items/Placeables/CosmiliteChest.cs +++ b/Items/Placeables/CosmiliteChest.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteChest : 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("CosmiliteChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteChest : 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("CosmiliteChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteClock.cs b/Items/Placeables/CosmiliteClock.cs index 2c9347ea63..64976ba6bc 100644 --- a/Items/Placeables/CosmiliteClock.cs +++ b/Items/Placeables/CosmiliteClock.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteClock: 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("CosmiliteClock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(null, "CosmiliteBrick", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteClock: 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("CosmiliteClock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.AddIngredient(null, "CosmiliteBrick", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteDoor.cs b/Items/Placeables/CosmiliteDoor.cs index 2818af3d4b..d51534c6c9 100644 --- a/Items/Placeables/CosmiliteDoor.cs +++ b/Items/Placeables/CosmiliteDoor.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("CosmiliteDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("CosmiliteDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteDresser.cs b/Items/Placeables/CosmiliteDresser.cs index 7eabb42924..cbd1449e0e 100644 --- a/Items/Placeables/CosmiliteDresser.cs +++ b/Items/Placeables/CosmiliteDresser.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteDresser: 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("CosmiliteDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteDresser: 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("CosmiliteDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteLamp.cs b/Items/Placeables/CosmiliteLamp.cs index 0efc7374dd..b0304f78d1 100644 --- a/Items/Placeables/CosmiliteLamp.cs +++ b/Items/Placeables/CosmiliteLamp.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(null, "CosmiliteBrick", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(null, "CosmiliteBrick", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteLantern.cs b/Items/Placeables/CosmiliteLantern.cs index a63be5c0cb..ff8deaba23 100644 --- a/Items/Placeables/CosmiliteLantern.cs +++ b/Items/Placeables/CosmiliteLantern.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 6); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmilitePiano.cs b/Items/Placeables/CosmilitePiano.cs index 8878450b55..a18d406b53 100644 --- a/Items/Placeables/CosmilitePiano.cs +++ b/Items/Placeables/CosmilitePiano.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmilitePiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmilitePiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "CosmiliteBrick", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmilitePiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmilitePiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "CosmiliteBrick", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmilitePlatform.cs b/Items/Placeables/CosmilitePlatform.cs index a41a3a2e3b..958169fafe 100644 --- a/Items/Placeables/CosmilitePlatform.cs +++ b/Items/Placeables/CosmilitePlatform.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmilitePlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("CosmilitePlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick"); - recipe.SetResult(this, 2); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmilitePlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("CosmilitePlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick"); + recipe.SetResult(this, 2); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteSink.cs b/Items/Placeables/CosmiliteSink.cs index 3a5e917e1b..bc1b2d5069 100644 --- a/Items/Placeables/CosmiliteSink.cs +++ b/Items/Placeables/CosmiliteSink.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteSink: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteSink: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 6); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteSofa.cs b/Items/Placeables/CosmiliteSofa.cs index 2725ac0b18..a09c853015 100644 --- a/Items/Placeables/CosmiliteSofa.cs +++ b/Items/Placeables/CosmiliteSofa.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteSofa: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteSofa: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteTable.cs b/Items/Placeables/CosmiliteTable.cs index 3f5a470a0d..b20fbec627 100644 --- a/Items/Placeables/CosmiliteTable.cs +++ b/Items/Placeables/CosmiliteTable.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteTable: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("CosmiliteTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteTable: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("CosmiliteTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CosmiliteWorkbench.cs b/Items/Placeables/CosmiliteWorkbench.cs index 47a614d14d..de00a4e8e3 100644 --- a/Items/Placeables/CosmiliteWorkbench.cs +++ b/Items/Placeables/CosmiliteWorkbench.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CosmiliteWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("CosmiliteWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBrick", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "DraedonsForge"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CosmiliteWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("CosmiliteWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBrick", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "DraedonsForge"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CrabulonMusicbox.cs b/Items/Placeables/CrabulonMusicbox.cs index e23b9b1f41..8e8ecd8f7a 100644 --- a/Items/Placeables/CrabulonMusicbox.cs +++ b/Items/Placeables/CrabulonMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CrabulonMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Crabulon)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("CrabulonMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CrabulonMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Crabulon)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("CrabulonMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CrabulonTrophy.cs b/Items/Placeables/CrabulonTrophy.cs index b9bed5c3c3..8ac457727a 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; - } - } +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 diff --git a/Items/Placeables/CryogenMusicbox.cs b/Items/Placeables/CryogenMusicbox.cs index 7d17f80837..5d7e7d93e5 100644 --- a/Items/Placeables/CryogenMusicbox.cs +++ b/Items/Placeables/CryogenMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CryogenMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Cryogen)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("CryogenMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryogenMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Cryogen)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("CryogenMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/CryogenTrophy.cs b/Items/Placeables/CryogenTrophy.cs index 8767e31a60..96ba4c773c 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; - } - } +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 diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index d285852434..eef1104b92 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CryonicBrick : 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("CryonicBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "CryonicOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryonicBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryonicBrick : 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("CryonicBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "CryonicOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryonicBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CryonicBrickWall.cs b/Items/Placeables/CryonicBrickWall.cs index efae140a94..6b452b5d2d 100644 --- a/Items/Placeables/CryonicBrickWall.cs +++ b/Items/Placeables/CryonicBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CryonicBrickWall : 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("CryonicBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryonicBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryonicBrickWall : 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("CryonicBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryonicBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/CryonicOre.cs b/Items/Placeables/CryonicOre.cs index cfd1faf726..3395454e7e 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 = 5750; - item.rare = 5; - } - } +using System; +using 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 = 5750; + item.rare = 5; + } + } } \ No newline at end of file diff --git a/Items/Placeables/DesertScourgeMusicbox.cs b/Items/Placeables/DesertScourgeMusicbox.cs index 9646203fdd..5c36469fb5 100644 --- a/Items/Placeables/DesertScourgeMusicbox.cs +++ b/Items/Placeables/DesertScourgeMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class DesertScourgeMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Desert Scourge)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("DesertScourgeMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DesertScourgeMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Desert Scourge)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("DesertScourgeMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/DesertScourgeTrophy.cs b/Items/Placeables/DesertScourgeTrophy.cs index 99b7468007..8f8853ed17 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; - } - } +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 diff --git a/Items/Placeables/DevourerofGodsTrophy.cs b/Items/Placeables/DevourerofGodsTrophy.cs index a4478e27f5..de30b2ef2f 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; - } - } +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 diff --git a/Items/Placeables/DoGMusicbox.cs b/Items/Placeables/DoGMusicbox.cs index 5545fb3d1f..b3f72594ae 100644 --- a/Items/Placeables/DoGMusicbox.cs +++ b/Items/Placeables/DoGMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class DoGMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (DoG Phase 1)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("DoGMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DoGMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (DoG Phase 1)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("DoGMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/DraedonsForge.cs b/Items/Placeables/DraedonsForge.cs index 8e0703d406..adf736c322 100644 --- a/Items/Placeables/DraedonsForge.cs +++ b/Items/Placeables/DraedonsForge.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.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"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - - 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(); - } - } +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"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + + 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 diff --git a/Items/Placeables/ExodiumClusterOre.cs b/Items/Placeables/ExodiumClusterOre.cs index 36dee45430..354601f42b 100644 --- a/Items/Placeables/ExodiumClusterOre.cs +++ b/Items/Placeables/ExodiumClusterOre.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.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 = 5000; - item.rare = 3; - } - } +using System; +using 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 = 5000; + item.rare = 3; + } + } } \ No newline at end of file diff --git a/Items/Placeables/GreenBrickWallUnsafe.cs b/Items/Placeables/GreenBrickWallUnsafe.cs index c887306439..b3bcc73fa3 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; - } - } +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 diff --git a/Items/Placeables/GreenSlabWallUnsafe.cs b/Items/Placeables/GreenSlabWallUnsafe.cs index d2112e0103..5b41b65cc5 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; - } - } +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 diff --git a/Items/Placeables/GreenTiledWallUnsafe.cs b/Items/Placeables/GreenTiledWallUnsafe.cs index e516f3b82f..abf919f75d 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; - } - } +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 diff --git a/Items/Placeables/HardenedAstralSand.cs b/Items/Placeables/HardenedAstralSand.cs index 69d7158538..bb50c1d436 100644 --- a/Items/Placeables/HardenedAstralSand.cs +++ b/Items/Placeables/HardenedAstralSand.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("HardenedAstralSandWall"), 4); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/HardenedAstralSandWall.cs b/Items/Placeables/HardenedAstralSandWall.cs index e64c7136a6..f3b78dfba6 100644 --- a/Items/Placeables/HardenedAstralSandWall.cs +++ b/Items/Placeables/HardenedAstralSandWall.cs @@ -28,5 +28,15 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 999; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(mod.ItemType("HardenedAstralSand")); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + base.AddRecipes(); + } } } diff --git a/Items/Placeables/HigherAbyssMusicbox.cs b/Items/Placeables/HigherAbyssMusicbox.cs index 7cc79d578f..4b7990a291 100644 --- a/Items/Placeables/HigherAbyssMusicbox.cs +++ b/Items/Placeables/HigherAbyssMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class HigherAbyssMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Higher Abyss)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("HigherAbyssMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class HigherAbyssMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Higher Abyss)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("HigherAbyssMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/HiveMindMusicbox.cs b/Items/Placeables/HiveMindMusicbox.cs index 582a02ca3e..267ff9d289 100644 --- a/Items/Placeables/HiveMindMusicbox.cs +++ b/Items/Placeables/HiveMindMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class HiveMindMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Hive Mind)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("HiveMindMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class HiveMindMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Hive Mind)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("HiveMindMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/HiveMindTrophy.cs b/Items/Placeables/HiveMindTrophy.cs index 5ea0a5c47f..1fb42b7491 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; - } - } +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 diff --git a/Items/Placeables/LeviathanTrophy.cs b/Items/Placeables/LeviathanTrophy.cs index 73b9bfd319..cb2ef99dee 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; - } - } +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 diff --git a/Items/Placeables/LockedAshenChest.cs b/Items/Placeables/LockedAshenChest.cs index 3d96a7841b..8152f66030 100644 --- a/Items/Placeables/LockedAshenChest.cs +++ b/Items/Placeables/LockedAshenChest.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class LockedAshenChest : 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("AshenChestLocked"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.AddIngredient(null, "AshenKey", 1); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class LockedAshenChest : 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("AshenChestLocked"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.AddIngredient(null, "AshenKey", 1); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "AshenAltar"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index e9b23999e5..ca56f6a568 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PerennialBrick : 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("PerennialBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "PerennialOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PerennialBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerennialBrick : 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("PerennialBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "PerennialOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PerennialBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/PerennialBrickWall.cs b/Items/Placeables/PerennialBrickWall.cs index c3e17dcf02..626b2d2360 100644 --- a/Items/Placeables/PerennialBrickWall.cs +++ b/Items/Placeables/PerennialBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PerennialBrickWall : 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("PerennialBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PerennialBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerennialBrickWall : 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("PerennialBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PerennialBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/PerennialOre.cs b/Items/Placeables/PerennialOre.cs index dd4b4c2719..c5045fa61d 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 = 6750; - item.rare = 6; - } - } +using System; +using 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 = 6750; + item.rare = 6; + } + } } \ No newline at end of file diff --git a/Items/Placeables/PerennialOre.png b/Items/Placeables/PerennialOre.png index 0fbaada45c..fe388d523d 100644 Binary files a/Items/Placeables/PerennialOre.png and b/Items/Placeables/PerennialOre.png differ diff --git a/Items/Placeables/PerforatorMusicbox.cs b/Items/Placeables/PerforatorMusicbox.cs index 799edbf6ce..ad7df8a50f 100644 --- a/Items/Placeables/PerforatorMusicbox.cs +++ b/Items/Placeables/PerforatorMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PerforatorMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Perforator)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("PerforatorMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerforatorMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Perforator)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("PerforatorMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/PerforatorTrophy.cs b/Items/Placeables/PerforatorTrophy.cs index 1c85e24554..6cb365a6fc 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; - } - } +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 diff --git a/Items/Placeables/PinkBrickWallUnsafe.cs b/Items/Placeables/PinkBrickWallUnsafe.cs index f57f86effb..520430739e 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; - } - } +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 diff --git a/Items/Placeables/PinkSlabWallUnsafe.cs b/Items/Placeables/PinkSlabWallUnsafe.cs index f669165321..d495877511 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; - } - } +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 diff --git a/Items/Placeables/PinkTiledWallUnsafe.cs b/Items/Placeables/PinkTiledWallUnsafe.cs index 15ad6a5c90..71c4e1d686 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; - } - } +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 diff --git a/Items/Placeables/PlaguebringerGoliathTrophy.cs b/Items/Placeables/PlaguebringerGoliathTrophy.cs index eec794633a..da9e3d9aa2 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; - } - } +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 diff --git a/Items/Placeables/PlaguebringerMusicbox.cs b/Items/Placeables/PlaguebringerMusicbox.cs index a265c224d5..5b4a378937 100644 --- a/Items/Placeables/PlaguebringerMusicbox.cs +++ b/Items/Placeables/PlaguebringerMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PlaguebringerMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Plaguebringer Goliath)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("PlaguebringerMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PlaguebringerMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Plaguebringer Goliath)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("PlaguebringerMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs index 4692929ad7..b1fdfd0a72 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; - } - } +using System; +using 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 diff --git a/Items/Placeables/PolterghastMusicbox.cs b/Items/Placeables/PolterghastMusicbox.cs index 06236fbf58..4b98c2dd17 100644 --- a/Items/Placeables/PolterghastMusicbox.cs +++ b/Items/Placeables/PolterghastMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PolterghastMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Polterghast)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("PolterghastMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PolterghastMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Polterghast)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("PolterghastMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/PolterghastTrophy.cs b/Items/Placeables/PolterghastTrophy.cs index 4dc9d7bcdc..3d2fda545d 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; - } - } +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 diff --git a/Items/Placeables/ProfanedBath.cs b/Items/Placeables/ProfanedBath.cs index 70da3e716c..20eeabb893 100644 --- a/Items/Placeables/ProfanedBath.cs +++ b/Items/Placeables/ProfanedBath.cs @@ -1,35 +1,35 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("ProfanedBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 14); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("ProfanedBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 14); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedBed.cs b/Items/Placeables/ProfanedBed.cs index e09716241a..22cdb8978b 100644 --- a/Items/Placeables/ProfanedBed.cs +++ b/Items/Placeables/ProfanedBed.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("ProfanedBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("ProfanedBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedBench.cs b/Items/Placeables/ProfanedBench.cs index d32f3ccb26..089fe74a48 100644 --- a/Items/Placeables/ProfanedBench.cs +++ b/Items/Placeables/ProfanedBench.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedBench: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedBench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedBench: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedBench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedBookcase.cs b/Items/Placeables/ProfanedBookcase.cs index f3481c3103..36feec0c31 100644 --- a/Items/Placeables/ProfanedBookcase.cs +++ b/Items/Placeables/ProfanedBookcase.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("ProfanedBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("ProfanedBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedCandelabra.cs b/Items/Placeables/ProfanedCandelabra.cs index 565b9084ba..9b01a897d7 100644 --- a/Items/Placeables/ProfanedCandelabra.cs +++ b/Items/Placeables/ProfanedCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedCandelabra: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 5); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedCandle.cs b/Items/Placeables/ProfanedCandle.cs index a9be8b24d1..b1c1a9b0c6 100644 --- a/Items/Placeables/ProfanedCandle.cs +++ b/Items/Placeables/ProfanedCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedCandle : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedCandle : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 4); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedChair.cs b/Items/Placeables/ProfanedChair.cs index 9d62af6076..8d996353a4 100644 --- a/Items/Placeables/ProfanedChair.cs +++ b/Items/Placeables/ProfanedChair.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("ProfanedChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 4); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("ProfanedChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 4); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedChandelier.cs b/Items/Placeables/ProfanedChandelier.cs index 3220ebce57..7ac0a4604c 100644 --- a/Items/Placeables/ProfanedChandelier.cs +++ b/Items/Placeables/ProfanedChandelier.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 4); + recipe.AddIngredient(ItemID.Torch, 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedChest.cs b/Items/Placeables/ProfanedChest.cs index 776a59a598..a2833a014b 100644 --- a/Items/Placeables/ProfanedChest.cs +++ b/Items/Placeables/ProfanedChest.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedChest : 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("ProfanedChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedChest : 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("ProfanedChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedClock.cs b/Items/Placeables/ProfanedClock.cs index bb3b1de5e4..a3b3198350 100644 --- a/Items/Placeables/ProfanedClock.cs +++ b/Items/Placeables/ProfanedClock.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedClock: 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("ProfanedClock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(null, "ProfanedRock", 10); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedClock: 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("ProfanedClock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.AddIngredient(null, "ProfanedRock", 10); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedCrystal.cs b/Items/Placeables/ProfanedCrystal.cs index 22133f8926..d1d1a025b8 100644 --- a/Items/Placeables/ProfanedCrystal.cs +++ b/Items/Placeables/ProfanedCrystal.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 ProfanedCrystal : 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("ProfanedCrystal"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(ItemID.Glass, 10); - recipe.SetResult(this, 10); - recipe.AddTile(412); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedCrystalWall", 4); - recipe.SetResult(this); - recipe.AddTile(412); - 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 ProfanedCrystal : 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("ProfanedCrystal"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(ItemID.Glass, 10); + recipe.SetResult(this, 10); + recipe.AddTile(412); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedCrystalWall", 4); + recipe.SetResult(this); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ProfanedCrystalWall.cs b/Items/Placeables/ProfanedCrystalWall.cs index 457d830fd3..b0176ed9d3 100644 --- a/Items/Placeables/ProfanedCrystalWall.cs +++ b/Items/Placeables/ProfanedCrystalWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedCrystalWall : 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("ProfanedCrystalWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedCrystal"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedCrystalWall : 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("ProfanedCrystalWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedCrystal"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedDoor.cs b/Items/Placeables/ProfanedDoor.cs index bbf0cb3552..af27f92207 100644 --- a/Items/Placeables/ProfanedDoor.cs +++ b/Items/Placeables/ProfanedDoor.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("ProfanedDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 6); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("ProfanedDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 6); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedDresser.cs b/Items/Placeables/ProfanedDresser.cs index 109d2d9074..ed4f73c484 100644 --- a/Items/Placeables/ProfanedDresser.cs +++ b/Items/Placeables/ProfanedDresser.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedDresser: 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("ProfanedDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 16); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedDresser: 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("ProfanedDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 16); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedGuardianMusicbox.cs b/Items/Placeables/ProfanedGuardianMusicbox.cs index b8d7c3c665..c05106b392 100644 --- a/Items/Placeables/ProfanedGuardianMusicbox.cs +++ b/Items/Placeables/ProfanedGuardianMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedGuardianMusicbox: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Profaned Guardian)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("ProfanedGuardianMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedGuardianMusicbox: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Profaned Guardian)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("ProfanedGuardianMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedLamp.cs b/Items/Placeables/ProfanedLamp.cs index 545552b2ef..652355dd32 100644 --- a/Items/Placeables/ProfanedLamp.cs +++ b/Items/Placeables/ProfanedLamp.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(null, "ProfanedRock", 3); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(null, "ProfanedRock", 3); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedLantern.cs b/Items/Placeables/ProfanedLantern.cs index abbef8c8c3..63b8854559 100644 --- a/Items/Placeables/ProfanedLantern.cs +++ b/Items/Placeables/ProfanedLantern.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 6); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedPiano.cs b/Items/Placeables/ProfanedPiano.cs index faeb2aa195..ad37f5c92d 100644 --- a/Items/Placeables/ProfanedPiano.cs +++ b/Items/Placeables/ProfanedPiano.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedPiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "ProfanedRock", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedPiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "ProfanedRock", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedPlatform.cs b/Items/Placeables/ProfanedPlatform.cs index 9746e2f3c1..4a568a5dde 100644 --- a/Items/Placeables/ProfanedPlatform.cs +++ b/Items/Placeables/ProfanedPlatform.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedPlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("ProfanedPlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock"); - recipe.SetResult(this, 2); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedPlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("ProfanedPlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock"); + recipe.SetResult(this, 2); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedRock.cs b/Items/Placeables/ProfanedRock.cs index 5e38a41ac4..528998b727 100644 --- a/Items/Placeables/ProfanedRock.cs +++ b/Items/Placeables/ProfanedRock.cs @@ -1,48 +1,48 @@ -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 ProfanedRock : 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("ProfanedRock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRockWall", 4); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(ItemID.StoneBlock); - recipe.SetResult(this); - recipe.AddTile(412); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedPlatform", 2); - recipe.SetResult(this); - 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 ProfanedRock : 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("ProfanedRock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRockWall", 4); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(ItemID.StoneBlock); + recipe.SetResult(this); + recipe.AddTile(412); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedPlatform", 2); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ProfanedRockWall.cs b/Items/Placeables/ProfanedRockWall.cs index 8827bbecfd..59654b303f 100644 --- a/Items/Placeables/ProfanedRockWall.cs +++ b/Items/Placeables/ProfanedRockWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedRockWall : 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("ProfanedRockWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedRockWall : 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("ProfanedRockWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedSink.cs b/Items/Placeables/ProfanedSink.cs index 8d74fee2f6..c24123fb6b 100644 --- a/Items/Placeables/ProfanedSink.cs +++ b/Items/Placeables/ProfanedSink.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedSink : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedSink : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 6); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedSlab.cs b/Items/Placeables/ProfanedSlab.cs index 233d690c0b..901dd34775 100644 --- a/Items/Placeables/ProfanedSlab.cs +++ b/Items/Placeables/ProfanedSlab.cs @@ -1,43 +1,43 @@ -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 ProfanedSlab : 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("ProfanedSlab"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 5); - recipe.SetResult(this, 5); - recipe.AddTile(412); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedSlabWall", 4); - recipe.SetResult(this); - recipe.AddTile(412); - 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 ProfanedSlab : 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("ProfanedSlab"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 5); + recipe.SetResult(this, 5); + recipe.AddTile(412); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedSlabWall", 4); + recipe.SetResult(this); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ProfanedSlabWall.cs b/Items/Placeables/ProfanedSlabWall.cs index 15f52460fb..54b368ead0 100644 --- a/Items/Placeables/ProfanedSlabWall.cs +++ b/Items/Placeables/ProfanedSlabWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedSlabWall : 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("ProfanedSlabWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedSlab"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedSlabWall : 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("ProfanedSlabWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedSlab"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedTable.cs b/Items/Placeables/ProfanedTable.cs index 0a0236481b..7ca12ba17b 100644 --- a/Items/Placeables/ProfanedTable.cs +++ b/Items/Placeables/ProfanedTable.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedTable: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("ProfanedTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 8); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedTable: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("ProfanedTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 8); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProfanedWorkbench.cs b/Items/Placeables/ProfanedWorkbench.cs index ec1e31b8cb..3773f1ac39 100644 --- a/Items/Placeables/ProfanedWorkbench.cs +++ b/Items/Placeables/ProfanedWorkbench.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProfanedWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("ProfanedWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 10); - recipe.SetResult(this, 1); - recipe.AddTile(412); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProfanedWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("ProfanedWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 10); + recipe.SetResult(this, 1); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProvidenceMusicbox.cs b/Items/Placeables/ProvidenceMusicbox.cs index c014dc0271..745722c3f0 100644 --- a/Items/Placeables/ProvidenceMusicbox.cs +++ b/Items/Placeables/ProvidenceMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProvidenceMusicbox: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Providence)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("ProvidenceMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProvidenceMusicbox: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Providence)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("ProvidenceMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/ProvidenceTrophy.cs b/Items/Placeables/ProvidenceTrophy.cs index ebf20e157f..1bf2c04df9 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; - } - } +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 diff --git a/Items/Placeables/RavagerMusicbox.cs b/Items/Placeables/RavagerMusicbox.cs index 927cd3366a..0b163cd7d0 100644 --- a/Items/Placeables/RavagerMusicbox.cs +++ b/Items/Placeables/RavagerMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class RavagerMusicbox: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Ravager)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("RavagerMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class RavagerMusicbox: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Ravager)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("RavagerMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/RavagerTrophy.cs b/Items/Placeables/RavagerTrophy.cs index 9bd6b512c6..cdfcb7c6da 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; - } - } +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 diff --git a/Items/Placeables/RunicProfanedBrick.cs b/Items/Placeables/RunicProfanedBrick.cs index f123690532..1dc01bd1e1 100644 --- a/Items/Placeables/RunicProfanedBrick.cs +++ b/Items/Placeables/RunicProfanedBrick.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 RunicProfanedBrick : 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("RunicProfanedBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedRock", 4); - recipe.AddIngredient(null, "ProfanedCrystal"); - recipe.SetResult(this, 5); - recipe.AddTile(412); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RunicProfanedBrickWall", 4); - recipe.SetResult(this); - recipe.AddTile(412); - 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 RunicProfanedBrick : 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("RunicProfanedBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedRock", 4); + recipe.AddIngredient(null, "ProfanedCrystal"); + recipe.SetResult(this, 5); + recipe.AddTile(412); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RunicProfanedBrickWall", 4); + recipe.SetResult(this); + recipe.AddTile(412); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/RunicProfanedBrickWall.cs b/Items/Placeables/RunicProfanedBrickWall.cs index d21674dd3a..670d8dc2e0 100644 --- a/Items/Placeables/RunicProfanedBrickWall.cs +++ b/Items/Placeables/RunicProfanedBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class RunicProfanedBrickWall : 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("RunicProfanedBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RunicProfanedBrick"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class RunicProfanedBrickWall : 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("RunicProfanedBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RunicProfanedBrick"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SignusMusicbox.cs b/Items/Placeables/SignusMusicbox.cs index c6808ee467..698d4afd01 100644 --- a/Items/Placeables/SignusMusicbox.cs +++ b/Items/Placeables/SignusMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SignusMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Signus)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("SignusMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SignusMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Signus)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("SignusMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/SignusTrophy.cs b/Items/Placeables/SignusTrophy.cs index 3a5a2f992e..cffd2f6d53 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; - } - } +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 diff --git a/Items/Placeables/SlimeGodMusicbox.cs b/Items/Placeables/SlimeGodMusicbox.cs index 1f50752db6..14d30f905e 100644 --- a/Items/Placeables/SlimeGodMusicbox.cs +++ b/Items/Placeables/SlimeGodMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SlimeGodMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Slime God)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("SlimeGodMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SlimeGodMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Slime God)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("SlimeGodMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/SlimeGodTrophy.cs b/Items/Placeables/SlimeGodTrophy.cs index 455e6f833b..6a8237c7d9 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; - } - } +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 diff --git a/Items/Placeables/SmoothAbyssGravel.cs b/Items/Placeables/SmoothAbyssGravel.cs index dcc04bb958..f7c3ff1847 100644 --- a/Items/Placeables/SmoothAbyssGravel.cs +++ b/Items/Placeables/SmoothAbyssGravel.cs @@ -1,47 +1,47 @@ -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 SmoothAbyssGravel : 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("SmoothAbyssGravel"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AbyssGravel"); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravelWall", 4); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravelPlatform", 2); - recipe.SetResult(this); - 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 SmoothAbyssGravel : 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("SmoothAbyssGravel"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AbyssGravel"); + recipe.SetResult(this, 1); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravelWall", 4); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravelPlatform", 2); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/SmoothAbyssGravelPlatform.cs b/Items/Placeables/SmoothAbyssGravelPlatform.cs index 38a0ac885f..ab9e8a2b4d 100644 --- a/Items/Placeables/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/SmoothAbyssGravelPlatform.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SmoothAbyssGravelPlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("SmoothAbyssGravelPlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel"); - recipe.SetResult(this, 2); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SmoothAbyssGravelPlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("SmoothAbyssGravelPlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel"); + recipe.SetResult(this, 2); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothAbyssGravelWall.cs b/Items/Placeables/SmoothAbyssGravelWall.cs index 0906f52be5..2b826167f8 100644 --- a/Items/Placeables/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/SmoothAbyssGravelWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SmoothAbyssGravelWall : 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("SmoothAbyssGravelWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothAbyssGravel"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SmoothAbyssGravelWall : 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("SmoothAbyssGravelWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothAbyssGravel"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothBrimstoneSlag.cs b/Items/Placeables/SmoothBrimstoneSlag.cs index 150dbdbd10..af04d79ed7 100644 --- a/Items/Placeables/SmoothBrimstoneSlag.cs +++ b/Items/Placeables/SmoothBrimstoneSlag.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.Placeables -{ - public class SmoothBrimstoneSlag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Smooth Brimstone Slag"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("SmoothBrimstoneSlag"); - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag"); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlagWall", 4); - recipe.SetResult(this); - recipe.AddTile(18); - 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.Placeables +{ + public class SmoothBrimstoneSlag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Smooth Brimstone Slag"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("SmoothBrimstoneSlag"); + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag"); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlagWall", 4); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothBrimstoneSlagWall.cs b/Items/Placeables/SmoothBrimstoneSlagWall.cs index 38fa36044e..c9134d5679 100644 --- a/Items/Placeables/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/SmoothBrimstoneSlagWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SmoothBrimstoneSlagWall : 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("SmoothBrimstoneSlagWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag"); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SmoothBrimstoneSlagWall : 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("SmoothBrimstoneSlagWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothBrimstoneSlag"); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothVoidstone.cs b/Items/Placeables/SmoothVoidstone.cs index 1a35c2bdc3..d8934df39f 100644 --- a/Items/Placeables/SmoothVoidstone.cs +++ b/Items/Placeables/SmoothVoidstone.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.Placeables -{ - public class SmoothVoidstone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Smooth Voidstone"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("SmoothVoidstone"); - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Voidstone"); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstoneWall", 4); - recipe.SetResult(this); - recipe.AddTile(18); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstonePlatform", 2); - 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.Placeables +{ + public class SmoothVoidstone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Smooth Voidstone"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("SmoothVoidstone"); + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Voidstone"); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstoneWall", 4); + recipe.SetResult(this); + recipe.AddTile(18); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstonePlatform", 2); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothVoidstonePlatform.cs b/Items/Placeables/SmoothVoidstonePlatform.cs index 624e8e2fb7..68ec11f14e 100644 --- a/Items/Placeables/SmoothVoidstonePlatform.cs +++ b/Items/Placeables/SmoothVoidstonePlatform.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SmoothVoidstonePlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("SmoothVoidstonePlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone"); - recipe.SetResult(this, 2); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SmoothVoidstonePlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("SmoothVoidstonePlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone"); + recipe.SetResult(this, 2); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/SmoothVoidstoneWall.cs b/Items/Placeables/SmoothVoidstoneWall.cs index 2a4249ffc3..1a9bd540e6 100644 --- a/Items/Placeables/SmoothVoidstoneWall.cs +++ b/Items/Placeables/SmoothVoidstoneWall.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SmoothVoidstoneWall : 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("SmoothVoidstoneWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone"); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SmoothVoidstoneWall : 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("SmoothVoidstoneWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone"); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StaticRefiner.cs b/Items/Placeables/StaticRefiner.cs index 10bd599c98..7cf0ba7c12 100644 --- a/Items/Placeables/StaticRefiner.cs +++ b/Items/Placeables/StaticRefiner.cs @@ -1,41 +1,41 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StaticRefiner : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StaticRefiner"); - } - - //The idea is that this would be a drop from slime god, like the solidifier is from king slime. - //If this idea is rejected, uncomment the code below, which makes this craftable with 25 purified gel - //and a solidifier. - - //public override void AddRecipes() - // { - // ModRecipe recipe = new ModRecipe(mod); - // recipe.AddIngredient(null, "PurifiedGel", 25); - // recipe.AddIngredient(ItemID.Solidifier); - // recipe.SetResult(this, 1); - // recipe.AddTile(TileID.Anvils); - // recipe.AddRecipe(); - // } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StaticRefiner : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StaticRefiner"); + } + + //The idea is that this would be a drop from slime god, like the solidifier is from king slime. + //If this idea is rejected, uncomment the code below, which makes this craftable with 25 purified gel + //and a solidifier. + + //public override void AddRecipes() + // { + // ModRecipe recipe = new ModRecipe(mod); + // recipe.AddIngredient(null, "PurifiedGel", 25); + // recipe.AddIngredient(ItemID.Solidifier); + // recipe.SetResult(this, 1); + // recipe.AddTile(TileID.Anvils); + // recipe.AddRecipe(); + // } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelBath.cs b/Items/Placeables/StatigelBath.cs index eb53120ee4..8f7e1d7b78 100644 --- a/Items/Placeables/StatigelBath.cs +++ b/Items/Placeables/StatigelBath.cs @@ -1,35 +1,35 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("StatigelBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("StatigelBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelBed.cs b/Items/Placeables/StatigelBed.cs index cbd3c481f0..1ba92c2365 100644 --- a/Items/Placeables/StatigelBed.cs +++ b/Items/Placeables/StatigelBed.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("StatigelBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("StatigelBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelBlock.cs b/Items/Placeables/StatigelBlock.cs index 60903d2d09..7567419bb9 100644 --- a/Items/Placeables/StatigelBlock.cs +++ b/Items/Placeables/StatigelBlock.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 StatigelBlock : 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("StatigelBlock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel"); - recipe.SetResult(this); - recipe.AddTile(null, "StaticRefiner"); - 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 StatigelBlock : 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("StatigelBlock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel"); + recipe.SetResult(this); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/StatigelBookcase.cs b/Items/Placeables/StatigelBookcase.cs index 76e569b2d9..1268dd0db2 100644 --- a/Items/Placeables/StatigelBookcase.cs +++ b/Items/Placeables/StatigelBookcase.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("StatigelBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("StatigelBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelCandelabra.cs b/Items/Placeables/StatigelCandelabra.cs index 0523db8212..12488239c8 100644 --- a/Items/Placeables/StatigelCandelabra.cs +++ b/Items/Placeables/StatigelCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelCandelabra: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 5); + recipe.AddIngredient(ItemID.Torch, 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelCandle.cs b/Items/Placeables/StatigelCandle.cs index 1695af3ad4..22efd99c69 100644 --- a/Items/Placeables/StatigelCandle.cs +++ b/Items/Placeables/StatigelCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelCandle: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelCandle: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 4); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelChair.cs b/Items/Placeables/StatigelChair.cs index e46fa1a9b4..57e5782757 100644 --- a/Items/Placeables/StatigelChair.cs +++ b/Items/Placeables/StatigelChair.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("StatigelChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("StatigelChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelChandelier.cs b/Items/Placeables/StatigelChandelier.cs index d2b262c8f4..e8aa50f8d7 100644 --- a/Items/Placeables/StatigelChandelier.cs +++ b/Items/Placeables/StatigelChandelier.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 4); + recipe.AddIngredient(ItemID.Torch, 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelChest.cs b/Items/Placeables/StatigelChest.cs index 44a1837a55..3c01f32dd4 100644 --- a/Items/Placeables/StatigelChest.cs +++ b/Items/Placeables/StatigelChest.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelChest : 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("StatigelChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelChest : 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("StatigelChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelClock.cs b/Items/Placeables/StatigelClock.cs index d06cf5ed78..8f7568cc3e 100644 --- a/Items/Placeables/StatigelClock.cs +++ b/Items/Placeables/StatigelClock.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelClock: 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("StatigelClock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(null, "StatigelBlock", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelClock: 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("StatigelClock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.AddIngredient(null, "StatigelBlock", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelDoor.cs b/Items/Placeables/StatigelDoor.cs index 5c4eed6458..d0cdcc2251 100644 --- a/Items/Placeables/StatigelDoor.cs +++ b/Items/Placeables/StatigelDoor.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("StatigelDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("StatigelDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelDresser.cs b/Items/Placeables/StatigelDresser.cs index 529983eeda..80c1b6eb37 100644 --- a/Items/Placeables/StatigelDresser.cs +++ b/Items/Placeables/StatigelDresser.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelDresser: 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("StatigelDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelDresser: 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("StatigelDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelLamp.cs b/Items/Placeables/StatigelLamp.cs index f679142660..6b61bafacb 100644 --- a/Items/Placeables/StatigelLamp.cs +++ b/Items/Placeables/StatigelLamp.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(null, "StatigelBlock", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(null, "StatigelBlock", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelLantern.cs b/Items/Placeables/StatigelLantern.cs index 4c76e691b2..6bd1759458 100644 --- a/Items/Placeables/StatigelLantern.cs +++ b/Items/Placeables/StatigelLantern.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 6); + recipe.AddIngredient(ItemID.Torch); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelPiano.cs b/Items/Placeables/StatigelPiano.cs index 71f5de701e..6a9da757c0 100644 --- a/Items/Placeables/StatigelPiano.cs +++ b/Items/Placeables/StatigelPiano.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelPiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "StatigelBlock", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelPiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "StatigelBlock", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelPlatform.cs b/Items/Placeables/StatigelPlatform.cs index 9e82ff9b5c..c6324f5df9 100644 --- a/Items/Placeables/StatigelPlatform.cs +++ b/Items/Placeables/StatigelPlatform.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelPlatform : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - 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("StatigelPlatform"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock"); - recipe.SetResult(this, 2); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelPlatform : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + 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("StatigelPlatform"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock"); + recipe.SetResult(this, 2); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelSink.cs b/Items/Placeables/StatigelSink.cs index 2fa2571281..ae44023824 100644 --- a/Items/Placeables/StatigelSink.cs +++ b/Items/Placeables/StatigelSink.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelSink: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelSink: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 6); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelSofa.cs b/Items/Placeables/StatigelSofa.cs index 69e1702b07..aaced19503 100644 --- a/Items/Placeables/StatigelSofa.cs +++ b/Items/Placeables/StatigelSofa.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelSofa: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelSofa: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelTable.cs b/Items/Placeables/StatigelTable.cs index 6477d2da32..93b61bb47b 100644 --- a/Items/Placeables/StatigelTable.cs +++ b/Items/Placeables/StatigelTable.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelTable: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("StatigelTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelTable: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("StatigelTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelWall.cs b/Items/Placeables/StatigelWall.cs index 854790ef2e..444c67fa15 100644 --- a/Items/Placeables/StatigelWall.cs +++ b/Items/Placeables/StatigelWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelWall : 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("StatigelWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelWall : 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("StatigelWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StatigelWorkbench.cs b/Items/Placeables/StatigelWorkbench.cs index 75968c860c..9b694fd900 100644 --- a/Items/Placeables/StatigelWorkbench.cs +++ b/Items/Placeables/StatigelWorkbench.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StatigelWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("StatigelWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatigelBlock", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "StaticRefiner"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StatigelWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("StatigelWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatigelBlock", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "StaticRefiner"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/StormWeaverMusicbox.cs b/Items/Placeables/StormWeaverMusicbox.cs index 139baae14f..170b37abc2 100644 --- a/Items/Placeables/StormWeaverMusicbox.cs +++ b/Items/Placeables/StormWeaverMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class StormWeaverMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Storm Weaver)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("StormWeaverMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class StormWeaverMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Storm Weaver)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("StormWeaverMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/SulphurousMusicbox.cs b/Items/Placeables/SulphurousMusicbox.cs index a125ce8072..9e082589d0 100644 --- a/Items/Placeables/SulphurousMusicbox.cs +++ b/Items/Placeables/SulphurousMusicbox.cs @@ -1,28 +1,28 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SulphurousMusicbox : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Music Box (Sulphurous Sea)"); - } - - public override void SetDefaults() - { - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = mod.TileType("SulphurousMusicbox"); - item.width = 24; - item.height = 24; - item.rare = 4; - item.value = 100000; - item.accessory = true; - } - } +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SulphurousMusicbox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Music Box (Sulphurous Sea)"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.createTile = mod.TileType("SulphurousMusicbox"); + item.width = 24; + item.height = 24; + item.rare = 4; + item.value = 100000; + item.accessory = true; + } + } } \ No newline at end of file diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/SulphurousSand.cs index 08760e3e8d..3602b2f201 100644 --- a/Items/Placeables/SulphurousSand.cs +++ b/Items/Placeables/SulphurousSand.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 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; - item.value = 4000; - item.rare = 1; - } - } +using System; +using 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; + item.value = 4000; + item.rare = 1; + } + } } \ No newline at end of file diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs index 16a1a08c45..de9c40c62f 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 = 2750; - item.rare = 6; - } - } +using System; +using 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 = 2750; + item.rare = 6; + } + } } \ No newline at end of file diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index 6c2cf633a3..01e18e1a8d 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class UelibloomBrick : 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("UelibloomBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "UelibloomOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UelibloomBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class UelibloomBrick : 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("UelibloomBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "UelibloomOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UelibloomBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/UelibloomBrickWall.cs b/Items/Placeables/UelibloomBrickWall.cs index bcee9507f2..95fdb057d8 100644 --- a/Items/Placeables/UelibloomBrickWall.cs +++ b/Items/Placeables/UelibloomBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class UelibloomBrickWall : 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("UelibloomBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UelibloomBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class UelibloomBrickWall : 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("UelibloomBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UelibloomBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/UelibloomOre.cs b/Items/Placeables/UelibloomOre.cs index b8b39e5a1e..347a235535 100644 --- a/Items/Placeables/UelibloomOre.cs +++ b/Items/Placeables/UelibloomOre.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.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.value = 8750; - } - - 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); - } - } - } - } +using System; +using 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.value = 8750; + } + + 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 diff --git a/Items/Placeables/VoidBath.cs b/Items/Placeables/VoidBath.cs index 084377ebb8..98cf29523b 100644 --- a/Items/Placeables/VoidBath.cs +++ b/Items/Placeables/VoidBath.cs @@ -1,35 +1,35 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidBath : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("VoidBath"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 14); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidBath : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("VoidBath"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 14); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidBed.cs b/Items/Placeables/VoidBed.cs index 8c2ef7771a..b15236a053 100644 --- a/Items/Placeables/VoidBed.cs +++ b/Items/Placeables/VoidBed.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidBed : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - 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 = 2000; - item.createTile = mod.TileType("VoidBed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidBed : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + 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 = 2000; + item.createTile = mod.TileType("VoidBed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 15); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidBookcase.cs b/Items/Placeables/VoidBookcase.cs index 5b153f69ae..04934e06ed 100644 --- a/Items/Placeables/VoidBookcase.cs +++ b/Items/Placeables/VoidBookcase.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidBookcase : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - 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("VoidBookcase"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidBookcase : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + 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("VoidBookcase"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 20); + recipe.AddIngredient(ItemID.Book, 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidCandelabra.cs b/Items/Placeables/VoidCandelabra.cs index b8ed586751..947085d0d5 100644 --- a/Items/Placeables/VoidCandelabra.cs +++ b/Items/Placeables/VoidCandelabra.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidCandelabra: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidCandelabra"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 5); - recipe.AddIngredient(null, "Lumenite", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidCandelabra: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidCandelabra"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 5); + recipe.AddIngredient(null, "Lumenite", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidCandle.cs b/Items/Placeables/VoidCandle.cs index 55c9074950..cdcbee52eb 100644 --- a/Items/Placeables/VoidCandle.cs +++ b/Items/Placeables/VoidCandle.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidCandle: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidCandle"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 4); - recipe.AddIngredient(null, "Lumenite"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidCandle: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidCandle"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 4); + recipe.AddIngredient(null, "Lumenite"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidChair.cs b/Items/Placeables/VoidChair.cs index 1e0dc5d8e8..c49828b372 100644 --- a/Items/Placeables/VoidChair.cs +++ b/Items/Placeables/VoidChair.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidChair : ModItem - { - public override void SetStaticDefaults() - { - //Tooltip.SetDefault("This is a modded chair."); - } - - public override void SetDefaults() - { - item.width = 12; - 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 = 150; - item.createTile = mod.TileType("VoidChair"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 4); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidChair : ModItem + { + public override void SetStaticDefaults() + { + //Tooltip.SetDefault("This is a modded chair."); + } + + public override void SetDefaults() + { + item.width = 12; + 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 = 150; + item.createTile = mod.TileType("VoidChair"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 4); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidChandelier.cs b/Items/Placeables/VoidChandelier.cs index 6e3d7702bf..1b4b1c181c 100644 --- a/Items/Placeables/VoidChandelier.cs +++ b/Items/Placeables/VoidChandelier.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidChandelier: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidChandelier"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 4); - recipe.AddIngredient(null, "Lumenite", 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidChandelier: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidChandelier"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 4); + recipe.AddIngredient(null, "Lumenite", 4); + recipe.AddIngredient(ItemID.Chain); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidChest.cs b/Items/Placeables/VoidChest.cs index 64e9a58637..8990912eee 100644 --- a/Items/Placeables/VoidChest.cs +++ b/Items/Placeables/VoidChest.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidChest : 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("VoidChest"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidChest : 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("VoidChest"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 8); + recipe.AddIngredient(ItemID.IronBar, 2); + recipe.anyIronBar = true; + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidClock.cs b/Items/Placeables/VoidClock.cs index e493a40f92..7de7dd7345 100644 --- a/Items/Placeables/VoidClock.cs +++ b/Items/Placeables/VoidClock.cs @@ -1,39 +1,39 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidClock: 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("VoidClock"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(null, "SmoothVoidstone", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidClock: 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("VoidClock"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 3); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Glass, 6); + recipe.AddIngredient(null, "SmoothVoidstone", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidCondenser.cs b/Items/Placeables/VoidCondenser.cs index e0761e30e8..d717213aad 100644 --- a/Items/Placeables/VoidCondenser.cs +++ b/Items/Placeables/VoidCondenser.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidCondenser : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidCondenser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 25); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidCondenser : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidCondenser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 25); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidDoor.cs b/Items/Placeables/VoidDoor.cs index f21f410b0c..21cf4588c8 100644 --- a/Items/Placeables/VoidDoor.cs +++ b/Items/Placeables/VoidDoor.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidDoor : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("VoidDoorClosed"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 6); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidDoor : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("VoidDoorClosed"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 6); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidDresser.cs b/Items/Placeables/VoidDresser.cs index 93815717d7..4ceb5d2ac8 100644 --- a/Items/Placeables/VoidDresser.cs +++ b/Items/Placeables/VoidDresser.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidDresser: 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("VoidDresser"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 16); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidDresser: 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("VoidDresser"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 16); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidLamp.cs b/Items/Placeables/VoidLamp.cs index 8ca9696145..3c3ae98c34 100644 --- a/Items/Placeables/VoidLamp.cs +++ b/Items/Placeables/VoidLamp.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidLamp: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidLamp"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Lumenite"); - recipe.AddIngredient(null, "SmoothVoidstone", 3); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidLamp: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidLamp"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Lumenite"); + recipe.AddIngredient(null, "SmoothVoidstone", 3); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidLantern.cs b/Items/Placeables/VoidLantern.cs index e52b2d692f..90230b49f6 100644 --- a/Items/Placeables/VoidLantern.cs +++ b/Items/Placeables/VoidLantern.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidLantern: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidLantern"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 6); - recipe.AddIngredient(null, "Lumenite"); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidLantern: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidLantern"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 6); + recipe.AddIngredient(null, "Lumenite"); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidPiano.cs b/Items/Placeables/VoidPiano.cs index ab2628debd..eb380d5397 100644 --- a/Items/Placeables/VoidPiano.cs +++ b/Items/Placeables/VoidPiano.cs @@ -1,38 +1,38 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidPiano: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidPiano"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(null, "SmoothVoidstone", 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidPiano: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidPiano"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 4); + recipe.AddIngredient(null, "SmoothVoidstone", 15); + recipe.AddIngredient(ItemID.Book); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidSink.cs b/Items/Placeables/VoidSink.cs index eba71db8af..df96ce63bd 100644 --- a/Items/Placeables/VoidSink.cs +++ b/Items/Placeables/VoidSink.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidSink: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidSink"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidSink: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidSink"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 6); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidSofa.cs b/Items/Placeables/VoidSofa.cs index fd4c5c62be..e821401cbb 100644 --- a/Items/Placeables/VoidSofa.cs +++ b/Items/Placeables/VoidSofa.cs @@ -1,37 +1,37 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidSofa: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidSofa"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidSofa: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidSofa"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 5); + recipe.AddIngredient(ItemID.Silk, 2); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidTable.cs b/Items/Placeables/VoidTable.cs index c1f714ae62..7fd507f9a7 100644 --- a/Items/Placeables/VoidTable.cs +++ b/Items/Placeables/VoidTable.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidTable: ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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("VoidTable"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 8); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidTable: ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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("VoidTable"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 8); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/VoidWorkbench.cs b/Items/Placeables/VoidWorkbench.cs index 3b35a7cb76..109f310708 100644 --- a/Items/Placeables/VoidWorkbench.cs +++ b/Items/Placeables/VoidWorkbench.cs @@ -1,36 +1,36 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidWorkbench : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 150; - item.createTile = mod.TileType("VoidWorkbench"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone", 10); - recipe.SetResult(this, 1); - recipe.AddTile(null, "VoidCondenser"); - recipe.AddRecipe(); - } - } +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidWorkbench : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 14; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 150; + item.createTile = mod.TileType("VoidWorkbench"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone", 10); + recipe.SetResult(this, 1); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs index 5f8ac6ab67..acf963bcc4 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/VoidstoneSlab.cs b/Items/Placeables/VoidstoneSlab.cs index f4fe4bbf32..7c88f7763e 100644 --- a/Items/Placeables/VoidstoneSlab.cs +++ b/Items/Placeables/VoidstoneSlab.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 VoidstoneSlab : 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("VoidstoneSlab"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothVoidstone"); - recipe.SetResult(this); - recipe.AddTile(null, "VoidCondenser"); - 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 VoidstoneSlab : 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("VoidstoneSlab"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SmoothVoidstone"); + recipe.SetResult(this); + recipe.AddTile(null, "VoidCondenser"); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/VoidstoneWall.cs b/Items/Placeables/VoidstoneWall.cs index fa960f8cdc..e8439a0044 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(); - } - } +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 diff --git a/Items/Placeables/WeaverTrophy.cs b/Items/Placeables/WeaverTrophy.cs index 9f8258be65..6125a8bd90 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; - } - } +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 diff --git a/Items/Placeables/YharonTrophy.cs b/Items/Placeables/YharonTrophy.cs index 9b9b0afe7f..135f8ad93d 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; - } - } +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 diff --git a/Items/PlaguebringerGoliath/Abomination.cs b/Items/PlaguebringerGoliath/Abomination.cs index 099785203c..8e0d8652a9 100644 --- a/Items/PlaguebringerGoliath/Abomination.cs +++ b/Items/PlaguebringerGoliath/Abomination.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.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"); - } - - 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.AddIngredient(ItemID.Stinger, 2); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddIngredient(ItemID.LeadBar, 5); - recipe.AddIngredient(ItemID.Stinger, 2); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.AddTile(TileID.MythrilAnvil); - 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.PlaguebringerGoliath +{ + public class Abomination : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abombination"); + Tooltip.SetDefault("Calls in the airborne jungle abomination"); + } + + 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.AddIngredient(ItemID.Stinger, 2); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddIngredient(ItemID.LeadBar, 5); + 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 diff --git a/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs index 4021a30f2a..58579f76a6 100644 --- a/Items/PlaguebringerGoliath/BloomStone.cs +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -1,178 +1,178 @@ -using System; -using 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 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 and crit chance is increased by 2%\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 = 500000; - 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.25f, 0.4f, 0.2f); - player.meleeCrit += 2; - player.meleeDamage += 0.02f; - player.magicCrit += 2; - player.magicDamage += 0.02f; - player.rangedCrit += 2; - player.rangedDamage += 0.02f; - player.thrownCrit += 2; - player.thrownDamage += 0.02f; - player.minionDamage += 0.02f; - 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; + +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 and crit chance is increased by 2%\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 = 500000; + 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.25f, 0.4f, 0.2f); + player.meleeCrit += 2; + player.meleeDamage += 0.02f; + player.magicCrit += 2; + player.magicDamage += 0.02f; + player.rangedCrit += 2; + player.rangedDamage += 0.02f; + player.thrownCrit += 2; + player.thrownDamage += 0.02f; + player.minionDamage += 0.02f; + 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 5bb9a71460..f2cb96cb86 100644 --- a/Items/PlaguebringerGoliath/PlagueCellCluster.cs +++ b/Items/PlaguebringerGoliath/PlagueCellCluster.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 3000; - item.rare = 8; - } +using System; +using 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 = 3000; + item.rare = 8; + } }} \ No newline at end of file diff --git a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs index e122f82af4..101c7e6038 100644 --- a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs +++ b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs @@ -1,74 +1,74 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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")); - } - player.QuickSpawnItem(mod.ItemType("ToxicHeart")); - player.QuickSpawnItem(mod.ItemType("PlagueCellCluster"), Main.rand.Next(13, 18)); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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")); + } + player.QuickSpawnItem(mod.ItemType("ToxicHeart")); + player.QuickSpawnItem(mod.ItemType("PlagueCellCluster"), Main.rand.Next(13, 18)); + } + } } \ No newline at end of file diff --git a/Items/PlaguebringerGoliath/ToxicHeart.cs b/Items/PlaguebringerGoliath/ToxicHeart.cs index 72d42a9859..9d28489c69 100644 --- a/Items/PlaguebringerGoliath/ToxicHeart.cs +++ b/Items/PlaguebringerGoliath/ToxicHeart.cs @@ -1,75 +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.PlaguebringerGoliath { -public class ToxicHeart : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Heart"); - Tooltip.SetDefault("Blinds and weakens the player if above 85% life\n" + - "Summons a damaging plague aura around the player to destroy nearby enemies"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = 500000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.statLife >= (player.statLifeMax * 0.85f)) - { - player.blind = true; - player.statDefense -= 5; - player.moveSpeed -= 0.05f; - } - 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("Blinds and weakens the player if above 85% life\n" + + "Summons a damaging plague aura around the player to destroy nearby enemies"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = 500000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.statLife >= (player.statLifeMax * 0.85f)) + { + player.blind = true; + player.statDefense -= 5; + player.moveSpeed -= 0.05f; + } + 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 diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs index b2be82daca..a762d74a5c 100644 --- a/Items/Polterghast/Affliction.cs +++ b/Items/Polterghast/Affliction.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.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 = 500000; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.affliction = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 2800f) - { - Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); - } - } - } - } - } +using System; +using 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 = 500000; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.affliction = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + float arg = player.position.X - Main.player[myPlayer].position.X; + float num3 = player.position.Y - Main.player[myPlayer].position.Y; + if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 2800f) + { + Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); + } + } + } + } + } } \ No newline at end of file diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs index 0d7b3de22f..81971c7a7c 100644 --- a/Items/Polterghast/NecroplasmicBeacon.cs +++ b/Items/Polterghast/NecroplasmicBeacon.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.Items.Polterghast -{ - public class NecroplasmicBeacon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necroplasmic Beacon"); - Tooltip.SetDefault("It's spooky\nNot consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override bool CanUseItem(Player player) - { - return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")); - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Polterghast +{ + public class NecroplasmicBeacon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Necroplasmic Beacon"); + Tooltip.SetDefault("It's spooky\nNot consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override bool CanUseItem(Player player) + { + return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")); + } + + 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 diff --git a/Items/Polterghast/PolterghastBag.cs b/Items/Polterghast/PolterghastBag.cs index c6808158b2..eeab4b1c32 100644 --- a/Items/Polterghast/PolterghastBag.cs +++ b/Items/Polterghast/PolterghastBag.cs @@ -1,70 +1,70 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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")); - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("Ectoheart")); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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")); + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("Ectoheart")); + } + } + } } \ No newline at end of file diff --git a/Items/Polterghast/RuinousSoul.cs b/Items/Polterghast/RuinousSoul.cs index da095c9165..0fc92dd6d1 100644 --- a/Items/Polterghast/RuinousSoul.cs +++ b/Items/Polterghast/RuinousSoul.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.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 = 100000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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 = 100000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } } \ No newline at end of file diff --git a/Items/PotionofOmniscience.cs b/Items/PotionofOmniscience.cs index bf9d4b3111..f0a532767a 100644 --- a/Items/PotionofOmniscience.cs +++ b/Items/PotionofOmniscience.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class PotionofOmniscience : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potion of Omniscience"); - Tooltip.SetDefault("Gives creature, danger, and treasure detection"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Omniscience"); - item.buffTime = 18000; - item.value = 10000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HunterPotion); - recipe.AddIngredient(ItemID.SpelunkerPotion); - recipe.AddIngredient(ItemID.TrapsightPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class PotionofOmniscience : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potion of Omniscience"); + Tooltip.SetDefault("Gives creature, danger, and treasure detection"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Omniscience"); + item.buffTime = 18000; + item.value = 10000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HunterPotion); + recipe.AddIngredient(ItemID.SpelunkerPotion); + recipe.AddIngredient(ItemID.TrapsightPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/ProfanedGuardian/ProfanedShard.cs b/Items/ProfanedGuardian/ProfanedShard.cs index d5bc3b6f97..a18ad53306 100644 --- a/Items/ProfanedGuardian/ProfanedShard.cs +++ b/Items/ProfanedGuardian/ProfanedShard.cs @@ -1,65 +1,65 @@ -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\nCan 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; - } - - 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 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")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss2")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss3")); - 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(); - } - } +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\nCan 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; + } + + 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 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")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss2")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss3")); + 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 diff --git a/Items/Providence/DivineGeode.cs b/Items/Providence/DivineGeode.cs index 4e42fb85ce..a35c615220 100644 --- a/Items/Providence/DivineGeode.cs +++ b/Items/Providence/DivineGeode.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.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 = 9; - item.value = 120000; - } - - 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 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); - } - } +using System; +using 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 = 9; + item.value = 120000; + } + + 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 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 diff --git a/Items/Providence/ElysianAegis.cs b/Items/Providence/ElysianAegis.cs index f85390d46a..d628bae153 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 = 10000000; - 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 += 3; - player.statLifeMax2 += 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.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 = 10000000; + 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 += 3; + player.statLifeMax2 += 40; + } + } } \ No newline at end of file diff --git a/Items/Providence/ElysianWings.cs b/Items/Providence/ElysianWings.cs index 2a78eef784..7f8a5d9dff 100644 --- a/Items/Providence/ElysianWings.cs +++ b/Items/Providence/ElysianWings.cs @@ -1,59 +1,59 @@ -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("Excellent acceleration: 2.5\nExcellent flight time: 220\nTemporary immunity to lava"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = 10000000; - item.expert = true; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.moveSpeed += 0.4f; - player.lavaMax += 920; - player.wingTimeMax = 220; - 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 = 11f; - acceleration *= 2.5f; - } - } +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("Excellent acceleration: 2.5\nExcellent flight time: 220\nTemporary immunity to lava"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = 10000000; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.moveSpeed += 0.4f; + player.lavaMax += 920; + player.wingTimeMax = 220; + 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 = 11f; + acceleration *= 2.5f; + } + } } \ No newline at end of file diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs index 906517dfa2..149696c109 100644 --- a/Items/Providence/ProfanedCore.cs +++ b/Items/Providence/ProfanedCore.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.Providence -{ - public class ProfanedCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\nCan 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; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); - } - - 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 ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Providence +{ + public class ProfanedCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\nCan 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; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + } + + 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 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 diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs index e1a98c12cd..f6dce68ced 100644 --- a/Items/Providence/ProfanedCoreUnlimited.cs +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items.Providence -{ - public class ProfanedCoreUnlimited : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\nCan only be used during daytime\nNot 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; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); - } - - 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 ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedCore"); - recipe.AddIngredient(null, "DivineGeode", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Providence +{ + public class ProfanedCoreUnlimited : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\nCan only be used during daytime\nNot 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; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + } + + 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 ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 200); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedCore"); + recipe.AddIngredient(null, "DivineGeode", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Providence/ProvidenceBag.cs b/Items/Providence/ProvidenceBag.cs index 0872a4f02e..afe0c299f0 100644 --- a/Items/Providence/ProvidenceBag.cs +++ b/Items/Providence/ProvidenceBag.cs @@ -1,67 +1,67 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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(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")); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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(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 diff --git a/Items/Providence/UnholyEssence.cs b/Items/Providence/UnholyEssence.cs index 10846f9567..385c10aea5 100644 --- a/Items/Providence/UnholyEssence.cs +++ b/Items/Providence/UnholyEssence.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 -{ - 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 = 9; - item.value = 58750; - } - - 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 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); - } - } +using System; +using 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 = 9; + item.value = 58750; + } + + 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 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 diff --git a/Items/PurifiedJam.cs b/Items/PurifiedJam.cs index 149b5b1160..75e2e10f6b 100644 --- a/Items/PurifiedJam.cs +++ b/Items/PurifiedJam.cs @@ -1,45 +1,45 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class PurifiedJam : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purified Jam"); - Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + - "Causes potion sickness when consumed\n" + - "Cannot be consumed while potion sickness is active\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 5; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = 2000; - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool UseItem(Player player) - { - player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); - return true; - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class PurifiedJam : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purified Jam"); + Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + + "Causes potion sickness when consumed\n" + + "Cannot be consumed while potion sickness is active\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 5; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = 2000; + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool UseItem(Player player) + { + player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); + return true; + } + } } \ No newline at end of file diff --git a/Items/RedLightningContainer.cs b/Items/RedLightningContainer.cs index 9aa4bbbbd3..feb93a6eb6 100644 --- a/Items/RedLightningContainer.cs +++ b/Items/RedLightningContainer.cs @@ -1,66 +1,66 @@ -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 20% (80% 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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - } - } +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 20% (80% 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/ReefclawHamaxe.cs b/Items/ReefclawHamaxe.cs index 90672e370b..ebe1bed35f 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 = 19; - item.useAnimation = 19; - item.useTurn = true; - item.axe = 13; - item.hammer = 50; - item.useStyle = 1; - item.knockBack = 4; - item.value = 15000; - 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(); - } - } +using System; +using 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 = 19; + item.useAnimation = 19; + item.useTurn = true; + item.axe = 13; + item.hammer = 50; + item.useStyle = 1; + item.knockBack = 4; + item.value = 15000; + 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 diff --git a/Items/RevivifyPotion.cs b/Items/RevivifyPotion.cs index 1a5fb7b861..6867c98322 100644 --- a/Items/RevivifyPotion.cs +++ b/Items/RevivifyPotion.cs @@ -1,59 +1,59 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class RevivifyPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Revivify Potion"); - Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = 20000; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.revivifyTimer = 900; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 50); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class RevivifyPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Revivify Potion"); + Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = 20000; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.revivifyTimer = 900; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddIngredient(ItemID.CrystalShard, 5); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Scavenger/AncientMedallion.cs b/Items/Scavenger/AncientMedallion.cs index 4ab22c17ee..52fabeb093 100644 --- a/Items/Scavenger/AncientMedallion.cs +++ b/Items/Scavenger/AncientMedallion.cs @@ -1,52 +1,52 @@ -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"); - } - - 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(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(); - } - } +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"); + } + + 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(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 diff --git a/Items/Scavenger/BloodPact.cs b/Items/Scavenger/BloodPact.cs index 8ac18ae288..cb17d70e63 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 = 500000; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodPact = 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.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 = 500000; + 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 diff --git a/Items/Scavenger/FleshTotem.cs b/Items/Scavenger/FleshTotem.cs index 709200fe87..1564a5008c 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 15 second cooldown"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = 500000; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fleshTotem = 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.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 15 second cooldown"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = 500000; + 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 diff --git a/Items/Scavenger/RavagerBag.cs b/Items/Scavenger/RavagerBag.cs index 6010629eb1..f9da9c3329 100644 --- a/Items/Scavenger/RavagerBag.cs +++ b/Items/Scavenger/RavagerBag.cs @@ -1,73 +1,73 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - 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")); - } - if (Main.rand.Next(2) == 0) - { - player.QuickSpawnItem(mod.ItemType("Hematemesis")); - } - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + 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")); + } + if (Main.rand.Next(2) == 0) + { + player.QuickSpawnItem(mod.ItemType("Hematemesis")); + } + } + } } \ No newline at end of file diff --git a/Items/ShadowspecBar.cs b/Items/ShadowspecBar.cs index d003d266b5..9304dde398 100644 --- a/Items/ShadowspecBar.cs +++ b/Items/ShadowspecBar.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 -{ - 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.value = 1000000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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(); - } - } +using System; +using 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.value = 1000000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 diff --git a/Items/ShardlightPickaxe.cs b/Items/ShardlightPickaxe.cs index c01dda19fb..f925902fce 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 = 4; - item.value = 157000; - 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, 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 +{ + 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 = 4; + item.value = 157000; + 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, 100); + } + } } \ No newline at end of file diff --git a/Items/SkyfringePickaxe.cs b/Items/SkyfringePickaxe.cs index d8f0a34e1a..4f0bfb789f 100644 --- a/Items/SkyfringePickaxe.cs +++ b/Items/SkyfringePickaxe.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 { -public class SkyfringePickaxe : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skyfringe Pickaxe"); - } - - public override void SetDefaults() - { - item.damage = 17; - item.melee = true; - item.width = 19; - item.height = 19; - item.useTime = 9; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 95; - item.useStyle = 1; - item.knockBack = 4; - item.value = 97000; - 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); - } - } +using System; +using 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"); + } + + public override void SetDefaults() + { + item.damage = 17; + item.melee = true; + item.width = 19; + item.height = 19; + item.useTime = 9; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 95; + item.useStyle = 1; + item.knockBack = 4; + item.value = 97000; + 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 diff --git a/Items/SlimeGod/ManaOverloader.cs b/Items/SlimeGod/ManaOverloader.cs index 497835992f..87ac4dc822 100644 --- a/Items/SlimeGod/ManaOverloader.cs +++ b/Items/SlimeGod/ManaOverloader.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.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 5 if mana is above 50% of its maximum\n" + - "Magic healing if mana is below 5% of its maximum"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.value = 15000; - item.rare = 5; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statManaMax2 += 50; - player.magicDamage += 0.06f; - if (player.statMana >= (player.statManaMax2 * 0.5f)) - { - player.lifeRegen -= 5; - } - if (player.statMana < (player.statManaMax2 * 0.05f)) - { - player.ghostHeal = 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.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 5 if mana is above 50% of its maximum\n" + + "Magic healing if mana is below 5% of its maximum"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.value = 15000; + item.rare = 5; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statManaMax2 += 50; + player.magicDamage += 0.06f; + if (player.statMana >= (player.statManaMax2 * 0.5f)) + { + player.lifeRegen -= 5; + } + if (player.statMana < (player.statManaMax2 * 0.05f)) + { + player.ghostHeal = true; + } + } + } } \ No newline at end of file diff --git a/Items/SlimeGod/OverloadedSludge.cs b/Items/SlimeGod/OverloadedSludge.cs index 036e0a111c..bfabf19769 100644 --- a/Items/SlimeGod/OverloadedSludge.cs +++ b/Items/SlimeGod/OverloadedSludge.cs @@ -1,62 +1,63 @@ -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"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - 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 !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(); - } - } +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"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + 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 !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 diff --git a/Items/SlimeGod/PurifiedGel.cs b/Items/SlimeGod/PurifiedGel.cs index 35b4ceddf6..6f68291981 100644 --- a/Items/SlimeGod/PurifiedGel.cs +++ b/Items/SlimeGod/PurifiedGel.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 3750; - item.rare = 5; - } +using System; +using 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 = 3750; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/SlimeGod/SlimeGodBag.cs b/Items/SlimeGod/SlimeGodBag.cs index 24bd0eb48f..702c7259c1 100644 --- a/Items/SlimeGod/SlimeGodBag.cs +++ b/Items/SlimeGod/SlimeGodBag.cs @@ -1,79 +1,79 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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) - { - 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)); - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("ElectrolyteGelPack")); - } - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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) + { + 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)); + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("ElectrolyteGelPack")); + } + } + } } \ No newline at end of file diff --git a/Items/SquishyBeanMount.cs b/Items/SquishyBeanMount.cs index 2f8da20f54..b0b7c1ce00 100644 --- a/Items/SquishyBeanMount.cs +++ b/Items/SquishyBeanMount.cs @@ -1,29 +1,29 @@ -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.value = 100000000; - 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.value = 100000000; + 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 5143e77ac3..c1e703ba07 100644 --- a/Items/Stardust.cs +++ b/Items/Stardust.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 5000; - item.rare = 5; - } +using System; +using 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 = 5000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/StarlightFuelCell.cs b/Items/StarlightFuelCell.cs index f4073f2e25..14d7f89201 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; - } - } +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 diff --git a/Items/StarterBag.cs b/Items/StarterBag.cs index 0d04be1015..24c1d296be 100644 --- a/Items/StarterBag.cs +++ b/Items/StarterBag.cs @@ -1,52 +1,52 @@ -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(ItemID.Shuriken, 75); //throwing needs - player.QuickSpawnItem(ItemID.ThrowingKnife, 75); - 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")); - } - } +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(ItemID.Shuriken, 75); //throwing needs + player.QuickSpawnItem(ItemID.ThrowingKnife, 75); + 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")); + } + } } \ No newline at end of file diff --git a/Items/StormlionMandible.cs b/Items/StormlionMandible.cs index b5bdae27b3..65c0fd89e1 100644 --- a/Items/StormlionMandible.cs +++ b/Items/StormlionMandible.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 3000; - item.rare = 2; - } +using System; +using 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 = 3000; + item.rare = 2; + } }} \ No newline at end of file diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 9e81d806ae..9376c8b1ac 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(null, "DraedonsForge"); - 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(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs index 59f2b784d0..3261693a36 100644 --- a/Items/SupremeCalamitas/EyeofExtinction.cs +++ b/Items/SupremeCalamitas/EyeofExtinction.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.Items.SupremeCalamitas -{ - public class EyeofExtinction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Death\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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - } - - public override bool UseItem(Player player) - { - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SupremeCalamitas +{ + public class EyeofExtinction : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Extinction"); + Tooltip.SetDefault("Death\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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + } + + public override bool UseItem(Player player) + { + 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 diff --git a/Items/SupremeHealingPotion.cs b/Items/SupremeHealingPotion.cs index aebba08276..e4125ec92c 100644 --- a/Items/SupremeHealingPotion.cs +++ b/Items/SupremeHealingPotion.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 -{ - public class SupremeHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Healing Potion"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.healLife = 250; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.value = 10000; - } - - 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 void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperHealingPotion); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items +{ + public class SupremeHealingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Healing Potion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.healLife = 250; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.value = 10000; + } + + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SuperHealingPotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs index d478ce818a..2f25674f86 100644 --- a/Items/TheDevourerofGods/CosmicWorm.cs +++ b/Items/TheDevourerofGods/CosmicWorm.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.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.TheDevourerofGods -{ - public class CosmicWorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Worm"); - Tooltip.SetDefault("Summons the devourer of the cosmos\nNot consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityGlobalNPC.DoGSecondStageCountdown <= 0; - } - - 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(); - } - } +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; + +namespace CalamityMod.Items.TheDevourerofGods +{ + public class CosmicWorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Worm"); + Tooltip.SetDefault("Summons the devourer of the cosmos\nNot consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityGlobalNPC.DoGSecondStageCountdown <= 0; + } + + 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 diff --git a/Items/TheDevourerofGods/CosmiliteBar.cs b/Items/TheDevourerofGods/CosmiliteBar.cs index 4cca20f5bd..818e22073b 100644 --- a/Items/TheDevourerofGods/CosmiliteBar.cs +++ b/Items/TheDevourerofGods/CosmiliteBar.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.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 = 15; - item.height = 12; - item.maxStack = 999; - item.value = 698750; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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); - } +using System; +using 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 = 15; + item.height = 12; + item.maxStack = 999; + item.value = 698750; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs index a773fa0469..62af74581f 100644 --- a/Items/TheDevourerofGods/DevourerofGodsBag.cs +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -1,81 +1,81 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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 bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - player.TryGettingDevArmor(); - 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")); - } - if (CalamityWorld.revenge) - { - if (player.GetModPlayer(mod).fabsolVodka) - { - player.QuickSpawnItem(mod.ItemType("Fabsol")); - } - if (CalamityWorld.death && player.difficulty == 2) - { - player.QuickSpawnItem(mod.ItemType("CosmicPlushie")); - } - } - player.QuickSpawnItem(mod.ItemType("CosmiliteBar"), Main.rand.Next(30, 40)); - player.QuickSpawnItem(mod.ItemType("NebulousCore")); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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 bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); + 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")); + } + if (CalamityWorld.revenge) + { + if (player.GetModPlayer(mod).fabsolVodka) + { + player.QuickSpawnItem(mod.ItemType("Fabsol")); + } + if (CalamityWorld.death && player.difficulty == 2) + { + player.QuickSpawnItem(mod.ItemType("CosmicPlushie")); + } + } + player.QuickSpawnItem(mod.ItemType("CosmiliteBar"), Main.rand.Next(30, 40)); + player.QuickSpawnItem(mod.ItemType("NebulousCore")); + } + } } \ No newline at end of file diff --git a/Items/TheDevourerofGods/NebulousCore.cs b/Items/TheDevourerofGods/NebulousCore.cs index 862a523b5f..de317b1fc4 100644 --- a/Items/TheDevourerofGods/NebulousCore.cs +++ b/Items/TheDevourerofGods/NebulousCore.cs @@ -1,122 +1,122 @@ -using System; -using 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 NebulousCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nebulous Core"); - Tooltip.SetDefault("10% increased damage and critical strike chance\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 = 513750; - item.accessory = true; - item.expert = true; - } - - 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.magicCrit += 10; - player.magicDamage += 0.1f; - player.meleeCrit += 10; - player.meleeDamage += 0.1f; - player.thrownCrit += 10; - player.thrownDamage += 0.1f; - player.rangedCrit += 10; - player.rangedDamage += 0.1f; - player.minionDamage += 0.1f; - int damage = 300; - 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; - } - } - } - } - } - } - } - } - } +using System; +using 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 NebulousCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebulous Core"); + Tooltip.SetDefault("10% increased damage and critical strike chance\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 = 500000; + item.accessory = true; + item.expert = true; + } + + 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.magicCrit += 10; + player.magicDamage += 0.1f; + player.meleeCrit += 10; + player.meleeDamage += 0.1f; + player.thrownCrit += 10; + player.thrownDamage += 0.1f; + player.rangedCrit += 10; + player.rangedDamage += 0.1f; + player.minionDamage += 0.1f; + int damage = 300; + 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 diff --git a/Items/TitanScalePotion.cs b/Items/TitanScalePotion.cs index af64fe0350..731f99678a 100644 --- a/Items/TitanScalePotion.cs +++ b/Items/TitanScalePotion.cs @@ -1,48 +1,48 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class TitanScalePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titan Scale Potion"); - Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("TitanScale"); - item.buffTime = 18000; - item.value = 10000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class TitanScalePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Scale Potion"); + Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TitanScale"); + item.buffTime = 18000; + item.value = 10000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitanPotion); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/TrapperBulb.cs b/Items/TrapperBulb.cs index da0b676cb5..c02cb3f571 100644 --- a/Items/TrapperBulb.cs +++ b/Items/TrapperBulb.cs @@ -1,26 +1,26 @@ -using System; -using 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 = 100000; - item.rare = 5; - } +using System; +using 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 = 100000; + item.rare = 5; + } }} \ No newline at end of file diff --git a/Items/UeliaceBar.cs b/Items/UeliaceBar.cs index 09a245107e..ccfd182c01 100644 --- a/Items/UeliaceBar.cs +++ b/Items/UeliaceBar.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 -{ - 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.value = 218750; - } - - 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 void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UelibloomOre", 12); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 4); - 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 +{ + 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.value = 218750; + } + + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UelibloomOre", 12); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/UnholyCore.cs b/Items/UnholyCore.cs index 1229fb801f..274ca88382 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 = 58750; - item.rare = 5; - } - - 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(); - } - } +using System; +using 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 = 58750; + item.rare = 5; + } + + 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 diff --git a/Items/VerstaltiteBar.cs b/Items/VerstaltiteBar.cs index 9a19a971d0..a224bc4539 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 = 15; - item.height = 12; - item.maxStack = 999; - item.value = 100000; - item.rare = 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryonicOre", 16); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 4); - 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 +{ + public class VerstaltiteBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryonic Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = 100000; + item.rare = 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryonicOre", 16); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/VictideBar.cs b/Items/VictideBar.cs index 20cc4e3d0e..b99189ebdf 100644 --- a/Items/VictideBar.cs +++ b/Items/VictideBar.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 VictideBar : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Bar"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = 15750; - 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(); - } +using System; +using 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 = 15; + item.height = 12; + item.maxStack = 999; + item.value = 15750; + 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 diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs index 88799fcf0e..a862b5b3c5 100644 --- a/Items/Weapons/AMR.cs +++ b/Items/Weapons/AMR.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 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 = 4000; - 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 = 10000000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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, 0.0f, 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 +{ + 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 = 4000; + 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 = 10000000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssBlade.cs b/Items/Weapons/AbyssBlade.cs index feac7c9787..bd52f3fbd9 100644 --- a/Items/Weapons/AbyssBlade.cs +++ b/Items/Weapons/AbyssBlade.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 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\nThe lower the enemies' defense the more damage they take from this debuff"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 80; - 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 = 900000; - item.rare = 8; - item.shoot = mod.ProjectileType("DepthOrb"); - item.shootSpeed = 19f; - } - - 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 = 80; + 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 = 900000; + item.rare = 8; + item.shoot = mod.ProjectileType("DepthOrb"); + item.shootSpeed = 19f; + } + + 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 e7a08bcf13..cded47b18a 100644 --- a/Items/Weapons/AbyssWeapons/Archerfish.cs +++ b/Items/Weapons/AbyssWeapons/Archerfish.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.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"); } - 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 = 50000; - 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, 0.0f, 0.0f); - return false; - } - } + 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 = 50000; + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/BallOFugu.cs b/Items/Weapons/AbyssWeapons/BallOFugu.cs index c769cec982..6e9d601978 100644 --- a/Items/Weapons/AbyssWeapons/BallOFugu.cs +++ b/Items/Weapons/AbyssWeapons/BallOFugu.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.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"); } - 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 = 50000; - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("BallOFugu"); - item.shootSpeed = 12f; - } - } + 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 = 50000; + 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 diff --git a/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs index cfc125f004..0acf488d8c 100644 --- a/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs +++ b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.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.AbyssWeapons -{ - public class BallisticPoisonBomb : 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 BallisticPoisonBomb : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ballistic Poison Bomb"); } - public override void SetDefaults() - { - item.width = 30; - item.damage = 60; - item.thrown = true; - 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 = 500000; - item.rare = 7; - item.shoot = mod.ProjectileType("BallisticPoisonBomb"); - item.shootSpeed = 12f; - } - - 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 SetDefaults() + { + item.width = 30; + item.damage = 60; + item.thrown = true; + 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 = 500000; + item.rare = 7; + item.shoot = mod.ProjectileType("BallisticPoisonBomb"); + item.shootSpeed = 12f; + } + + 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/Weapons/AbyssWeapons/BlackAnurian.cs b/Items/Weapons/AbyssWeapons/BlackAnurian.cs index 500d03d7c2..82b7e9c5ae 100644 --- a/Items/Weapons/AbyssWeapons/BlackAnurian.cs +++ b/Items/Weapons/AbyssWeapons/BlackAnurian.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.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"); } - 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 = 50000; - 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; - } - } + 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 = 50000; + 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 diff --git a/Items/Weapons/AbyssWeapons/BlackAnurian.png b/Items/Weapons/AbyssWeapons/BlackAnurian.png index 680a2f302b..ce0409a399 100644 Binary files a/Items/Weapons/AbyssWeapons/BlackAnurian.png and b/Items/Weapons/AbyssWeapons/BlackAnurian.png differ diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs index d9ab75ecb5..72f762240d 100644 --- a/Items/Weapons/AbyssWeapons/CalamarisLament.cs +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.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.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 = 3000000; - item.UseSound = SoundID.Item83; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Calamari"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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; - 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; - } - } +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 = 3000000; + item.UseSound = SoundID.Item83; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Calamari"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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; + 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 diff --git a/Items/Weapons/AbyssWeapons/DreadmineStaff.cs b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs index b4fd7656ae..80b7c954de 100644 --- a/Items/Weapons/AbyssWeapons/DreadmineStaff.cs +++ b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs @@ -1,97 +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 = 500000; - 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) - { - 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; - for (int x = 0; x < 1000; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("DreadmineTurret")) - { - projectile.Kill(); - } - } - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); - 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(); - } - } +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 = 500000; + 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 diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.cs b/Items/Weapons/AbyssWeapons/EidolicWail.cs index 3a4de469b1..d66851934b 100644 --- a/Items/Weapons/AbyssWeapons/EidolicWail.cs +++ b/Items/Weapons/AbyssWeapons/EidolicWail.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.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"); } - 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 = 3000000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Idle/WyrmScream"); - item.autoReuse = true; - item.shootSpeed = 5f; - item.shoot = mod.ProjectileType("EidolicWail"); - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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, 0); - } - } - } - } + 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 = 3000000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); + item.autoReuse = true; + item.shootSpeed = 5f; + item.shoot = mod.ProjectileType("EidolicWail"); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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, 0); + } + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.png b/Items/Weapons/AbyssWeapons/EidolicWail.png index 06d651032b..da22093448 100644 Binary files a/Items/Weapons/AbyssWeapons/EidolicWail.png and b/Items/Weapons/AbyssWeapons/EidolicWail.png differ diff --git a/Items/Weapons/AbyssWeapons/FlakKraken.cs b/Items/Weapons/AbyssWeapons/FlakKraken.cs index 160e3a53c8..c0a870f961 100644 --- a/Items/Weapons/AbyssWeapons/FlakKraken.cs +++ b/Items/Weapons/AbyssWeapons/FlakKraken.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.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"); } - 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 = 500000; - 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, 0.0f, 0.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(); - } - } + 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 = 500000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.cs b/Items/Weapons/AbyssWeapons/HalibutCannon.cs index 3c49457aa8..9753d3172f 100644 --- a/Items/Weapons/AbyssWeapons/HalibutCannon.cs +++ b/Items/Weapons/AbyssWeapons/HalibutCannon.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 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("Revengeance drop"); + Tooltip.SetDefault("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 = 150000; - 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; - } - } + 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 = 150000; + 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 diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.png b/Items/Weapons/AbyssWeapons/HalibutCannon.png index b677c96640..e325a73b5a 100644 Binary files a/Items/Weapons/AbyssWeapons/HalibutCannon.png and b/Items/Weapons/AbyssWeapons/HalibutCannon.png differ diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.cs b/Items/Weapons/AbyssWeapons/HerringStaff.cs index 2b24642f9b..27a99bb0b9 100644 --- a/Items/Weapons/AbyssWeapons/HerringStaff.cs +++ b/Items/Weapons/AbyssWeapons/HerringStaff.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.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 = 50000; - item.rare = 3; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Herring"); - 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; - } - } +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 = 50000; + item.rare = 3; + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Herring"); + 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 diff --git a/Items/Weapons/AbyssWeapons/Lionfish.cs b/Items/Weapons/AbyssWeapons/Lionfish.cs index c13cec5ba5..ccf50c618f 100644 --- a/Items/Weapons/AbyssWeapons/Lionfish.cs +++ b/Items/Weapons/AbyssWeapons/Lionfish.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.AbyssWeapons -{ - public class Lionfish : 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 Lionfish : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lionfish"); } - public override void SetDefaults() - { - item.width = 40; - item.damage = 54; - item.thrown = true; - 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 = 50000; - item.rare = 3; - item.shoot = mod.ProjectileType("Lionfish"); - item.shootSpeed = 12f; - } - } -} + public override void SetDefaults() + { + item.width = 40; + item.damage = 54; + item.thrown = true; + 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 = 50000; + item.rare = 3; + item.shoot = mod.ProjectileType("Lionfish"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs index 3e167a3e38..ab94a8d2af 100644 --- a/Items/Weapons/AbyssWeapons/SoulEdge.cs +++ b/Items/Weapons/AbyssWeapons/SoulEdge.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.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 = 265; - 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 = 3000000; - item.shoot = mod.ProjectileType("GhastlySoulLarge"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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, 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 = 265; + 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 = 3000000; + item.shoot = mod.ProjectileType("GhastlySoulLarge"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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, 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 8b25c91a00..3a09d83cce 100644 --- a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs +++ b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.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.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"); } - 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 = 3000000; - item.UseSound = SoundID.Item95; - item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); - item.shootSpeed = 7f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - } + 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 = 3000000; + item.UseSound = SoundID.Item95; + item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); + item.shootSpeed = 7f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs index bb1d88baf7..87eba864c2 100644 --- a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs +++ b/Items/Weapons/AbyssWeapons/TyphonsGreed.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 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"); } - 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 = 500000; - 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(); - } - } + 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 = 500000; + 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 diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs index 2a1dc6a7b7..ce93d93650 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"); - Item.staff[item.type] = true; + Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 40; - 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 = 500000; - 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; - } - int num107 = Main.rand.Next(3, 5); - 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, "DepthCells", 30); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 40; + 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 = 500000; + 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; + } + int num107 = Main.rand.Next(3, 5); + 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, "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 diff --git a/Items/Weapons/AbyssWeapons/Valediction.cs b/Items/Weapons/AbyssWeapons/Valediction.cs index c5431ab9c5..73254c6532 100644 --- a/Items/Weapons/AbyssWeapons/Valediction.cs +++ b/Items/Weapons/AbyssWeapons/Valediction.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; - -namespace CalamityMod.Items.Weapons.AbyssWeapons -{ - public class Valediction : 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.AbyssWeapons +{ + public class Valediction : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Valediction"); Tooltip.SetDefault("Throws a homing reaper scythe"); } - public override void SetDefaults() - { - item.width = 80; - item.damage = 450; - item.thrown = true; - 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 = 3000000; - item.shoot = mod.ProjectileType("Valediction"); - item.shootSpeed = 20f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } -} + public override void SetDefaults() + { + item.width = 80; + item.damage = 405; + item.thrown = true; + 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 = 3000000; + item.shoot = mod.ProjectileType("Valediction"); + item.shootSpeed = 20f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } +} diff --git a/Items/Weapons/AccelerationBullet.cs b/Items/Weapons/AccelerationBullet.cs index 2dc23bf910..934ce61922 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 = 7; - 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(); - } - } + 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.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 diff --git a/Items/Weapons/AccretionDisk.cs b/Items/Weapons/AccretionDisk.cs index 48d0cdb040..641cf8bf9e 100644 --- a/Items/Weapons/AccretionDisk.cs +++ b/Items/Weapons/AccretionDisk.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 AccretionDisk : 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 AccretionDisk : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Disk"); Tooltip.SetDefault("Shred the fabric of reality!"); } - 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.thrown = true; - item.height = 38; - item.value = 10000000; - item.shoot = mod.ProjectileType("AccretionDisk"); - item.shootSpeed = 13f; - } - - 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 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 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.thrown = true; + item.height = 38; + item.value = 10000000; + item.shoot = mod.ProjectileType("AccretionDisk"); + item.shootSpeed = 13f; + } + + 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 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/Weapons/AccretionDiskMelee.cs b/Items/Weapons/AccretionDiskMelee.cs index 22a047888d..2de6a97ac3 100644 --- a/Items/Weapons/AccretionDiskMelee.cs +++ b/Items/Weapons/AccretionDiskMelee.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 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("Shred the fabric of reality!"); - } - - 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 = 10000000; - item.shoot = mod.ProjectileType("AccretionDiskMelee"); - item.shootSpeed = 13f; - } - - 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 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 = 10000000; + item.shoot = mod.ProjectileType("AccretionDiskMelee"); + item.shootSpeed = 13f; + } + + 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 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 e2374cbe08..fe2cf52686 100644 --- a/Items/Weapons/AcidBullet.cs +++ b/Items/Weapons/AcidBullet.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 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"); } - public override void SetDefaults() - { - item.damage = 24; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 24; + 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 diff --git a/Items/Weapons/AdamantiteThrowingAxe.cs b/Items/Weapons/AdamantiteThrowingAxe.cs index 8dbb26f607..ec5c566fa2 100644 --- a/Items/Weapons/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/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.Weapons -{ - public class AdamantiteThrowingAxe : 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 AdamantiteThrowingAxe : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Adamantite Throwing Axe"); } - public override void SetDefaults() - { - item.width = 26; - item.damage = 37; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 26; + item.damage = 37; + item.thrown = true; + 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; + } + + 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/Weapons/AegisBlade.cs b/Items/Weapons/AegisBlade.cs index 46d6cd9a23..19a0cb2515 100644 --- a/Items/Weapons/AegisBlade.cs +++ b/Items/Weapons/AegisBlade.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; - -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 = 49; - 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.value = 5000000; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("NobodyKnows"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, Main.DiscoG, 53); - } - } - } - - 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"), damage, 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.value = 5000000; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("NobodyKnows"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, Main.DiscoG, 53); + } + } + } + + 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 acebeeb45c..80cc73620f 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("Their lives are yours"); } - public override void SetDefaults() - { - item.damage = 36; - 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 = 350000; - item.rare = 7; - item.UseSound = SoundID.Item41; - item.autoReuse = false; - 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, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddIngredient(ItemID.PhoenixBlaster); - recipe.AddIngredient(ItemID.ShroomiteBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 40; + 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 = 350000; + item.rare = 7; + item.UseSound = SoundID.Item41; + item.autoReuse = false; + 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, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreBar, 5); + recipe.AddIngredient(ItemID.PhoenixBlaster); + recipe.AddIngredient(ItemID.ShroomiteBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs index 72212c4b26..65a9036a30 100644 --- a/Items/Weapons/AethersWhisper.cs +++ b/Items/Weapons/AethersWhisper.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 AethersWhisper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aether's Whisper"); - Tooltip.SetDefault("Fires an energy beam that does more damage the further it travels\n" + - "Inflicts several long-lasting debuffs and splits on tile hits\n" + - "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 = 5000000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("AetherBeam"); - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-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, 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 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(); - } - } +using System; +using System.Collections.Generic; +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("Fires an energy beam that does more damage the further it travels\n" + + "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 = 5000000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("AetherBeam"); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-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, 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 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 diff --git a/Items/Weapons/Aftershock.cs b/Items/Weapons/Aftershock.cs index cc8a8a52b0..691c46f765 100644 --- a/Items/Weapons/Aftershock.cs +++ b/Items/Weapons/Aftershock.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.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 = 150000; - 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; - int boulder = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.BoulderStaffOfEarth, 50, knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - Main.projectile[boulder].magic = false; - Main.projectile[boulder].melee = true; - } - - 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); - } - } - } + 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 = 150000; + 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; + int boulder = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.BoulderStaffOfEarth, (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Main.projectile[boulder].magic = false; + Main.projectile[boulder].melee = true; + } + + 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 diff --git a/Items/Weapons/AirSpinner.cs b/Items/Weapons/AirSpinner.cs index 90a120d4cb..826e2b14e6 100644 --- a/Items/Weapons/AirSpinner.cs +++ b/Items/Weapons/AirSpinner.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 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"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Valor); - item.damage = 21; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4; - item.value = 50000; - 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(); - } - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Valor); + item.damage = 21; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4; + item.value = 50000; + 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 diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs index 24b53e356c..429e26284f 100644 --- a/Items/Weapons/Alluvion.cs +++ b/Items/Weapons/Alluvion.cs @@ -1,17 +1,17 @@ -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 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 TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class Alluvion : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Alluvion"); @@ -21,91 +21,99 @@ namespace CalamityMod.Items.Weapons "Fires a torrent of ten arrows at once"); } - public override void SetDefaults() - { - item.damage = 53; - 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 = 10000000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - } - switch (Main.rand.Next(12)) - { - case 1: type = mod.ProjectileType("TorrentialArrow"); break; - default: break; - } - switch (Main.rand.Next(25)) - { - case 1: type = 408; break; - default: break; - } - switch (Main.rand.Next(100)) - { - case 1: type = mod.ProjectileType("TyphoonArrow"); break; - default: break; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } - 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(); - } - } + public override void SetDefaults() + { + item.damage = 53; + 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 = 10000000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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) + { + switch (Main.rand.Next(12)) + { + case 1: type = mod.ProjectileType("TorrentialArrow"); break; + default: break; + } + switch (Main.rand.Next(25)) + { + case 1: type = 408; break; + default: break; + } + switch (Main.rand.Next(100)) + { + case 1: type = mod.ProjectileType("TyphoonArrow"); break; + default: break; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num121].noDropItem = true; + } + else + { + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + 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 diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs index 6732c4eab4..026010ad28 100644 --- a/Items/Weapons/AlphaRay.cs +++ b/Items/Weapons/AlphaRay.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 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"); @@ -18,89 +18,89 @@ namespace CalamityMod.Items.Weapons } - public override void SetDefaults() - { - item.damage = 280; - 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 = 10000000; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("ParticleBeamofDoom"); - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 * 2f), 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), 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.5f), 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, "CosmiliteBar", 8); - recipe.AddIngredient(null, "Wingman", 2); - recipe.AddIngredient(null, "Genisis"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 280; + 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 = 10000000; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("ParticleBeamofDoom"); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 * 2f), 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), 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.5f), 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, "CosmiliteBar", 8); + recipe.AddIngredient(null, "Wingman", 2); + recipe.AddIngredient(null, "Genisis"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AnarchyBlade.cs b/Items/Weapons/AnarchyBlade.cs index b17d10b1be..3c4c096bfa 100644 --- a/Items/Weapons/AnarchyBlade.cs +++ b/Items/Weapons/AnarchyBlade.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; - -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; + +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\nYour hits will generate a large explosion\nIf 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 = 1000000; - 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) + 110f); - 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)((double)damage * 0.5f), knockback, Main.myPlayer); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.Next(5) == 0 && !target.boss) - { - 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 = 1000000; + 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) + 110f); + 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)((double)item.damage * 0.75), knockback, Main.myPlayer); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.Next(5) == 0 && !target.boss) + { + 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 e1075730c8..ddc7a00946 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 = 150000; - 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"), damage, 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 = 150000; + 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 67b4ccf033..eea4b93e83 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 = 150000; - 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; - } - } +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 = 150000; + 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 diff --git a/Items/Weapons/AncientShiv.cs b/Items/Weapons/AncientShiv.cs index 52e668eb20..aa339503f9 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 = 55000; - 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"), damage, 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 = 55000; + 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 b360d0e5f9..19b1517c92 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 = 900000; - item.rare = 6; - 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; - } - } + 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 = 900000; + item.rare = 6; + 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 diff --git a/Items/Weapons/Animus.cs b/Items/Weapons/Animus.cs index da7ac09456..adabfe91fe 100644 --- a/Items/Weapons/Animus.cs +++ b/Items/Weapons/Animus.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; - -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"); } - public override void SetDefaults() - { - item.width = 84; - item.damage = 2500; - 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 = 8000000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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"), 5000); - int damageRan = Main.rand.Next(195); //0 to 195 - if (damageRan >= 50 && damageRan <= 99) //25% - { - item.damage = 4000; - } - else if (damageRan >= 100 && damageRan <= 139) //20% - { - item.damage = 7500; - } - 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 = 2500; - } - } - } -} + public override void SetDefaults() + { + item.width = 84; + item.damage = 2500; + 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 = 8000000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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"), 5000); + int damageRan = Main.rand.Next(195); //0 to 195 + if (damageRan >= 50 && damageRan <= 99) //25% + { + item.damage = 4000; + } + else if (damageRan >= 100 && damageRan <= 139) //20% + { + item.damage = 7500; + } + 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 = 2500; + } + } + } +} diff --git a/Items/Weapons/ApoctosisArray.cs b/Items/Weapons/ApoctosisArray.cs index 3efbcbb442..c9b09b5a7a 100644 --- a/Items/Weapons/ApoctosisArray.cs +++ b/Items/Weapons/ApoctosisArray.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; - -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\nThe 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 = 5000000; - item.shoot = mod.ProjectileType("IonBlast"); - item.shootSpeed = 8f; - } - - 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 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 = 5000000; + item.shoot = mod.ProjectileType("IonBlast"); + item.shootSpeed = 8f; + } + + 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 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 cd8ce7e908..c661bc1eeb 100644 --- a/Items/Weapons/Apotheosis.cs +++ b/Items/Weapons/Apotheosis.cs @@ -1,55 +1,55 @@ -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 = 267; - 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 = 4; - item.value = 85000000; - item.rare = 12; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ApothMark"); - item.shootSpeed = 15; - } - - 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.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +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 = 267; + 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 = 4; + item.value = 85000000; + item.rare = 12; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ApothMark"); + item.shootSpeed = 15; + } + + 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.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AquaticDissolution.cs b/Items/Weapons/AquaticDissolution.cs index ca44d8ba4f..2c4a946888 100644 --- a/Items/Weapons/AquaticDissolution.cs +++ b/Items/Weapons/AquaticDissolution.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 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 = 154; - 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 = 10000000; - item.shoot = mod.ProjectileType("OceanBeam"); - item.shootSpeed = 12f; - } - - 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) - { - 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 = 154; + 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 = 10000000; + item.shoot = mod.ProjectileType("OceanBeam"); + item.shootSpeed = 12f; + } + + 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) + { + 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 59746a270f..d7e44c9cd4 100644 --- a/Items/Weapons/AquaticScourge/Barinautical.cs +++ b/Items/Weapons/AquaticScourge/Barinautical.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.AquaticScourge +{ + public class Barinautical : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Barinautical"); Tooltip.SetDefault("Shoots 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 = 500000; - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - 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; - } - } + + 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 = 500000; + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + 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 diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.cs b/Items/Weapons/AquaticScourge/DeepseaStaff.cs index 237099b85d..be5e137e76 100644 --- a/Items/Weapons/AquaticScourge/DeepseaStaff.cs +++ b/Items/Weapons/AquaticScourge/DeepseaStaff.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.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 = 36; - 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 = 500000; - item.rare = 5; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquaticStar"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AquaticStar"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + + public override void SetDefaults() + { + item.damage = 36; + 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 = 500000; + item.rare = 5; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquaticStar"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AquaticStar"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/AquaticScourge/Downpour.cs b/Items/Weapons/AquaticScourge/Downpour.cs index f40d3bfe1c..2da214ef4c 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 = 48; - 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 = 500000; - 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; - } - } + + public override void SetDefaults() + { + item.damage = 48; + 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 = 500000; + 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 diff --git a/Items/Weapons/AquaticScourge/SubmarineShocker.cs b/Items/Weapons/AquaticScourge/SubmarineShocker.cs index ac4f64dde7..eebf6155f1 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 = 500000; - 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"), damage, 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 = 500000; + 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 07a4b76b2a..f4738d5f7d 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 = 1000000; - item.rare = 10; - 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(); - } - } + 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 = 1000000; + item.rare = 10; + 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 diff --git a/Items/Weapons/ArcticArrow.cs b/Items/Weapons/ArcticArrow.cs index 494e50519d..64378be909 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 = 13; - 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(); - } - } + 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 = 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 diff --git a/Items/Weapons/ArcticArrow.png b/Items/Weapons/ArcticArrow.png index 348918784f..d667dfa5b6 100644 Binary files a/Items/Weapons/ArcticArrow.png and b/Items/Weapons/ArcticArrow.png differ diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index 172cd52d0a..8fa9dbc82c 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; - -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; + +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 = 300000; - 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 star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Main.projectile[star].ranged = false; - Main.projectile[star].melee = 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"), 500); - } - } - } -} + 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 = 300000; + 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 star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Main.projectile[star].ranged = false; + Main.projectile[star].melee = 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"), 500); + } + } + } +} diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs index 254ba27c65..1496293442 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,206 +18,206 @@ namespace CalamityMod.Items.Weapons "Projectiles also change based on moon events"); } - public override void SetDefaults() - { - item.width = 100; - item.damage = 320; - 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 = 30000000; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 28f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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 = 320; + 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 = 30000000; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 28f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 3f917786d2..e946023184 100644 --- a/Items/Weapons/ArkoftheElements.cs +++ b/Items/Weapons/ArkoftheElements.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; - -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 = 10000000; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 16f; - } - - 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) - { - 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"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } -} + 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 = 10000000; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 16f; + } + + 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) + { + 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"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } +} diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs index adfb416a34..e9aef6b8bc 100644 --- a/Items/Weapons/ArterialAssault.cs +++ b/Items/Weapons/ArterialAssault.cs @@ -1,114 +1,122 @@ -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 ArterialAssault : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arterial Assault"); - Tooltip.SetDefault("Fires a chain of bloodfire arrows from the sky"); - } - - 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 = 1000000; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodfireArrow"); - item.shootSpeed = 30f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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; - 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; - 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class ArterialAssault : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arterial Assault"); + Tooltip.SetDefault("Fires a chain of bloodfire arrows from the sky"); + } + + 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 = 1000000; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodfireArrow"); + item.shootSpeed = 30f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs index f160948a92..28d8d2aec7 100644 --- a/Items/Weapons/AsteroidStaff.cs +++ b/Items/Weapons/AsteroidStaff.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 -{ - 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"); 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 = 900000; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Asteroid"); - item.shootSpeed = 20f; - } - - 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 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; - } - } + 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 = 900000; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Asteroid"); + item.shootSpeed = 20f; + } + + 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 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 diff --git a/Items/Weapons/AsteroidStaff.png b/Items/Weapons/AsteroidStaff.png index f36c23cc26..5392c11d28 100644 Binary files a/Items/Weapons/AsteroidStaff.png and b/Items/Weapons/AsteroidStaff.png differ diff --git a/Items/Weapons/AstralBlaster.cs b/Items/Weapons/AstralBlaster.cs index 50f1d1ad1e..656d17fce8 100644 --- a/Items/Weapons/AstralBlaster.cs +++ b/Items/Weapons/AstralBlaster.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 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 +{ + public class AstralBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Blaster"); } - public override void SetDefaults() - { - item.damage = 72; - item.crit += 25; - item.ranged = true; - item.width = 40; - item.height = 24; - item.useTime = 11; - item.useAnimation = 11; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = 350000; - item.rare = 7; - 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, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 72; + item.crit += 25; + item.ranged = true; + item.width = 40; + item.height = 24; + item.useTime = 11; + item.useAnimation = 11; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = 350000; + item.rare = 7; + 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, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AstralPike.cs b/Items/Weapons/AstralPike.cs index 6b77309f6d..ceac473024 100644 --- a/Items/Weapons/AstralPike.cs +++ b/Items/Weapons/AstralPike.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 AstralPike : 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 AstralPike : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Pike"); } - - public override void SetDefaults() - { - item.width = 44; //The width of the .png file in pixels divided by 2. - item.damage = 85; //Keep this reasonable please. - item.crit += 25; - item.melee = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 5; - item.useTime = 13; - item.knockBack = 8.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 50; //The height of the .png file in pixels divided by 2. - item.value = 350000; //Value is calculated in copper coins. - item.rare = 7; //Ranges from 1 to 11. - 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.MythrilAnvil); - 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; - } -}} + + public override void SetDefaults() + { + item.width = 44; //The width of the .png file in pixels divided by 2. + item.damage = 85; //Keep this reasonable please. + item.crit += 25; + item.melee = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 5; + item.useTime = 13; + item.knockBack = 8.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 50; //The height of the .png file in pixels divided by 2. + item.value = 350000; //Value is calculated in copper coins. + item.rare = 7; //Ranges from 1 to 11. + 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.MythrilAnvil); + 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/AstralRepeater.cs b/Items/Weapons/AstralRepeater.cs index c1483cf89a..e2bebdef28 100644 --- a/Items/Weapons/AstralRepeater.cs +++ b/Items/Weapons/AstralRepeater.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons -{ - 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class AstralRepeater : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Bow"); } - public override void SetDefaults() - { - item.damage = 65; - 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 = 350000; - item.rare = 7; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("crossbow"); - }*/ - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 65; + 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 = 350000; + item.rare = 7; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("crossbow"); + }*/ + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AstrealDefeat.cs b/Items/Weapons/AstrealDefeat.cs index 6a66bd8b4d..0aca0e1835 100644 --- a/Items/Weapons/AstrealDefeat.cs +++ b/Items/Weapons/AstrealDefeat.cs @@ -1,17 +1,17 @@ -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 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class AstrealDefeat : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astreal Defeat"); @@ -21,60 +21,60 @@ 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 = 17500000; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstrealArrow"); - item.shootSpeed = 1f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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, 0.0f, 0.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(); - } - } + 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 = 17500000; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstrealArrow"); + item.shootSpeed = 1f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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, 0.0f, 0.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 diff --git a/Items/Weapons/AstrumDeus/Nebulash.cs b/Items/Weapons/AstrumDeus/Nebulash.cs index cdb0b4b298..ffeef2fd05 100644 --- a/Items/Weapons/AstrumDeus/Nebulash.cs +++ b/Items/Weapons/AstrumDeus/Nebulash.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; - -namespace CalamityMod.Items.Weapons.AstrumDeus -{ - public class Nebulash : 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.AstrumDeus +{ + public class Nebulash : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nebulash"); } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 60; - item.rare = 7; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useStyle = 5; - item.knockBack = 2f; - item.UseSound = SoundID.Item117; - item.value = 500000; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Nebulash"); - } - - public override bool 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.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, ai3); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 54; + item.rare = 7; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useStyle = 5; + item.knockBack = 2f; + item.UseSound = SoundID.Item117; + item.value = 500000; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("Nebulash"); + } + + public override bool 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.5f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, ai3); + return false; + } + } +} diff --git a/Items/Weapons/AstrumDeus/Nebulash.png b/Items/Weapons/AstrumDeus/Nebulash.png index 4bc473d6a3..be06352ad1 100644 Binary files a/Items/Weapons/AstrumDeus/Nebulash.png and b/Items/Weapons/AstrumDeus/Nebulash.png differ diff --git a/Items/Weapons/AstrumDeus/Starfall.cs b/Items/Weapons/AstrumDeus/Starfall.cs index 71a66a743d..574554759f 100644 --- a/Items/Weapons/AstrumDeus/Starfall.cs +++ b/Items/Weapons/AstrumDeus/Starfall.cs @@ -1,70 +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.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"); } - public override void SetDefaults() - { - item.damage = 45; - item.crit += 25; - item.magic = true; - item.mana = 15; - item.rare = 7; - item.width = 28; - item.height = 30; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = 500000; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralStar"); - 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); - Main.projectile[star].magic = true; - } - return false; - } - } + public override void SetDefaults() + { + item.damage = 45; + item.crit += 25; + item.magic = true; + item.mana = 15; + item.rare = 7; + item.width = 28; + item.height = 30; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = 500000; + 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, 1f, 0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/AuguroftheElements.cs b/Items/Weapons/AuguroftheElements.cs index 4766098f34..b942191413 100644 --- a/Items/Weapons/AuguroftheElements.cs +++ b/Items/Weapons/AuguroftheElements.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 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 = 10000000; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementTentacle"); - item.shootSpeed = 30f; - } - - 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 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; - } - } + 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 = 10000000; + item.UseSound = SoundID.Item103; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementTentacle"); + item.shootSpeed = 30f; + } + + 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 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 diff --git a/Items/Weapons/Azathoth.cs b/Items/Weapons/Azathoth.cs index 3b588187c4..dd3d120c44 100644 --- a/Items/Weapons/Azathoth.cs +++ b/Items/Weapons/Azathoth.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 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\nFires cosmic orbs that blast nearby enemies with lasers"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Kraken); - item.damage = 100; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = 10000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AzathothProjectile"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override bool 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); - return false; - } - - 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(); - } - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Kraken); + item.damage = 100; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 6f; + item.value = 10000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AzathothProjectile"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override bool 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); + return false; + } + + 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 diff --git a/Items/Weapons/BalefulHarvester.cs b/Items/Weapons/BalefulHarvester.cs index 037d99e4e5..52af460e94 100644 --- a/Items/Weapons/BalefulHarvester.cs +++ b/Items/Weapons/BalefulHarvester.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 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"); } - 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 = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = 475000; - 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, 2400); - } - } -} + 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 = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = 475000; + 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, 2400); + } + } +} diff --git a/Items/Weapons/BarracudaGun.cs b/Items/Weapons/BarracudaGun.cs index ddfa26d777..3556d5b97d 100644 --- a/Items/Weapons/BarracudaGun.cs +++ b/Items/Weapons/BarracudaGun.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 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"); } - 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 = 1.05f; - item.value = 900000; - item.rare = 9; - 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(); - } - } + 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 = 1.05f; + item.value = 900000; + item.rare = 9; + 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 diff --git a/Items/Weapons/BiomeBlade.cs b/Items/Weapons/BiomeBlade.cs index d7038b4524..9a04e83226 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 = 42; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 36; - item.value = 300000; - 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 = 42; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 36; + item.value = 300000; + 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 d5ab74f421..9f8319e178 100644 --- a/Items/Weapons/BladecrestOathsword.cs +++ b/Items/Weapons/BladecrestOathsword.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 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"); } - 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 = 100000; - 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, 200); - } - } -} + 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 = 100000; + 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, 200); + } + } +} diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs index 05195514af..8b35c2da48 100644 --- a/Items/Weapons/BladedgeGreatbow.cs +++ b/Items/Weapons/BladedgeGreatbow.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 TerrariaOverhaul; - -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 TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class BladedgeGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bladedge Railbow"); } - 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 = 200000; - item.rare = 6; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("crossbow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 5; i++) - { - float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; - switch (Main.rand.Next(5)) - { - case 1: type = ProjectileID.ChlorophyteArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[index].noDropItem = 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(); - } - } + 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 = 200000; + item.rare = 6; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("crossbow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 5; i++) + { + float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; + switch (Main.rand.Next(5)) + { + case 1: type = ProjectileID.ChlorophyteArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[index].noDropItem = 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 diff --git a/Items/Weapons/BladeofEnmity.cs b/Items/Weapons/BladeofEnmity.cs index 9c76a52f2c..56b3e23397 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 = 1250000; - 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"), 2000); - } - } -} + 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 = 1250000; + 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"), 2000); + } + } +} diff --git a/Items/Weapons/BloodfireArrow.cs b/Items/Weapons/BloodfireArrow.cs index 5464f37917..bd76e7dd8a 100644 --- a/Items/Weapons/BloodfireArrow.cs +++ b/Items/Weapons/BloodfireArrow.cs @@ -1,54 +1,54 @@ -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 = 30; - 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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 30; + 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Weapons/BloodyEdge.cs b/Items/Weapons/BloodyEdge.cs index c824729c5f..e2cde10b4c 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 = 160000; - 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) - { - 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 = 160000; + 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) + { + 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 02f667b141..12ca1510cc 100644 --- a/Items/Weapons/BlossomFlux.cs +++ b/Items/Weapons/BlossomFlux.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +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 = 5000000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LeafArrow"); - item.shootSpeed = 10f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, 203, 103); - } - } - } - - 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; - } - } - } + 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 = 5000000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LeafArrow"); + item.shootSpeed = 10f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, 203, 103); + } + } + } + + 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 diff --git a/Items/Weapons/BlushieStaff.cs b/Items/Weapons/BlushieStaff.cs index 8381d49840..c0d2f7b057 100644 --- a/Items/Weapons/BlushieStaff.cs +++ b/Items/Weapons/BlushieStaff.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.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.rare = 11; - item.magic = true; - item.value = 100000000; - item.UseSound = SoundID.Item1; - item.shoot = mod.ProjectileType("BlushieStaffProj"); - item.mana = 200; - item.shootSpeed = 0f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 0, 255); - } - } - } - - 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(); - } - } +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.rare = 11; + item.magic = true; + item.value = 100000000; + item.UseSound = SoundID.Item1; + item.shoot = mod.ProjectileType("BlushieStaffProj"); + item.mana = 200; + item.shootSpeed = 0f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/Brimblade.cs b/Items/Weapons/Brimblade.cs index 8e36e9cc05..c11f7b59f9 100644 --- a/Items/Weapons/Brimblade.cs +++ b/Items/Weapons/Brimblade.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 Brimblade : 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 Brimblade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblade"); } - public override void SetDefaults() - { - item.width = 26; - item.damage = 37; - 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.thrown = true; - item.height = 26; - item.value = 300000; - item.rare = 6; - item.shoot = mod.ProjectileType("Brimblade"); - item.shootSpeed = 12f; - } - - 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 SetDefaults() + { + item.width = 26; + item.damage = 37; + 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.thrown = true; + item.height = 26; + item.value = 300000; + item.rare = 6; + item.shoot = mod.ProjectileType("Brimblade"); + item.shootSpeed = 12f; + } + + 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/Weapons/Brimlash.cs b/Items/Weapons/Brimlash.cs index 69b06de913..b3faa8bb92 100644 --- a/Items/Weapons/Brimlash.cs +++ b/Items/Weapons/Brimlash.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 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"); } - 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 = 650000; - item.rare = 6; - 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 = 650000; + item.rare = 6; + 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 3d3748483e..dcf4f53e64 100644 --- a/Items/Weapons/BrimlashBuster.cs +++ b/Items/Weapons/BrimlashBuster.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 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"); } - public override void SetDefaults() - { - item.width = 68; - item.damage = 126; - 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 = 3000000; - 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 = 360; - } - else - { - item.damage = 120; - } - } - } -} + public override void SetDefaults() + { + item.width = 68; + item.damage = 126; + 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 = 3000000; + 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 = 360; + } + else + { + item.damage = 120; + } + } + } +} diff --git a/Items/Weapons/BrimroseStaff.cs b/Items/Weapons/BrimroseStaff.cs index 7a12fbcffb..f0d7f36b91 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 = 27; - 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 = 7; - item.value = 300000; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 27; + 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 = 7; + item.value = 300000; + 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 diff --git a/Items/Weapons/BrimstoneFury.cs b/Items/Weapons/BrimstoneFury.cs index b595fe3aba..d7290a0f23 100644 --- a/Items/Weapons/BrimstoneFury.cs +++ b/Items/Weapons/BrimstoneFury.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class BrimstoneFury : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fury"); } - public override void SetDefaults() - { - item.damage = 17; - 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 = 300000; - item.rare = 6; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBolt"); - item.shootSpeed = 13f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(9); - 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(); - } - } + public override void SetDefaults() + { + item.damage = 17; + 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 = 300000; + item.rare = 6; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBolt"); + item.shootSpeed = 13f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(9); + 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 diff --git a/Items/Weapons/BrimstoneWaifu/Brimlance.cs b/Items/Weapons/BrimstoneWaifu/Brimlance.cs index 0d90eab6aa..fd483e4453 100644 --- a/Items/Weapons/BrimstoneWaifu/Brimlance.cs +++ b/Items/Weapons/BrimstoneWaifu/Brimlance.cs @@ -1,40 +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.BrimstoneWaifu { -public class Brimlance : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlance"); - Tooltip.SetDefault("This spear causes brimstone explosions on enemy hits\nEnemies killed by the spear drop brimstone fire"); - } - - public override void SetDefaults() - { - item.width = 56; //The width of the .png file in pixels divided by 2. - item.damage = 75; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 5; - item.useTime = 19; - item.knockBack = 7.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". - item.height = 56; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 200000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("Brimlance"); - item.shootSpeed = 12f; - } -}} +using System; +using System.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 Brimlance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlance"); + Tooltip.SetDefault("This spear causes brimstone explosions on enemy hits\nEnemies killed by the spear drop brimstone fire"); + } + + public override void SetDefaults() + { + item.width = 56; //The width of the .png file in pixels divided by 2. + item.damage = 75; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 5; + item.useTime = 19; + item.knockBack = 7.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". + item.height = 56; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 200000; //Value is calculated in copper coins. + item.rare = 5; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("Brimlance"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs index 0d5eb1c884..eff6d382e7 100644 --- a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs +++ b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs @@ -1,64 +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 = 62; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 6.75f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.value = 500000; - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBarrage"); //idk why but all the guns in the vanilla source have this - 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; - int projectile1 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - int projectile2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("BrimstoneHellblast"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - int projectile3 = Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile1].hostile = false; - Main.projectile[projectile1].friendly = true; - Main.projectile[projectile1].magic = true; - Main.projectile[projectile2].hostile = false; - Main.projectile[projectile2].friendly = true; - Main.projectile[projectile2].tileCollide = false; - Main.projectile[projectile2].magic = true; - Main.projectile[projectile3].hostile = false; - Main.projectile[projectile3].friendly = true; - Main.projectile[projectile3].magic = true; - return false; - } - } + + public override void SetDefaults() + { + item.damage = 62; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 32; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 6.75f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + item.value = 500000; + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SeethingDischargeBrimstoneBarrage"); //idk why but all the guns in the vanilla source have this + 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, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("SeethingDischargeBrimstoneHellblast"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/BrinyBaron.cs b/Items/Weapons/BrinyBaron.cs index 1ce4c3d856..b9fdd965ef 100644 --- a/Items/Weapons/BrinyBaron.cs +++ b/Items/Weapons/BrinyBaron.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; - -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 = 5000000; - item.shootSpeed = 4f; - item.shoot = mod.ProjectileType("NobodyKnows"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(53, Main.DiscoG, 255); - } - } - } - - 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"), (int)((double)damage * 0.5f), 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"), damage, 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 = 5000000; + item.shootSpeed = 4f; + item.shoot = mod.ProjectileType("NobodyKnows"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(53, Main.DiscoG, 255); + } + } + } + + 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 7c9f8e770b..88b2343c0c 100644 --- a/Items/Weapons/Bumblebirb/GildedProboscis.cs +++ b/Items/Weapons/Bumblebirb/GildedProboscis.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.Bumblebirb -{ - public class GildedProboscis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gilded Proboscis"); - Tooltip.SetDefault("This spear ignores npc immunity frames\nHeals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 66; - item.damage = 320; - 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.maxStack = 1; - item.value = 1000000; - item.shoot = mod.ProjectileType("GildedProboscis"); - item.shootSpeed = 13f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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("This spear ignores npc immunity frames\nHeals the player on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 66; + item.damage = 320; + 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.maxStack = 1; + item.value = 1000000; + item.shoot = mod.ProjectileType("GildedProboscis"); + item.shootSpeed = 13f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 885f78a074..6c5f817cf1 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.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.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 = 145; - 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 = 1000000; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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; - } - } + + public override void SetDefaults() + { + item.damage = 145; + 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 = 1000000; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/Bumblebirb/RougeSlash.cs b/Items/Weapons/Bumblebirb/RougeSlash.cs index d84d46a60a..81225366c9 100644 --- a/Items/Weapons/Bumblebirb/RougeSlash.cs +++ b/Items/Weapons/Bumblebirb/RougeSlash.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.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 = 130; - item.magic = true; - item.mana = 30; - item.width = 28; - item.height = 32; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 7.5f; - item.UseSound = SoundID.Item91; - item.value = 1000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("RougeSlashLarge"); //idk why but all the guns in the vanilla source have this - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 slash1 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("RougeSlashLarge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - int slash2 = Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, mod.ProjectileType("RougeSlashMedium"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - int slash3 = 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; - } - } + + public override void SetDefaults() + { + item.damage = 130; + item.magic = true; + item.mana = 30; + item.width = 28; + item.height = 32; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 7.5f; + item.UseSound = SoundID.Item91; + item.value = 1000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("RougeSlashLarge"); //idk why but all the guns in the vanilla source have this + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Weapons/BurningSea.cs b/Items/Weapons/BurningSea.cs index 641853886a..297c2f039f 100644 --- a/Items/Weapons/BurningSea.cs +++ b/Items/Weapons/BurningSea.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 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"); } - 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 = 300000; - 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(); - } - } + 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 = 300000; + 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 diff --git a/Items/Weapons/BurntSienna.cs b/Items/Weapons/BurntSienna.cs index b2c95f7e59..748dcf67af 100644 --- a/Items/Weapons/BurntSienna.cs +++ b/Items/Weapons/BurntSienna.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; - -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 = 300000; - item.rare = 3; - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.AshBlock, 30); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 6); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed)- spread/2; - double deltaAngle = spread/8f; - 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"), damage, knockback, Main.myPlayer); - int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), damage, knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), damage, knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; - } - } - } - - 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 = 300000; + item.rare = 3; + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.AshBlock, 30); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddIngredient(ItemID.MeteoriteBar, 6); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed)- spread/2; + double deltaAngle = spread/8f; + 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"), item.damage, knockback, Main.myPlayer); + int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), item.damage, knockback, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), item.damage, knockback, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; + } + } + } + + 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 4da55c16e0..170688d2b9 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 = 100000; - 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(); - } - } + 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 = 100000; + 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 diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.cs b/Items/Weapons/Calamitas/BlightedEyeStaff.cs index 18abf24da8..a8f5c20f89 100644 --- a/Items/Weapons/Calamitas/BlightedEyeStaff.cs +++ b/Items/Weapons/Calamitas/BlightedEyeStaff.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.Calamitas { -public class BlightedEyeStaff : 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.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 = 35; - item.mana = 10; - item.width = 62; - item.height = 62; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 2f; - item.value = 450000; - item.rare = 6; - 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; - } + + public override void SetDefaults() + { + item.damage = 35; + item.mana = 10; + item.width = 62; + item.height = 62; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 2f; + item.value = 450000; + item.rare = 6; + 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 diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs index 759d10a2cb..f862e6fe60 100644 --- a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs +++ b/Items/Weapons/Calamitas/BrimstoneFlameblaster.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 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"); } - - 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; //so the item's animation doesn't do damage - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = 500000; - item.rare = 6; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); //idk why but all the guns in the vanilla source have this - item.shootSpeed = 8.5f; - item.useAmmo = 23; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; + item.value = 500000; + item.rare = 6; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); //idk why but all the guns in the vanilla source have this + item.shootSpeed = 8.5f; + item.useAmmo = 23; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs index ec0788ae41..d718bc1524 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; //so the item's animation doesn't do damage - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; - item.value = 500000; - item.rare = 6; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); //idk why but all the guns in the vanilla source have this - item.shootSpeed = 8.5f; - item.useAmmo = 23; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 1.5f; + item.UseSound = SoundID.Item34; + item.value = 500000; + item.rare = 6; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); //idk why but all the guns in the vanilla source have this + item.shootSpeed = 8.5f; + item.useAmmo = 23; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Calamitas/CalamitasInferno.cs b/Items/Weapons/Calamitas/CalamitasInferno.cs index e525ba02d8..5ba81f3dcb 100644 --- a/Items/Weapons/Calamitas/CalamitasInferno.cs +++ b/Items/Weapons/Calamitas/CalamitasInferno.cs @@ -1,37 +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; //so the item's animation doesn't do damage - item.knockBack = 7.5f; - item.value = 550000; - 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; //so the item's animation doesn't do damage + item.knockBack = 7.5f; + item.value = 550000; + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneHellfireballFriendly"); + item.shootSpeed = 16f; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Calamitas/CrushsawCrasher.cs b/Items/Weapons/Calamitas/CrushsawCrasher.cs index 3e5f8cef8b..957a379f37 100644 --- a/Items/Weapons/Calamitas/CrushsawCrasher.cs +++ b/Items/Weapons/Calamitas/CrushsawCrasher.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.Calamitas { -public class CrushsawCrasher : 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 CrushsawCrasher : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Crushsaw Crasher"); } - - public override void SetDefaults() - { - item.width = 38; //The width of the .png file in pixels divided by 2. - item.damage = 65; //Keep this reasonable please. - item.thrown = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 7f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 22; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 500000; //Value is calculated in copper coins. - item.rare = 6; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("Crushax"); - item.shootSpeed = 11f; - } - - 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 = 38; //The width of the .png file in pixels divided by 2. + item.damage = 65; //Keep this reasonable please. + item.thrown = true; //Dictates whether this is a melee-class weapon. + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 7f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 22; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 500000; //Value is calculated in copper coins. + item.rare = 6; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("Crushax"); + item.shootSpeed = 11f; + } + + 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/Calamitas/TheEyeofCalamitas.cs b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs index f750c57590..75b7167762 100644 --- a/Items/Weapons/Calamitas/TheEyeofCalamitas.cs +++ b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs @@ -1,40 +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.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 = 500000; - item.rare = 6; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TheEyeofCalamitasProjectile"); - } - - public override bool 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); - 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.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 = 500000; + item.rare = 6; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TheEyeofCalamitasProjectile"); + } + + public override bool 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); + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CarnageRay.cs b/Items/Weapons/CarnageRay.cs index 07fdf4e2e1..bd4195e27d 100644 --- a/Items/Weapons/CarnageRay.cs +++ b/Items/Weapons/CarnageRay.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 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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 30; - 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 = 100000; - item.rare = 5; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 30; + 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 = 100000; + item.rare = 5; + 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 diff --git a/Items/Weapons/CatastropheClaymore.cs b/Items/Weapons/CatastropheClaymore.cs index ff9f198d80..9263c075e6 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("Remnant of a specular nova"); } - 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 = 750000; - item.rare = 7; - 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.CursedInferno, 200); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.Frostburn, 200); - } - } - } -} + 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 = 750000; + item.rare = 7; + 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.CursedInferno, 200); + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.Frostburn, 200); + } + } + } +} diff --git a/Items/Weapons/CausticEdge.cs b/Items/Weapons/CausticEdge.cs index e48b16f227..8e7f1c94b4 100644 --- a/Items/Weapons/CausticEdge.cs +++ b/Items/Weapons/CausticEdge.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 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("Give Sick"); } - 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 = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 48; - item.value = 160000; - item.rare = 3; - } - - 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); - } - } -} + 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 = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 48; + item.value = 160000; + item.rare = 3; + } + + 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); + } + } +} diff --git a/Items/Weapons/CelestialClaymore.cs b/Items/Weapons/CelestialClaymore.cs index 0d83b499da..6466956198 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 after 2 seconds"); } - 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 = 300000; - 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 = 300000; + 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/Celestus.cs b/Items/Weapons/Celestus.cs index f6a3da7592..b0eaa4f69e 100644 --- a/Items/Weapons/Celestus.cs +++ b/Items/Weapons/Celestus.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 Celestus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - } - - public override void SetDefaults() - { - item.width = 20; - item.damage = 145; - 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.thrown = true; - item.height = 20; - item.value = 100000000; - item.shoot = mod.ProjectileType("Celestus"); - item.shootSpeed = 25f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AccretionDisk"); - recipe.AddIngredient(null, "Crystalline"); - 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.Weapons +{ + public class Celestus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + } + + public override void SetDefaults() + { + item.width = 20; + item.damage = 145; + 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.thrown = true; + item.height = 20; + item.value = 100000000; + item.shoot = mod.ProjectileType("Celestus"); + item.shootSpeed = 25f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AccretionDisk"); + recipe.AddIngredient(null, "Crystalline"); + 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/Weapons/Chaotrix.cs b/Items/Weapons/Chaotrix.cs index 997c84b038..42a77830bd 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 = 3.6f; - item.value = 300000; - 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(); - } - } + 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 = 3.6f; + item.value = 300000; + 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 diff --git a/Items/Weapons/ChargedDartRifle.cs b/Items/Weapons/ChargedDartRifle.cs index 727ed364ff..4a83b7ce6d 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 = 1050000; - item.rare = 8; - 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"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0.0f, 0.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(); - } - } + 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 = 1050000; + item.rare = 8; + 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"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/ClaretCannon.cs b/Items/Weapons/ClaretCannon.cs index 26d5f06cbd..1345943730 100644 --- a/Items/Weapons/ClaretCannon.cs +++ b/Items/Weapons/ClaretCannon.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 ClaretCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Claret Cannon"); - Tooltip.SetDefault("Fires bloodfire bullets that drain enemy health"); - } - - public override void SetDefaults() - { - item.damage = 255; - 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 = 1000000; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("BloodfireBullet"); - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +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 bloodfire bullets that drain enemy health"); + } + + public override void SetDefaults() + { + item.damage = 255; + 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 = 1000000; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("BloodfireBullet"); + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs index f3e809efed..451d1e3cd3 100644 --- a/Items/Weapons/CleansingBlaze.cs +++ b/Items/Weapons/CleansingBlaze.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 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 = 150; - 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 = 1350000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("EssenceFire"); - item.shootSpeed = 14f; - item.useAmmo = 23; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) <= 90) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 150; + 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 = 1350000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("EssenceFire"); + item.shootSpeed = 14f; + item.useAmmo = 23; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + 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 diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index 40239d32cc..e4f86655b1 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.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 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"); @@ -18,85 +18,85 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 110; - 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 = 10000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Climax"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override bool 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; - vector2 += new Vector2(num208, num209); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MagneticMeltdown"); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 110; + 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 = 10000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Climax"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override bool 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; + vector2 += new Vector2(num208, num209); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MagneticMeltdown"); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/ClockGatlignum.cs b/Items/Weapons/ClockGatlignum.cs index 5162cfa0a2..4d9d961d04 100644 --- a/Items/Weapons/ClockGatlignum.cs +++ b/Items/Weapons/ClockGatlignum.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 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"); } - 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 = 1200000; - 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(); - } - } + 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 = 1200000; + 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 diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs index 650ebb01c2..9b6f037f93 100644 --- a/Items/Weapons/ClockworkBow.cs +++ b/Items/Weapons/ClockworkBow.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 TerrariaOverhaul; - -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\nAll 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 = 2000000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 30f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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 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; - } - } +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 ClockworkBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clockwork Bow"); + Tooltip.SetDefault("Fires a storm of arrows in random directions\nAll 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 = 2000000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 30f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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 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 diff --git a/Items/Weapons/Cnidarian.cs b/Items/Weapons/Cnidarian.cs index 8cccb515a4..8a1c686557 100644 --- a/Items/Weapons/Cnidarian.cs +++ b/Items/Weapons/Cnidarian.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 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"); } - 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 = 3; - item.value = 30000; - 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(); - } - } + 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 = 3; + item.value = 30000; + 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 diff --git a/Items/Weapons/CobaltKunai.cs b/Items/Weapons/CobaltKunai.cs index b59b43a858..7b8cc6105d 100644 --- a/Items/Weapons/CobaltKunai.cs +++ b/Items/Weapons/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.Weapons -{ - public class CobaltKunai : 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 CobaltKunai : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cobalt Kunai"); } - public override void SetDefaults() - { - item.width = 18; - item.damage = 28; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 18; + item.damage = 28; + item.thrown = true; + 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; + } + + 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/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index 7b020909e3..12ab7f3940 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.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 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; + +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 = 800000; - 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 meteor = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((double)damage * 0.5f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - Main.projectile[meteor].tileCollide = false; - Main.projectile[meteor].magic = false; - Main.projectile[meteor].melee = 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 = 800000; + 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 meteor = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Main.projectile[meteor].tileCollide = false; + Main.projectile[meteor].magic = false; + Main.projectile[meteor].melee = 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 16d377ffcb..f78395441b 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"); } - 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 = 300000; - 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, 0.0f, 0.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; - 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(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, 0.0f, 0.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(); - } - } + 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 = 300000; + 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, 0.0f, 0.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; + 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(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, 0.0f, 0.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 diff --git a/Items/Weapons/Contagion.cs b/Items/Weapons/Contagion.cs index 7d6ce91fcb..8cc02bc2f4 100644 --- a/Items/Weapons/Contagion.cs +++ b/Items/Weapons/Contagion.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 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"); } - public override void SetDefaults() - { - item.damage = 300; - 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 = 10000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Contagion"); - item.shootSpeed = 20f; - 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(255, 0, 255); - } - } - } - - 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; - } - } + public override void SetDefaults() + { + item.damage = 300; + 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 = 10000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Contagion"); + item.shootSpeed = 20f; + 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(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/CoralSpout.cs b/Items/Weapons/CoralSpout.cs index c1c1464af3..27b7497417 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 = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = 50000; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 13; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = 50000; + 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 diff --git a/Items/Weapons/CosmicBolter.cs b/Items/Weapons/CosmicBolter.cs index 22a2775a93..dfb00e9451 100644 --- a/Items/Weapons/CosmicBolter.cs +++ b/Items/Weapons/CosmicBolter.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class CosmicBolter : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); } - public override void SetDefaults() - { - item.damage = 60; - item.ranged = true; - item.width = 40; - item.height = 76; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = 300000; - item.rare = 7; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt2"); - item.shootSpeed = 10f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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("LunarBolt2"), (int)((double)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(null, "LunarianBow"); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 60; + item.ranged = true; + item.width = 40; + item.height = 76; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = 300000; + item.rare = 7; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt2"); + item.shootSpeed = 10f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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("LunarBolt2"), (int)((double)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(null, "LunarianBow"); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/CosmicDischarge.cs b/Items/Weapons/CosmicDischarge.cs index 7b424b74d0..a224ad2a23 100644 --- a/Items/Weapons/CosmicDischarge.cs +++ b/Items/Weapons/CosmicDischarge.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 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 = 1050; - 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 = 5000000; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("CosmicDischarge"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(150, Main.DiscoG, 255); - } - } - } - - public override bool 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, 0.0f, ai3); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 1050; + 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 = 5000000; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("CosmicDischarge"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(150, Main.DiscoG, 255); + } + } + } + + public override bool 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, 0.0f, ai3); + return false; + } + } +} diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs index 280b5f4558..315795889f 100644 --- a/Items/Weapons/CosmicImmaterializer.cs +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -1,123 +1,123 @@ -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" + - "While summoned you will take 25% less damage from projectiles\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 = 0; - item.useStyle = 1; - item.width = 74; - item.height = 72; - item.useTime = 36; - item.useAnimation = 36; - item.noMelee = true; - item.knockBack = 0f; - item.value = 100000000; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CosmicEnergy"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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) - { - 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, damage, 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(); - } - } +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" + + "While summoned you will take 25% less damage from projectiles\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 = 0; + item.useStyle = 1; + item.width = 74; + item.height = 72; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 0f; + item.value = 100000000; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CosmicEnergy"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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) + { + 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, damage, 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 diff --git a/Items/Weapons/CosmicKunai.cs b/Items/Weapons/CosmicKunai.cs index 1f8835649e..3e2df624a5 100644 --- a/Items/Weapons/CosmicKunai.cs +++ b/Items/Weapons/CosmicKunai.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 CosmicKunai : 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 CosmicKunai : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Kunai"); Tooltip.SetDefault("Fires a stream of short-range kunai"); } - public override void SetDefaults() - { - item.width = 26; - item.damage = 108; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 1; - item.useAnimation = 5; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 48; - item.value = 1500000; - item.shoot = mod.ProjectileType("CosmicKunai"); - item.shootSpeed = 28f; - item.rare = 9; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } -} + public override void SetDefaults() + { + item.width = 26; + item.damage = 108; + item.thrown = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 1; + item.useAnimation = 5; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 48; + item.value = 1500000; + item.shoot = mod.ProjectileType("CosmicKunai"); + item.shootSpeed = 28f; + item.rare = 9; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } +} diff --git a/Items/Weapons/CosmicRainbow.cs b/Items/Weapons/CosmicRainbow.cs index 14126ca5e3..15dbdcfbd6 100644 --- a/Items/Weapons/CosmicRainbow.cs +++ b/Items/Weapons/CosmicRainbow.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class CosmicRainbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Rainbow"); Tooltip.SetDefault("Launch 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 = 0.5f; - item.value = 1550000; - item.rare = 10; - item.UseSound = SoundID.Item67; - item.autoReuse = true; - item.shoot = 250; - item.shootSpeed = 18f; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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) - { - 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(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(-360, 361) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override void 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 = 0.5f; + item.value = 1550000; + item.rare = 10; + item.UseSound = SoundID.Item67; + item.autoReuse = true; + item.shoot = 250; + item.shootSpeed = 18f; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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) + { + 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(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(-360, 361) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs index fb2938ce6b..4cb970a84b 100644 --- a/Items/Weapons/Cosmilamp.cs +++ b/Items/Weapons/Cosmilamp.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.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 = 150; //80 - 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 = 1550000; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Cosmilamp"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 = 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; - } - } + public override void SetDefaults() + { + item.damage = 150; //80 + 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 = 1550000; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Cosmilamp"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 = 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 diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs index 3a51232f03..bb6348ff95 100644 --- a/Items/Weapons/Crabulon/Fungicide.cs +++ b/Items/Weapons/Crabulon/Fungicide.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.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"); } - - 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; //so the item's animation doesn't do damage - item.knockBack = 2.5f; - item.value = 40000; - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FungiOrb"); //idk why but all the guns in the vanilla source have this - 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, 0.0f, 0.0f); - return false; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 2.5f; + item.value = 40000; + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FungiOrb"); //idk why but all the guns in the vanilla source have this + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index d427d2878d..86cc64fd5c 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.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.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; + +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 = 13; - item.magic = true; - item.mana = 7; - item.width = 34; - item.height = 34; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 4.25f; - item.value = 40000; - 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; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); - } - return false; - } - } + + public override void SetDefaults() + { + item.damage = 13; + item.magic = true; + item.mana = 7; + item.width = 34; + item.height = 34; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 4.25f; + item.value = 40000; + 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; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Crabulon/MycelialClaws.cs b/Items/Weapons/Crabulon/MycelialClaws.cs index 11caa968df..862c9806b9 100644 --- a/Items/Weapons/Crabulon/MycelialClaws.cs +++ b/Items/Weapons/Crabulon/MycelialClaws.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.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.maxStack = 1; - item.value = 40000; - 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.maxStack = 1; + item.value = 40000; + 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/Crabulon/Mycoroot.cs b/Items/Weapons/Crabulon/Mycoroot.cs index c55edbd3a0..fd6e349aed 100644 --- a/Items/Weapons/Crabulon/Mycoroot.cs +++ b/Items/Weapons/Crabulon/Mycoroot.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.Crabulon -{ - public class Mycoroot : 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 Mycoroot : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mycoroot"); Tooltip.SetDefault("Fires a stream of short-range fungal roots"); } - - public override void SetDefaults() - { - item.width = 32; //The width of the .png file in pixels divided by 2. - item.damage = 10; //Keep this reasonable please. - item.thrown = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 1; - item.knockBack = 1.75f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 32; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.rare = 2; - item.value = 40000; //Value is calculated in copper coins. - item.shoot = mod.ProjectileType("Mycoroot"); - item.shootSpeed = 20f; - } - - public override bool 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 SetDefaults() + { + item.width = 32; //The width of the .png file in pixels divided by 2. + item.damage = 10; //Keep this reasonable please. + item.thrown = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 1; + item.knockBack = 1.75f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 32; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.rare = 2; + item.value = 40000; //Value is calculated in copper coins. + item.shoot = mod.ProjectileType("Mycoroot"); + item.shootSpeed = 20f; + } + + public override bool 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/Weapons/Crimsaber.cs b/Items/Weapons/Crimsaber.cs index 864652042c..277ab32c43 100644 --- a/Items/Weapons/Crimsaber.cs +++ b/Items/Weapons/Crimsaber.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 Crimsaber : 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 Crimsaber : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crimsaber"); Tooltip.SetDefault("A sword fused with the blood of the gods"); } - public override void SetDefaults() - { - item.damage = 45; - item.melee = true; - item.width = 56; - item.height = 70; - item.useTime = 35; - item.useAnimation = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7; - item.value = 150000; - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 8f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrimtaneBar, 20); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.Ichor, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - if (target.type == NPCID.TargetDummy || target.type == NPCID.TheDestroyerBody) - { - return; - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 8; - 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; - int piss = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.GoldenShowerFriendly, damage, knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - Main.projectile[piss].magic = false; - Main.projectile[piss].melee = true; - } - } - - 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 SetDefaults() + { + item.damage = 45; + item.melee = true; + item.width = 56; + item.height = 70; + item.useTime = 35; + item.useAnimation = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7; + item.value = 150000; + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shootSpeed = 8f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrimtaneBar, 20); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.Ichor, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 60); + if (target.type == NPCID.TargetDummy || target.type == NPCID.TheDestroyerBody) + { + return; + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 8; + 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; + int piss = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.GoldenShowerFriendly, (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Main.projectile[piss].magic = false; + Main.projectile[piss].melee = true; + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/Crimsaber.png b/Items/Weapons/Crimsaber.png index edc553faab..b9316ac7a8 100644 Binary files a/Items/Weapons/Crimsaber.png and b/Items/Weapons/Crimsaber.png differ diff --git a/Items/Weapons/Cryogen/BittercoldStaff.cs b/Items/Weapons/Cryogen/BittercoldStaff.cs index bb72790404..a6a1c09304 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 = 650000; - 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; - } - } +using System; +using System.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 = 650000; + 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 diff --git a/Items/Weapons/Cryogen/EffluviumBow.cs b/Items/Weapons/Cryogen/EffluviumBow.cs index c906eb54e7..02327420b6 100644 --- a/Items/Weapons/Cryogen/EffluviumBow.cs +++ b/Items/Weapons/Cryogen/EffluviumBow.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 TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.Cryogen -{ - public class EffluviumBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effluvium Bow"); - } - - 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; //so the item's animation doesn't do damage - item.knockBack = 4f; - item.value = 425000; - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MistArrow"); - item.shootSpeed = 12f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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; - 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(-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("MistArrow"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.Cryogen +{ + public class EffluviumBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effluvium Bow"); + } + + 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; //so the item's animation doesn't do damage + item.knockBack = 4f; + item.value = 425000; + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MistArrow"); + item.shootSpeed = 12f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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; + 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(-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("MistArrow"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs index c6cd7ca359..671931f577 100644 --- a/Items/Weapons/Cryogen/GlacialCrusher.cs +++ b/Items/Weapons/Cryogen/GlacialCrusher.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.Items.Weapons.Cryogen { -public class GlacialCrusher : 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.Cryogen { +public class GlacialCrusher : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Glacial Crusher"); - } - - public override void SetDefaults() - { - item.width = 60; //The width of the .png file in pixels divided by 2. - item.damage = 59; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 27; - item.useTime = 27; //Ranges from 1 to 55. - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 58; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 450000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("Iceberg"); - item.shootSpeed = 12f; - } - - 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 OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } -}} + } + + public override void SetDefaults() + { + item.width = 60; //The width of the .png file in pixels divided by 2. + item.damage = 59; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.useAnimation = 27; + item.useTime = 27; //Ranges from 1 to 55. + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 58; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 450000; //Value is calculated in copper coins. + item.rare = 5; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("Iceberg"); + item.shootSpeed = 12f; + } + + 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 OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } +}} diff --git a/Items/Weapons/Cryogen/IceStar.cs b/Items/Weapons/Cryogen/IceStar.cs index cd5d1982a8..7ce79f115b 100644 --- a/Items/Weapons/Cryogen/IceStar.cs +++ b/Items/Weapons/Cryogen/IceStar.cs @@ -1,51 +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.Cryogen { -public class IceStar : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Star"); - Tooltip.SetDefault("Ice Stars are too brittle to be recovered after being thrown"); - } - - public override void SetDefaults() - { - item.width = 62; //The width of the .png file in pixels divided by 2. - item.damage = 35; //Keep this reasonable please. - item.thrown = true; //Dictates whether this is a melee-class weapon. - 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; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 62; //The height of the .png file in pixels divided by 2. - item.scale = 0.65f; - item.maxStack = 999; - item.value = 3000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("IceStarProjectile"); - item.shootSpeed = 14f; - } - - 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.Weapons.Cryogen +{ + public class IceStar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Star"); + Tooltip.SetDefault("Ice Stars are too brittle to be recovered after being thrown"); + } + + public override void SetDefaults() + { + item.width = 62; + item.damage = 35; + item.thrown = true; + 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; + } + + 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/Weapons/Cryogen/Icebreaker.cs b/Items/Weapons/Cryogen/Icebreaker.cs index dcc03aad60..9ab925950e 100644 --- a/Items/Weapons/Cryogen/Icebreaker.cs +++ b/Items/Weapons/Cryogen/Icebreaker.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.Cryogen -{ - public class Icebreaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icebreaker"); - } - - public override void SetDefaults() - { - item.width = 60; //The width of the .png file in pixels divided by 2. - item.damage = 57; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 6.75f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.melee = true; //Dictates whether the weapon can be "auto-fired". - item.height = 60; //The height of the .png file in pixels divided by 2. - item.value = 400000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("Icebreaker"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 11); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.Cryogen +{ + public class Icebreaker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icebreaker"); + } + + public override void SetDefaults() + { + item.width = 60; //The width of the .png file in pixels divided by 2. + item.damage = 57; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 6.75f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.melee = true; //Dictates whether the weapon can be "auto-fired". + item.height = 60; //The height of the .png file in pixels divided by 2. + item.value = 400000; //Value is calculated in copper coins. + item.rare = 5; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("Icebreaker"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 11); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Cryogen/Permafrost.cs b/Items/Weapons/Cryogen/Permafrost.cs index de44cd1da6..f906d4f259 100644 --- a/Items/Weapons/Cryogen/Permafrost.cs +++ b/Items/Weapons/Cryogen/Permafrost.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 Permafrost : ModItem -{ - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Permafrost"); - Tooltip.SetDefault("Spawns ice bombs that explode after 2 seconds into ice shards on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 64; //The width of the .png file in pixels divided by 2. - item.damage = 60; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 30; - item.useTime = 30; //Ranges from 1 to 55. - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.25f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 64; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 200000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int i = Main.myPlayer; - float num72 = 6f; - int num73 = Main.rand.Next(40, 50); - 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"), num73, 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 Permafrost : 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 = 200000; + 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/SnowstormStaff.cs b/Items/Weapons/Cryogen/SnowstormStaff.cs index a93448b1e0..4edc14884f 100644 --- a/Items/Weapons/Cryogen/SnowstormStaff.cs +++ b/Items/Weapons/Cryogen/SnowstormStaff.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.Cryogen { -public class SnowstormStaff : 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.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.scale = 0.8f; - item.useAnimation = 22; - item.useStyle = 1; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 5; - item.value = 450000; - 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(); - } + + 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.scale = 0.8f; + item.useAnimation = 22; + item.useStyle = 1; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 5; + item.value = 450000; + 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 diff --git a/Items/Weapons/CrystalBlade.cs b/Items/Weapons/CrystalBlade.cs index dacf920492..49944542a7 100644 --- a/Items/Weapons/CrystalBlade.cs +++ b/Items/Weapons/CrystalBlade.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 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"); } - public override void SetDefaults() - { - item.width = 66; - item.damage = 32; - 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 = 155000; - 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 = 32; + 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 = 155000; + 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 a5c4f24a88..c0a5bfd069 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 = 650000; - item.rare = 6; - 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(); - } - } + 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 = 650000; + item.rare = 6; + 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 diff --git a/Items/Weapons/CrystalPiercer.cs b/Items/Weapons/CrystalPiercer.cs index 722dadedcf..b188897b20 100644 --- a/Items/Weapons/CrystalPiercer.cs +++ b/Items/Weapons/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.Weapons -{ - public class CrystalPiercer : 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 CrystalPiercer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Piercer"); } - public override void SetDefaults() - { - item.width = 62; - item.damage = 43; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 62; + item.damage = 43; + item.thrown = true; + 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; + } + + 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/Weapons/Crystalline.cs b/Items/Weapons/Crystalline.cs index b221d17489..efe841eee2 100644 --- a/Items/Weapons/Crystalline.cs +++ b/Items/Weapons/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.Weapons -{ - public class Crystalline : 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 Crystalline : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystalline"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 18; - item.crit += 4; - item.thrown = true; - 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.maxStack = 1; - item.value = 52000; - item.rare = 2; - item.shoot = mod.ProjectileType("Crystalline"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ThrowingKnife, 50); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FallenStar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 18; + item.crit += 4; + item.thrown = true; + 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.maxStack = 1; + item.value = 52000; + item.rare = 2; + item.shoot = mod.ProjectileType("Crystalline"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ThrowingKnife, 50); + recipe.AddIngredient(ItemID.Diamond, 3); + recipe.AddIngredient(ItemID.FallenStar, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CursedCapper.cs b/Items/Weapons/CursedCapper.cs index 1563fc3ca5..5a9402f939 100644 --- a/Items/Weapons/CursedCapper.cs +++ b/Items/Weapons/CursedCapper.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 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"); } - public override void SetDefaults() - { - item.damage = 30; - 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 = 150000; - item.rare = 5; - item.UseSound = SoundID.Item41; - item.autoReuse = false; - item.shootSpeed = 14f; - item.shoot = mod.ProjectileType("CursedRound"); - 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("CursedRound"), damage, knockBack, player.whoAmI, 0.0f, 0.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(); - } - } + public override void SetDefaults() + { + item.damage = 30; + 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 = 150000; + item.rare = 5; + item.UseSound = SoundID.Item41; + item.autoReuse = false; + item.shootSpeed = 14f; + item.shoot = mod.ProjectileType("CursedRound"); + 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("CursedRound"), damage, knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/CursedDagger.cs b/Items/Weapons/CursedDagger.cs index 4c9b16bc92..8dafc6fece 100644 --- a/Items/Weapons/CursedDagger.cs +++ b/Items/Weapons/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.Weapons -{ - public class CursedDagger : 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 CursedDagger : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cursed Dagger"); } - public override void SetDefaults() - { - item.width = 34; - item.damage = 34; - item.thrown = true; - 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.maxStack = 1; - item.value = 300000; - item.rare = 5; - item.shoot = mod.ProjectileType("CursedDagger"); - item.shootSpeed = 12f; - } - } -} + public override void SetDefaults() + { + item.width = 34; + item.damage = 34; + item.thrown = true; + 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.maxStack = 1; + item.value = 300000; + item.rare = 5; + item.shoot = mod.ProjectileType("CursedDagger"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Weapons/DarkechoGreatbow.cs b/Items/Weapons/DarkechoGreatbow.cs index 1c7dc970f9..c222c59a82 100644 --- a/Items/Weapons/DarkechoGreatbow.cs +++ b/Items/Weapons/DarkechoGreatbow.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 TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class DarkechoGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Darkecho Greatbow"); } - public override void SetDefaults() - { - item.damage = 37; - 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 = 175000; - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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; - switch (Main.rand.Next(3)) - { - case 1: type = ProjectileID.UnholyArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[index].noDropItem = true; - } - 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(); - } - } + public override void SetDefaults() + { + item.damage = 37; + 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 = 175000; + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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; + switch (Main.rand.Next(3)) + { + case 1: type = ProjectileID.UnholyArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[index].noDropItem = true; + } + 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 diff --git a/Items/Weapons/DarklightGreatsword.cs b/Items/Weapons/DarklightGreatsword.cs index abc751a261..c3430c8792 100644 --- a/Items/Weapons/DarklightGreatsword.cs +++ b/Items/Weapons/DarklightGreatsword.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 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"); } - 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 = 300000; - 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, 0.0f, 0.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, 100); - } - } -} + 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 = 300000; + 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, 0.0f, 0.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, 100); + } + } +} diff --git a/Items/Weapons/DeathValley.cs b/Items/Weapons/DeathValley.cs index 57a9d4f373..1aa3d8ca82 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 = 5; - item.value = 500000; - 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(); - } - } + 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 = 5; + item.value = 500000; + 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 diff --git a/Items/Weapons/DemonicPitchfork.cs b/Items/Weapons/DemonicPitchfork.cs index fb148dbd83..3787f3e196 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 = 450000; - item.rare = 6; - 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(); - } - } + 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 = 450000; + item.rare = 6; + 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 diff --git a/Items/Weapons/DepthBlade.cs b/Items/Weapons/DepthBlade.cs index 365babae08..4fb70b9525 100644 --- a/Items/Weapons/DepthBlade.cs +++ b/Items/Weapons/DepthBlade.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; - -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\nThe 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 = 90000; - 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 = 90000; + 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 8be0af3c84..317742b750 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 = 35000; - 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"), damage, 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 = 35000; + 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 38d27e408d..98e3a00be2 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 = 10; - 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 = 35000; - 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; - } - } + + public override void SetDefaults() + { + item.damage = 10; + 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 = 35000; + 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 diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.cs b/Items/Weapons/DesertScourge/SeaboundStaff.cs index f462cc5483..9d797ec7e6 100644 --- a/Items/Weapons/DesertScourge/SeaboundStaff.cs +++ b/Items/Weapons/DesertScourge/SeaboundStaff.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.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 = 35000; - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrittleStar"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("BrittleStar"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + + 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 = 35000; + item.rare = 2; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrittleStar"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("BrittleStar"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/DesertScourge/StormSpray.cs b/Items/Weapons/DesertScourge/StormSpray.cs index 536db4f0e4..417aac5031 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 = 15; - 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 = 35000; - 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; - } - } + + public override void SetDefaults() + { + item.damage = 15; + 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 = 35000; + 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 diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs index 9c3ca46c50..b735046246 100644 --- a/Items/Weapons/Devastation.cs +++ b/Items/Weapons/Devastation.cs @@ -1,136 +1,136 @@ -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("Remnant of the big bang"); } - 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 = 1750000; - item.shoot = mod.ProjectileType("GalaxyBlast"); - item.shootSpeed = 16f; - } - - 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) - { - 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.CursedInferno, 200); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.Frostburn, 200); - } - } -} + 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 = 1750000; + item.shoot = mod.ProjectileType("GalaxyBlast"); + item.shootSpeed = 16f; + } + + 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) + { + 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.CursedInferno, 200); + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.Frostburn, 200); + } + } +} diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs index 3827a11de0..dc68f74e97 100644 --- a/Items/Weapons/DevilsDevastation.cs +++ b/Items/Weapons/DevilsDevastation.cs @@ -1,129 +1,129 @@ -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("Wielded by the progenitor of the underworld"); } - public override void SetDefaults() - { - item.width = 74; - item.damage = 359; - 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 = 10000000; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 28f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 SetDefaults() + { + item.width = 74; + item.damage = 359; + 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 = 10000000; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 28f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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); + } + } + } +} diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs index d7668f7db5..ee9b3e42ed 100644 --- a/Items/Weapons/DevourerofGods/DeathhailStaff.cs +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -1,118 +1,110 @@ -using System; -using System.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 DeathhailStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deathhail Staff"); - Tooltip.SetDefault("Rain death upon your foes!"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 100; - item.magic = true; - item.mana = 12; - item.width = 62; - item.height = 62; - item.useTime = 6; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4; - item.value = 1250000; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NebulaShot"); - item.shootSpeed = 18f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 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; - int projectile1 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("NebulaShot"), num73, num74, i, 0f, (float)Main.rand.Next(10)); - int projectile2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("IceBeam"), num73, num74, i, 0f, (float)Main.rand.Next(5)); - Main.projectile[projectile1].tileCollide = false; - Main.projectile[projectile1].ranged = false; - Main.projectile[projectile1].magic = true; - Main.projectile[projectile1].timeLeft = 200; - Main.projectile[projectile2].tileCollide = false; - Main.projectile[projectile2].ranged = false; - Main.projectile[projectile2].magic = true; - Main.projectile[projectile2].timeLeft = 200; - } - 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.DevourerofGods +{ + public class DeathhailStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathhail Staff"); + Tooltip.SetDefault("Rain death upon your foes!"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 100; + item.magic = true; + item.mana = 12; + item.width = 62; + item.height = 62; + item.useTime = 6; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4; + item.value = 1250000; + item.UseSound = SoundID.Item12; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MagicNebulaShot"); + item.shootSpeed = 18f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 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)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("MagicIceBeam"), num73, num74, i, 0f, (float)Main.rand.Next(5)); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs index 34b39499a3..778ffe75f8 100644 --- a/Items/Weapons/DevourerofGods/Deathwind.cs +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -1,78 +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 TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.DevourerofGods -{ - public class Deathwind : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deathwind"); - } - - public override void SetDefaults() - { - item.damage = 200; - item.ranged = true; - item.width = 38; - item.height = 66; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = 1250000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NebulaShot"); - item.shootSpeed = 20f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 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 (Main.rand.Next(3) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("IceBeam"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.DevourerofGods +{ + public class Deathwind : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathwind"); + } + + public override void SetDefaults() + { + item.damage = 200; + item.ranged = true; + item.width = 38; + item.height = 66; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = 1250000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NebulaShot"); + item.shootSpeed = 20f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 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) + { + if (Main.rand.Next(3) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("IceBeam"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + } + else + { + int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num121].noDropItem = true; + } + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/Eradicator.cs b/Items/Weapons/DevourerofGods/Eradicator.cs index f622d0ed3f..4b66ad045f 100644 --- a/Items/Weapons/DevourerofGods/Eradicator.cs +++ b/Items/Weapons/DevourerofGods/Eradicator.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.DevourerofGods -{ - public class Eradicator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 450; - 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.thrown = true; - item.height = 54; - item.value = 1250000; - item.shoot = mod.ProjectileType("EradicatorProjectile"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.DevourerofGods +{ + public class Eradicator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + item.width = 38; + item.damage = 450; + 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.thrown = true; + item.height = 54; + item.value = 1250000; + item.shoot = mod.ProjectileType("EradicatorProjectile"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } +} diff --git a/Items/Weapons/DevourerofGods/EradicatorMelee.cs b/Items/Weapons/DevourerofGods/EradicatorMelee.cs index b30472d460..dd23ef99fa 100644 --- a/Items/Weapons/DevourerofGods/EradicatorMelee.cs +++ b/Items/Weapons/DevourerofGods/EradicatorMelee.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.DevourerofGods -{ - public class EradicatorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 225; - 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 = 1250000; - item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.DevourerofGods +{ + public class EradicatorMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + item.width = 38; + item.damage = 225; + 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 = 1250000; + item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } +} diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs index ebc9df4f6f..0b3d78ed8a 100644 --- a/Items/Weapons/DevourerofGods/Excelsus.cs +++ b/Items/Weapons/DevourerofGods/Excelsus.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.DevourerofGods -{ - public class Excelsus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - Tooltip.SetDefault("Fires influx beams and summons laser fountains on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 70; - item.damage = 161; - 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 = 82; - item.value = 1250000; - item.shoot = 451; - item.shootSpeed = 18f; - } - - public override bool 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(5, 9); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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 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 influx beams and summons laser fountains on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 70; + item.damage = 161; + 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 = 82; + item.value = 1250000; + item.shoot = 451; + item.shootSpeed = 18f; + } + + public override bool 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(5, 9); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 536110decc..771b443e90 100644 --- a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -1,182 +1,182 @@ -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 = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = 1250000; - item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MechwormHead"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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; - } - } + + public override void SetDefaults() + { + item.damage = 30; + item.mana = 15; + item.width = 58; + item.height = 58; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = 1250000; + item.UseSound = SoundID.Item113; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MechwormHead"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Weapons/DevourerofGods/TheObliterator.cs b/Items/Weapons/DevourerofGods/TheObliterator.cs index e9402cbdd1..919008c045 100644 --- a/Items/Weapons/DevourerofGods/TheObliterator.cs +++ b/Items/Weapons/DevourerofGods/TheObliterator.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.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 = 88; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = 1250000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TheObliterator"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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); - 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.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 = 88; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7.5f; + item.value = 1250000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TheObliterator"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/DraconicDestruction.cs b/Items/Weapons/DraconicDestruction.cs index d953861e1a..3694d10f98 100644 --- a/Items/Weapons/DraconicDestruction.cs +++ b/Items/Weapons/DraconicDestruction.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; - -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\nAdditional beams fly up and down to shred enemies"); } - public override void SetDefaults() - { - item.width = 94; - item.damage = 150; - 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 = 10000000; - item.shoot = mod.ProjectileType("DracoBeam"); - item.shootSpeed = 14f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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.OnFire, 500); - } - } -} + public override void SetDefaults() + { + item.width = 94; + item.damage = 150; + 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 = 10000000; + item.shoot = mod.ProjectileType("DracoBeam"); + item.shootSpeed = 14f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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.OnFire, 500); + } + } +} diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs index f408c29349..292edbba52 100644 --- a/Items/Weapons/DraedonsExoblade.cs +++ b/Items/Weapons/DraedonsExoblade.cs @@ -1,151 +1,151 @@ -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 = 2100; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 114; - item.value = 100000000; - item.shoot = mod.ProjectileType("Exobeam"); - item.shootSpeed = 19f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override void GetWeaponDamage(Player player, ref int damage) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - float damageAdd = ((float)lifeAmount + 2100f); - 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"), damage, knockback, Main.myPlayer); - } - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 500); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 200); - target.AddBuff(mod.BuffType("GlacialState"), 200); - target.AddBuff(mod.BuffType("Plague"), 200); - target.AddBuff(mod.BuffType("HolyLight"), 200); - target.AddBuff(BuffID.CursedInferno, 200); - target.AddBuff(BuffID.Frostburn, 200); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.Ichor, 200); - 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"), damage, knockback, player.whoAmI, 0.0f, ai1); - } - } - if (target.type == NPCID.TargetDummy) - { - return; - } - int healAmount = (Main.rand.Next(10) + 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, "Terracotta"); - 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 = 2500; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.useTurn = true; + item.melee = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 114; + item.value = 100000000; + item.shoot = mod.ProjectileType("Exobeam"); + item.shootSpeed = 19f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override void GetWeaponDamage(Player player, ref int damage) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + float damageAdd = ((float)lifeAmount + 2100f); + 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); + } + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 500); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 200); + target.AddBuff(mod.BuffType("GlacialState"), 200); + target.AddBuff(mod.BuffType("Plague"), 200); + target.AddBuff(mod.BuffType("HolyLight"), 200); + target.AddBuff(BuffID.CursedInferno, 200); + target.AddBuff(BuffID.Frostburn, 200); + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.Ichor, 200); + 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, 0.0f, ai1); + } + } + if (target.type == NPCID.TargetDummy) + { + return; + } + int healAmount = (Main.rand.Next(10) + 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, "Terracotta"); + 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 bd6cda7de7..c608d888b0 100644 --- a/Items/Weapons/Drataliornus.cs +++ b/Items/Weapons/Drataliornus.cs @@ -1,119 +1,119 @@ -using System; -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 = 360; - 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.rare = 15; - item.value = Item.sellPrice(18, 0, 0, 0); - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.Arrow; - item.autoReuse = true; - } - - 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 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 = 360; + 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.rare = 15; + item.value = Item.sellPrice(18, 0, 0, 0); + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.useTurn = false; + item.useAmmo = AmmoID.Arrow; + item.autoReuse = true; + } + + 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 f64cd61757..790573668d 100644 --- a/Items/Weapons/Dualpoon.cs +++ b/Items/Weapons/Dualpoon.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 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"); } - 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 = 300000; - item.rare = 5; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("Triploon"); - } - - public override bool 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 *= 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; - } - 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.SoulofMight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + 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 = 300000; + item.rare = 5; + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("Triploon"); + } + + public override bool 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 *= 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; + } + 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.SoulofMight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs index 0a05a50e73..14968406f6 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,103 +22,103 @@ namespace CalamityMod.Items.Weapons "Green meteors spawn healing orbs"); } - public override void SetDefaults() - { - item.width = 92; - item.damage = 300; - 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 = 69696969; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - if (Main.rand.Next(3) == 0) - { - target.defense -= 50; - } - int heal = Main.rand.Next(20, 69); - player.statLife += heal; - player.HealEffect(heal); - 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"), damage, knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - } - - 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 = 300; + 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 = 69696969; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + if (Main.rand.Next(3) == 0) + { + target.defense -= 50; + } + int heal = Main.rand.Next(20, 69); + player.statLife += heal; + player.HealEffect(heal); + 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)); + } + } + + 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 8139949d43..523c92c0b8 100644 --- a/Items/Weapons/EarthenPike.cs +++ b/Items/Weapons/EarthenPike.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 -{ - 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"); } - 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 = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 60; - item.value = 300000; - 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 = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 60; + item.value = 300000; + item.rare = 5; + item.shoot = mod.ProjectileType("EarthenPike"); + item.shootSpeed = 6f; + } + } +} diff --git a/Items/Weapons/Effervescence.cs b/Items/Weapons/Effervescence.cs index 1da5c869a4..206859e291 100644 --- a/Items/Weapons/Effervescence.cs +++ b/Items/Weapons/Effervescence.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 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"); } - 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 = 1000000; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = mod.ProjectileType("UberBubble"); - } - - 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 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(); - } - } + 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 = 1000000; + item.UseSound = SoundID.Item95; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = mod.ProjectileType("UberBubble"); + } + + 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 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 diff --git a/Items/Weapons/ElementalAxe.cs b/Items/Weapons/ElementalAxe.cs index 980f269476..6a779101df 100644 --- a/Items/Weapons/ElementalAxe.cs +++ b/Items/Weapons/ElementalAxe.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.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 = 10000000; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementalAxe"); - item.shootSpeed = 10f; - } - - 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 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; - } - } + 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 = 10000000; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementalAxe"); + item.shootSpeed = 10f; + } + + 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 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 diff --git a/Items/Weapons/ElementalBlaster.cs b/Items/Weapons/ElementalBlaster.cs index b6d9c44c46..61cdb0989a 100644 --- a/Items/Weapons/ElementalBlaster.cs +++ b/Items/Weapons/ElementalBlaster.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 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\nFires 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 = 1000000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("RainbowBlast"); - item.shootSpeed = 18f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 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); - } - } - } - - 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(); - } - } + 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 = 1000000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("RainbowBlast"); + item.shootSpeed = 18f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 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); + } + } + } + + 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 diff --git a/Items/Weapons/ElementalEruption.cs b/Items/Weapons/ElementalEruption.cs index 7c4278b4ac..146054c20f 100644 --- a/Items/Weapons/ElementalEruption.cs +++ b/Items/Weapons/ElementalEruption.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; - -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"); } - 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 = 10000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen2"); - item.shootSpeed = 10f; - item.useAmmo = 23; - } - - 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) - { - 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(); - } - } + 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 = 10000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraFireGreen2"); + item.shootSpeed = 10f; + item.useAmmo = 23; + } + + 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) + { + 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 diff --git a/Items/Weapons/ElementalRay.cs b/Items/Weapons/ElementalRay.cs index 8c27347912..7feb8f26a9 100644 --- a/Items/Weapons/ElementalRay.cs +++ b/Items/Weapons/ElementalRay.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 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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 178; - 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 = 10000000; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementRay"); - item.shootSpeed = 6f; - } - - 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 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(); - } - } + public override void SetDefaults() + { + item.damage = 178; + 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 = 10000000; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementRay"); + item.shootSpeed = 6f; + } + + 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 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 diff --git a/Items/Weapons/ElementalShortsword.cs b/Items/Weapons/ElementalShortsword.cs index f2b3167319..46e55278e8 100644 --- a/Items/Weapons/ElementalShortsword.cs +++ b/Items/Weapons/ElementalShortsword.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 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"); } - 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 = 10000000; - } - - 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 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"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } -} + 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 = 10000000; + } + + 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 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"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } +} diff --git a/Items/Weapons/ElysianArrow.cs b/Items/Weapons/ElysianArrow.cs index 6d7ee68639..eddf644f8f 100644 --- a/Items/Weapons/ElysianArrow.cs +++ b/Items/Weapons/ElysianArrow.cs @@ -1,55 +1,55 @@ -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; - } - - 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 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(); - } - } + 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; + } + + 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 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 diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs index dd3a537578..b19e1e4403 100644 --- a/Items/Weapons/EmpyreanKnives.cs +++ b/Items/Weapons/EmpyreanKnives.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 800; - 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 = 4000000; - item.shoot = mod.ProjectileType("EmpyreanKnives"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 800; + 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 = 4000000; + item.shoot = mod.ProjectileType("EmpyreanKnives"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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/EmpyreanKnivesThrown.cs b/Items/Weapons/EmpyreanKnivesThrown.cs index 62d95f1bec..28c947ca1d 100644 --- a/Items/Weapons/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/EmpyreanKnivesThrown.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class EmpyreanKnivesThrown : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Empyrean Knives"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 600; - item.thrown = 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 = 4000000; - item.shoot = mod.ProjectileType("EmpyreanKnives"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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.Weapons +{ + public class EmpyreanKnivesThrown : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Empyrean Knives"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 600; + item.thrown = 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 = 4000000; + item.shoot = mod.ProjectileType("EmpyreanKnives"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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/Weapons/EnergyStaff.cs b/Items/Weapons/EnergyStaff.cs index 7e4d39c289..2141d764ca 100644 --- a/Items/Weapons/EnergyStaff.cs +++ b/Items/Weapons/EnergyStaff.cs @@ -1,88 +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 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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 231; - 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 = 500000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ProfanedEnergy"); - item.shootSpeed = 9f; - } - - 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 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; - for (int x = 0; x < 1000; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("ProfanedEnergy")) - { - projectile.Kill(); - } - } - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("ProfanedEnergy"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override void SetDefaults() + { + item.damage = 231; + 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 = 500000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ProfanedEnergy"); + } + + 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 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 diff --git a/Items/Weapons/EnhancedNanoRound.cs b/Items/Weapons/EnhancedNanoRound.cs index 8ea89394ad..392c736dcd 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 = 1; - 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(); - } - } + 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 = 1; + 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 diff --git a/Items/Weapons/EssenceFlayer.cs b/Items/Weapons/EssenceFlayer.cs index 0663a20067..07386696dd 100644 --- a/Items/Weapons/EssenceFlayer.cs +++ b/Items/Weapons/EssenceFlayer.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 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 = 280; - 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 = 1350000; - item.shoot = mod.ProjectileType("EssenceScythe"); - item.shootSpeed = 21f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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"), 500); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 280; + 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 = 1350000; + item.shoot = mod.ProjectileType("EssenceScythe"); + item.shootSpeed = 21f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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"), 500); + } + } +} diff --git a/Items/Weapons/EvergladeSpray.cs b/Items/Weapons/EvergladeSpray.cs index 4c9050df5c..7606aab366 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 = 550000; - item.rare = 6; - 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(); - } - } + 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 = 550000; + item.rare = 6; + 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 diff --git a/Items/Weapons/ExcaliburShortsword.cs b/Items/Weapons/ExcaliburShortsword.cs index f4978a9994..7d14961ee7 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 = 500000; - 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 = 500000; + 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/ExecutionersBlade.cs b/Items/Weapons/ExecutionersBlade.cs index 5151dc6dd6..807eaae76e 100644 --- a/Items/Weapons/ExecutionersBlade.cs +++ b/Items/Weapons/ExecutionersBlade.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 ExecutionersBlade : 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 ExecutionersBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Executioner's Blade"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 550; - item.thrown = true; - 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 = 1350000; - item.shoot = mod.ProjectileType("ExecutionersBlade"); - item.shootSpeed = 26f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 SetDefaults() + { + item.width = 50; + item.damage = 550; + item.thrown = true; + 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 = 1350000; + item.shoot = mod.ProjectileType("ExecutionersBlade"); + item.shootSpeed = 26f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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/Weapons/ExsanguinationLance.cs b/Items/Weapons/ExsanguinationLance.cs index 7e53f90ca9..775b0a5601 100644 --- a/Items/Weapons/ExsanguinationLance.cs +++ b/Items/Weapons/ExsanguinationLance.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 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"); } - 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 = 385000; - 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 = 385000; + 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 c73c5d245d..e06e21c29e 100644 --- a/Items/Weapons/Fabstaff.cs +++ b/Items/Weapons/Fabstaff.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 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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 330; - 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 = 100000000; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FabRay"); - item.shootSpeed = 6f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, 100, 255); - } - } - } - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 330; + 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 = 100000000; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FabRay"); + item.shootSpeed = 6f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, 100, 255); + } + } + } + + 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 diff --git a/Items/Weapons/FeatherKnife.cs b/Items/Weapons/FeatherKnife.cs index af6bda4d06..892e1deb02 100644 --- a/Items/Weapons/FeatherKnife.cs +++ b/Items/Weapons/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.Weapons -{ - public class FeatherKnife : 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 FeatherKnife : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Feather Knife"); } - public override void SetDefaults() - { - item.width = 18; - item.damage = 17; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 18; + item.damage = 17; + item.thrown = true; + 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; + } + + 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/Weapons/FellerofEvergreens.cs b/Items/Weapons/FellerofEvergreens.cs index 68e1a29636..dc36bda0ca 100644 --- a/Items/Weapons/FellerofEvergreens.cs +++ b/Items/Weapons/FellerofEvergreens.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 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 = 30000; - 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.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.AddIngredient(ItemID.SilverBar, 10); - recipe.AddIngredient(ItemID.SilverAxe); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + 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 = 30000; + 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.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.AddIngredient(ItemID.SilverBar, 10); + recipe.AddIngredient(ItemID.SilverAxe); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/FeralthornClaymore.cs b/Items/Weapons/FeralthornClaymore.cs index 4a05ba3acd..d69250a8d9 100644 --- a/Items/Weapons/FeralthornClaymore.cs +++ b/Items/Weapons/FeralthornClaymore.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.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"); } - public override void SetDefaults() - { - item.width = 66; - item.damage = 63; - item.melee = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.height = 66; - item.value = 355000; - item.rare = 6; - item.shoot = 8; - item.shootSpeed = 16f; - } - - 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 bool 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 thorn = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[thorn].magic = false; - Main.projectile[thorn].melee = true; - 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, 44); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 200); - } - } -} + public override void SetDefaults() + { + item.width = 66; + item.damage = 63; + item.melee = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.useTurn = true; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.height = 66; + item.value = 355000; + item.rare = 6; + item.shoot = 8; + item.shootSpeed = 16f; + } + + 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 bool 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 thorn = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[thorn].magic = false; + Main.projectile[thorn].melee = true; + 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, 44); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 200); + } + } +} diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 970ab71c4a..c58fc809ce 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.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 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\nRight click to change modes"); } - 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 = 50000; - item.rare = 3; - 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(); - } - } + 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 = 50000; + item.rare = 3; + 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 diff --git a/Items/Weapons/FlameScythe.cs b/Items/Weapons/FlameScythe.cs index 0c702a164e..d1823dff1c 100644 --- a/Items/Weapons/FlameScythe.cs +++ b/Items/Weapons/FlameScythe.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 FlameScythe : 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 FlameScythe : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flame Scythe"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 130; - 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.thrown = true; - item.height = 48; - item.value = 800000; - item.rare = 8; - item.shoot = mod.ProjectileType("FlameScytheProjectile"); - 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 = 130; + 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.thrown = true; + item.height = 48; + item.value = 800000; + item.rare = 8; + item.shoot = mod.ProjectileType("FlameScytheProjectile"); + 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/FlameScytheMelee.cs b/Items/Weapons/FlameScytheMelee.cs index e36acada5e..bc5421d2bb 100644 --- a/Items/Weapons/FlameScytheMelee.cs +++ b/Items/Weapons/FlameScytheMelee.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 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"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 130; - 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 = 800000; - 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 = 130; + 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 = 800000; + 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 f9ccda3b94..e07f6a79a1 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 = 20000; - item.rare = 4; - } - - 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, damage, 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 = 20000; + item.rare = 4; + } + + 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 a229b00cf8..9061659ebb 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 = 90000; - 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(); - } - } + 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 = 90000; + 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 diff --git a/Items/Weapons/FlareBolt.png b/Items/Weapons/FlareBolt.png index 70054e25d1..57591d05df 100644 Binary files a/Items/Weapons/FlareBolt.png and b/Items/Weapons/FlareBolt.png differ diff --git a/Items/Weapons/FlarefrostBlade.cs b/Items/Weapons/FlarefrostBlade.cs index 9b61b9ecd4..bfedf064e3 100644 --- a/Items/Weapons/FlarefrostBlade.cs +++ b/Items/Weapons/FlarefrostBlade.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 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"); } - 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 = 500000; - 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, 200); - target.AddBuff(BuffID.Frostburn, 200); - } - } -} + 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 = 500000; + 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, 200); + target.AddBuff(BuffID.Frostburn, 200); + } + } +} diff --git a/Items/Weapons/FlarewingBow.cs b/Items/Weapons/FlarewingBow.cs index e4293057cb..e00c0d2b95 100644 --- a/Items/Weapons/FlarewingBow.cs +++ b/Items/Weapons/FlarewingBow.cs @@ -1,89 +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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class FlarewingBow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flarewing Bow"); } - 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 = 200000; - item.rare = 7; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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; - } - int num122 = type; - if (num122 == ProjectileID.WoodenArrowFriendly) - { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("FlareBat"), (int)((double)damage * 1.5f), 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(); - } - } + 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 = 200000; + item.rare = 7; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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.5f), 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 diff --git a/Items/Weapons/FlashBullet.cs b/Items/Weapons/FlashBullet.cs index afdd16b6e9..e746ced27d 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(); - } - } + 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 diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs index 43c6fdaa68..7bca626a8e 100644 --- a/Items/Weapons/Floodtide.cs +++ b/Items/Weapons/Floodtide.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 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; + +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 = 170000; - item.rare = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = 408; - item.shootSpeed = 11f; - } - - 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(); - } - } + 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 = 170000; + item.rare = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shoot = 408; + item.shootSpeed = 11f; + } + + 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 diff --git a/Items/Weapons/ForbiddenOathblade.cs b/Items/Weapons/ForbiddenOathblade.cs index e956e81a12..a6a4c12be2 100644 --- a/Items/Weapons/ForbiddenOathblade.cs +++ b/Items/Weapons/ForbiddenOathblade.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 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("Sword of an ancient demon god"); } - 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 = 500000; - item.rare = 6; - 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); - } - } -} + 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 = 500000; + item.rare = 6; + 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); + } + } +} diff --git a/Items/Weapons/ForbiddenOathblade.png b/Items/Weapons/ForbiddenOathblade.png index 605fc208d0..a0705d7c37 100644 Binary files a/Items/Weapons/ForbiddenOathblade.png and b/Items/Weapons/ForbiddenOathblade.png differ diff --git a/Items/Weapons/ForbiddenSun.cs b/Items/Weapons/ForbiddenSun.cs index bec7236b2e..a646f04065 100644 --- a/Items/Weapons/ForbiddenSun.cs +++ b/Items/Weapons/ForbiddenSun.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 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"); } - 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 = 500000; - 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(); - } - } + 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 = 500000; + 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 diff --git a/Items/Weapons/ForsakenSaber.cs b/Items/Weapons/ForsakenSaber.cs index fc4dff1e7d..911a0bdf3a 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"); } - public override void SetDefaults() - { - item.width = 54; - item.damage = 65; - item.melee = true; - item.useAnimation = 23; - item.useStyle = 1; - item.useTime = 23; - item.useTurn = true; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; - item.maxStack = 1; - item.value = 350000; - 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 = 23; + item.useStyle = 1; + item.useTime = 23; + item.useTurn = true; + item.knockBack = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 52; + item.maxStack = 1; + item.value = 350000; + 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 87310f9d4f..813fd92da4 100644 --- a/Items/Weapons/FourSeasonsGalaxia.cs +++ b/Items/Weapons/FourSeasonsGalaxia.cs @@ -1,160 +1,160 @@ -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\nUpon hitting an enemy you are granted a buff based on what biome you're in\nProjectiles also change based on moon events"); } - public override void SetDefaults() - { - item.width = 70; - item.damage = 336; - 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 = 10000000; - item.shoot = mod.ProjectileType("Galaxia"); - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 = 336; + 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 = 10000000; + item.shoot = mod.ProjectileType("Galaxia"); + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 b450aecf04..ab5c9a2be0 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 = 500000; - 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(); - } - } + 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 = 500000; + 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 diff --git a/Items/Weapons/FrigidflashBolt.png b/Items/Weapons/FrigidflashBolt.png index d813f81f41..cd2fb12666 100644 Binary files a/Items/Weapons/FrigidflashBolt.png and b/Items/Weapons/FrigidflashBolt.png differ diff --git a/Items/Weapons/FrostBolt.cs b/Items/Weapons/FrostBolt.cs index 339fa4544a..0a4931a543 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 = 30000; - 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(); - } - } + 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 = 30000; + 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 diff --git a/Items/Weapons/FrostBolt.png b/Items/Weapons/FrostBolt.png index c9f41df048..e36b2d962b 100644 Binary files a/Items/Weapons/FrostBolt.png and b/Items/Weapons/FrostBolt.png differ diff --git a/Items/Weapons/FrostsparkBullet.cs b/Items/Weapons/FrostsparkBullet.cs index 1a8a76e091..fd68d44758 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 = 5; - 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(); - } - } + 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 = 5; + 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 diff --git a/Items/Weapons/FulgurationHalberd.cs b/Items/Weapons/FulgurationHalberd.cs index 38f5d8be7c..4daa308110 100644 --- a/Items/Weapons/FulgurationHalberd.cs +++ b/Items/Weapons/FulgurationHalberd.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 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"); } - 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 = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = 125000; - item.rare = 5; - } - - 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 = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.value = 125000; + item.rare = 5; + } + + 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/FulgurationHalberd.png b/Items/Weapons/FulgurationHalberd.png index 59439fcf1c..81505f7331 100644 Binary files a/Items/Weapons/FulgurationHalberd.png and b/Items/Weapons/FulgurationHalberd.png differ diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs index 803ea80168..9433409ed4 100644 --- a/Items/Weapons/GalacticaBlade.cs +++ b/Items/Weapons/GalacticaBlade.cs @@ -1,129 +1,129 @@ -using System; -using System.Collections.Generic; -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"); } - 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 = 6; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.height = 68; - item.value = 10000000; - item.shoot = mod.ProjectileType("GalacticaComet"); - item.shootSpeed = 23f; - } - - 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 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 = 6; + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.height = 68; + item.value = 10000000; + item.shoot = mod.ProjectileType("GalacticaComet"); + item.shootSpeed = 23f; + } + + 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 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 7633b2104c..77615dfd73 100644 --- a/Items/Weapons/Galeforce.cs +++ b/Items/Weapons/Galeforce.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 TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class Galeforce : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Galeforce"); } - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 32; - item.height = 52; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4; - item.value = 75000; - item.rare = 3; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 32; + item.height = 52; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4; + item.value = 75000; + item.rare = 3; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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 diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs index 58b6c99892..f563d42822 100644 --- a/Items/Weapons/GammaFusillade.cs +++ b/Items/Weapons/GammaFusillade.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 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 = 67; - 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 = 3; - item.value = 1250000; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GammaLaser"); - item.shootSpeed = 20f; - } - - 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 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(); - } - } + public override void SetDefaults() + { + item.damage = 67; + 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 = 3; + item.value = 1250000; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GammaLaser"); + item.shootSpeed = 20f; + } + + 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 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 diff --git a/Items/Weapons/Genisis.cs b/Items/Weapons/Genisis.cs index cbf5ebe122..3ec4fb32d5 100644 --- a/Items/Weapons/Genisis.cs +++ b/Items/Weapons/Genisis.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 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"); } - public override void SetDefaults() - { - item.damage = 52; - 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 = 10000000; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("BigBeamofDeath"); - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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); - } - } - } - - public override bool 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.75f), 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(); - } - } + public override void SetDefaults() + { + item.damage = 52; + 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 = 10000000; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("BigBeamofDeath"); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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); + } + } + } + + public override bool 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.75f), 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 diff --git a/Items/Weapons/GleamingMagnolia.cs b/Items/Weapons/GleamingMagnolia.cs index a5f3ba3e22..937358ce7b 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 = 200000; - 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(); - } - } + 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 = 200000; + 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 diff --git a/Items/Weapons/GoldenGun.cs b/Items/Weapons/GoldenGun.cs index 2fdd0e0ab4..24d4221566 100644 --- a/Items/Weapons/GoldenGun.cs +++ b/Items/Weapons/GoldenGun.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 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"); } - 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 = 50000; - 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, 0.0f, 0.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(); - } - } + 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 = 50000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/GoldplumeSpear.cs b/Items/Weapons/GoldplumeSpear.cs index 2e02c46623..05fe4be99a 100644 --- a/Items/Weapons/GoldplumeSpear.cs +++ b/Items/Weapons/GoldplumeSpear.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 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"); } - 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 = 85000; - 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 = 85000; + 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 abd2ba96ed..f8d76ea24f 100644 --- a/Items/Weapons/GrandGuardian.cs +++ b/Items/Weapons/GrandGuardian.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 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"); @@ -21,101 +21,101 @@ namespace CalamityMod.Items.Weapons "Enemies spawn healing orbs on death"); } - public override void SetDefaults() - { - item.width = 124; - item.damage = 200; - 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 = 5000000; - item.rare = 10; - item.shootSpeed = 12f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || target.type == mod.NPCType("DevourerofGodsBody") || target.type == mod.NPCType("DevourerofGodsBody2")) - { - return; - } - if (Main.rand.Next(2) == 0) - { - target.defense -= 30; - } - if (target.defense <= 0) - { - player.statLife += 12; - player.HealEffect(12); - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((double)damage * 0.33f), 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; - if (target.life <= (target.lifeMax * 0.5f)) - { - for (i = 0; i < 1; i++ ) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)damage * 0.5), knockback, Main.myPlayer); - int projectile2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)damage * 0.5), knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)damage * 0.5), knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; - } - } - if (target.life <= 0) - { - for (i = 0; i < 1; i++ ) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - 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("RainHeal"), 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("RainHeal"), damage, knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainHeal"), damage, knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; - } - } - } - - 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 = 200; + 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 = 5000000; + item.rare = 10; + item.shootSpeed = 12f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || target.type == mod.NPCType("DevourerofGodsBody") || target.type == mod.NPCType("DevourerofGodsBody2")) + { + return; + } + if (Main.rand.Next(2) == 0) + { + target.defense -= 30; + } + if (target.defense <= 0) + { + player.statLife += 12; + player.HealEffect(12); + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((double)((float)item.damage * player.meleeDamage) * 0.5), 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; + if (target.life <= (target.lifeMax * 0.5f)) + { + for (i = 0; i < 1; i++ ) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, Main.myPlayer); + int projectile2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainBolt"), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; + } + } + if (target.life <= 0) + { + for (i = 0; i < 1; i++ ) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + 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("RainHeal"), 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("RainHeal"), item.damage, knockback, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("RainHeal"), item.damage, knockback, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; + } + } + } + + 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 b7aa4ce874..8e4526625c 100644 --- a/Items/Weapons/Grax.cs +++ b/Items/Weapons/Grax.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 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 = 5000000; - } - - 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 void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(null, "DraedonBar", 5); - recipe.AddRecipeGroup("LunarAxe"); - 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 = 5000000; + } + + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FellerofEvergreens"); + recipe.AddIngredient(null, "DraedonBar", 5); + recipe.AddRecipeGroup("LunarAxe"); + 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/DuststormInABottle.cs b/Items/Weapons/GreatSandShark/DuststormInABottle.cs index 15469f4143..f9a3ee68b9 100644 --- a/Items/Weapons/GreatSandShark/DuststormInABottle.cs +++ b/Items/Weapons/GreatSandShark/DuststormInABottle.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 DuststormInABottle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm in a Bottle"); - Tooltip.SetDefault("Explodes into a dust cloud"); - } - - public override void SetDefaults() - { - item.width = 20; - item.damage = 47; - item.thrown = true; - 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.maxStack = 1; - item.value = 100000; - item.rare = 7; - item.shoot = mod.ProjectileType("DuststormInABottle"); - item.shootSpeed = 12f; - } - - 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.Weapons.GreatSandShark +{ + public class DuststormInABottle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm in a Bottle"); + Tooltip.SetDefault("Explodes into a dust cloud"); + } + + public override void SetDefaults() + { + item.width = 20; + item.damage = 47; + item.thrown = true; + 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.maxStack = 1; + item.value = 100000; + item.rare = 7; + item.shoot = mod.ProjectileType("DuststormInABottle"); + item.shootSpeed = 12f; + } + + 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/Weapons/GreatSandShark/SandSharknadoStaff.cs b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs index 9c796cf434..c27335f7d8 100644 --- a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs +++ b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs @@ -1,90 +1,90 @@ -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 = 100000; - item.rare = 9; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Sandnado"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - 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(); - } - } + + 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 = 100000; + item.rare = 9; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Sandnado"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + 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 diff --git a/Items/Weapons/GreatSandShark/Sandstorm.cs b/Items/Weapons/GreatSandShark/Sandstorm.cs index 9e5a3e1be5..d8bb6b40d8 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 = 100000; - 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, 0.0f, 0.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(); - } - } + 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 = 100000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/GreatSandShark/ShiftingSands.cs b/Items/Weapons/GreatSandShark/ShiftingSands.cs index dc3aa95dd0..908267baca 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 = 90; - 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 = 100000; - 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(); - } - } +using System; +using System.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 = 90; + 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 = 100000; + 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 diff --git a/Items/Weapons/GreatSandShark/Tumbleweed.cs b/Items/Weapons/GreatSandShark/Tumbleweed.cs index ed1640ae35..1bcc968636 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 = 100000; - 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(); - } - } + 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 = 100000; + 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 diff --git a/Items/Weapons/GreatbowofTurmoil.cs b/Items/Weapons/GreatbowofTurmoil.cs index 1f401651fe..be54abcc42 100644 --- a/Items/Weapons/GreatbowofTurmoil.cs +++ b/Items/Weapons/GreatbowofTurmoil.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 TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class GreatbowofTurmoil : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Greatbow of Turmoil"); } - public override void SetDefaults() - { - item.damage = 52; - 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 = 300000; - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 17f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 3; i++) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - switch (Main.rand.Next(6)) - { - case 1: type = ProjectileID.CursedArrow; break; - case 2: type = ProjectileID.HellfireArrow; break; - case 3: type = ProjectileID.IchorArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - 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(); - } - } + public override void SetDefaults() + { + item.damage = 52; + 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 = 300000; + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 17f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int i = 0; i < 3; i++) + { + float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; + switch (Main.rand.Next(6)) + { + case 1: type = ProjectileID.CursedArrow; break; + case 2: type = ProjectileID.HellfireArrow; break; + case 3: type = ProjectileID.IchorArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/GreatswordofBlah.cs b/Items/Weapons/GreatswordofBlah.cs index 106dc71f7b..a99456ce30 100644 --- a/Items/Weapons/GreatswordofBlah.cs +++ b/Items/Weapons/GreatswordofBlah.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 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"); @@ -20,45 +20,45 @@ namespace CalamityMod.Items.Weapons "I shall always be at your side, my lord'"); } - public override void SetDefaults() - { - item.width = 110; - item.damage = 410; - 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 = 10000000; - item.shoot = mod.ProjectileType("JudgementBlah"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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 = 410; + 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 = 10000000; + item.shoot = mod.ProjectileType("JudgementBlah"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 ea4497f277..1052e5dca2 100644 --- a/Items/Weapons/GreatswordofJudgement.cs +++ b/Items/Weapons/GreatswordofJudgement.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 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"); @@ -20,42 +20,42 @@ namespace CalamityMod.Items.Weapons "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 = 5000000; - item.shoot = mod.ProjectileType("Judgement"); - item.shootSpeed = 10f; - } - - 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 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 = 5000000; + item.shoot = mod.ProjectileType("Judgement"); + item.shootSpeed = 10f; + } + + 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 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 ad038beeeb..c5271cf59f 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 = 10000; - 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(); - } - } + 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 = 10000; + 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 diff --git a/Items/Weapons/HeartRapier.cs b/Items/Weapons/HeartRapier.cs index 813c5adaf7..38d00d4550 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 upon striking enemies"); } - 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 = 400000; - 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 = 400000; + 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 20f9e5fe8a..358f963ac1 100644 --- a/Items/Weapons/HeavenlyGale.cs +++ b/Items/Weapons/HeavenlyGale.cs @@ -1,117 +1,117 @@ -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 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; +//using TerrariaOverhaul; + +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 = 550; - 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 = 10000000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 550; + 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 = 10000000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 diff --git a/Items/Weapons/HellBurst.cs b/Items/Weapons/HellBurst.cs index dfcfe78094..e3c97566c6 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 = 600000; - 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(); - } - } + 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 = 600000; + 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 diff --git a/Items/Weapons/HellfireFlamberge.cs b/Items/Weapons/HellfireFlamberge.cs index cd004fe3aa..b1782cfcf3 100644 --- a/Items/Weapons/HellfireFlamberge.cs +++ b/Items/Weapons/HellfireFlamberge.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 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"); } - public override void SetDefaults() - { - item.width = 50; - 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 = 50; - item.value = 415000; - 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 = 50; + 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 = 50; + item.value = 415000; + 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 ebe2a14606..0fc8a21c87 100644 --- a/Items/Weapons/HellionFlowerSpear.cs +++ b/Items/Weapons/HellionFlowerSpear.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 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"); } - 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 = 355000; - item.rare = 6; - 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 = 355000; + item.rare = 6; + 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 dadf69ba4d..1870c03719 100644 --- a/Items/Weapons/Hellkite.cs +++ b/Items/Weapons/Hellkite.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 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"); } - public override void SetDefaults() - { - item.width = 84; - item.damage = 118; - 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 = 500000; - item.rare = 8; - } - - 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, 1800); - } - } -} + public override void SetDefaults() + { + item.width = 84; + item.damage = 118; + 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 = 500000; + item.rare = 8; + } + + 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, 1800); + } + } +} diff --git a/Items/Weapons/HellwingStaff.cs b/Items/Weapons/HellwingStaff.cs index 13edcf6329..7300e0dfca 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 = 18; - 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 = 55000; - item.rare = 4; - 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; - } - } + public override void SetDefaults() + { + item.damage = 18; + 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 = 55000; + item.rare = 4; + 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 diff --git a/Items/Weapons/HellwingStaff.png b/Items/Weapons/HellwingStaff.png index 5639180ceb..426e7cd2e1 100644 Binary files a/Items/Weapons/HellwingStaff.png and b/Items/Weapons/HellwingStaff.png differ diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index 81f0fe7871..0ce41cbeb4 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.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 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"); } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 70; - item.height = 36; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.knockBack = 2.5f; - item.value = 420000; - 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, 0.0f, 0.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); - } - } + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 70; + item.height = 36; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.knockBack = 2.5f; + item.value = 420000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/HiveMind/DankStaff.cs b/Items/Weapons/HiveMind/DankStaff.cs index 8b5dc24d40..27e6178643 100644 --- a/Items/Weapons/HiveMind/DankStaff.cs +++ b/Items/Weapons/HiveMind/DankStaff.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.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 = 55000; - 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 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("DankCreeper"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + + 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 = 55000; + 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 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("DankCreeper"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/HiveMind/LeechingDagger.cs b/Items/Weapons/HiveMind/LeechingDagger.cs index 200981e889..e8f0b4a85c 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 = 12000; - 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"), damage, 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 = 12000; + 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 57ce204c04..b772ea1884 100644 --- a/Items/Weapons/HiveMind/PerfectDark.cs +++ b/Items/Weapons/HiveMind/PerfectDark.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.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"); - } - - 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 = 50000; - item.rare = 4; - 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 = 50000; + item.rare = 4; + 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/RotBall.cs b/Items/Weapons/HiveMind/RotBall.cs index 1bc63548e0..bb20cababb 100644 --- a/Items/Weapons/HiveMind/RotBall.cs +++ b/Items/Weapons/HiveMind/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.Weapons.HiveMind -{ - public class RotBall : 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 RotBall : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Rot Ball"); - } - - public override void SetDefaults() - { - item.width = 26; - item.damage = 20; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 26; + item.damage = 20; + item.thrown = true; + 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; + } + + 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/Weapons/HiveMind/ShaderainStaff.cs b/Items/Weapons/HiveMind/ShaderainStaff.cs index 62ab1d0e70..ee9f128e8e 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 = 40000; - item.rare = 2; - 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(); - } - } + + 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 = 40000; + item.rare = 2; + 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 diff --git a/Items/Weapons/HiveMind/Shadethrower.cs b/Items/Weapons/HiveMind/Shadethrower.cs index 37a5948c9f..9e474f00b6 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 = 50000; - 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(); - } - } + + 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 = 50000; + 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 diff --git a/Items/Weapons/HiveMind/ShadowdropStaff.cs b/Items/Weapons/HiveMind/ShadowdropStaff.cs index 9526681ba0..4bb78adfae 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 = 50000; - item.rare = 2; - 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; - } - } + + 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 = 50000; + item.rare = 2; + 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 diff --git a/Items/Weapons/HolidayHalberd.cs b/Items/Weapons/HolidayHalberd.cs index 3517586991..7b9bc802bf 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"); } - public override void SetDefaults() - { - item.width = 64; - 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 = 66; - item.value = 800000; - 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) - { - switch (Main.rand.Next(6)) - { - case 1: type = mod.ProjectileType("RedBall"); break; - case 2: type = mod.ProjectileType("GreenBall"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 64; + 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 = 66; + item.value = 800000; + 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) + { + switch (Main.rand.Next(6)) + { + case 1: type = mod.ProjectileType("RedBall"); break; + case 2: type = mod.ProjectileType("GreenBall"); break; + default: break; + } + 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 af87ee4281..ed498f2f42 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 = 23; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 23; + 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 diff --git a/Items/Weapons/HyperiusBullet.cs b/Items/Weapons/HyperiusBullet.cs index 9c5794585f..c191889aab 100644 --- a/Items/Weapons/HyperiusBullet.cs +++ b/Items/Weapons/HyperiusBullet.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 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"); } - 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 = 1000; - 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(); - } - } + 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 = 1000; + 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 diff --git a/Items/Weapons/IchorSpear.cs b/Items/Weapons/IchorSpear.cs index b8d77100a1..9a8449bae3 100644 --- a/Items/Weapons/IchorSpear.cs +++ b/Items/Weapons/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.Weapons -{ - public class IchorSpear : 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 IchorSpear : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ichor Spear"); } - public override void SetDefaults() - { - item.width = 52; - item.damage = 40; - item.thrown = true; - 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 = 300000; - item.rare = 5; - item.shoot = mod.ProjectileType("IchorSpear"); - item.shootSpeed = 20f; - } - } -} + public override void SetDefaults() + { + item.width = 52; + item.damage = 40; + item.thrown = true; + 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 = 300000; + item.rare = 5; + item.shoot = mod.ProjectileType("IchorSpear"); + item.shootSpeed = 20f; + } + } +} diff --git a/Items/Weapons/IcicleStaff.cs b/Items/Weapons/IcicleStaff.cs index cbef8bf366..3f4bcf62ca 100644 --- a/Items/Weapons/IcicleStaff.cs +++ b/Items/Weapons/IcicleStaff.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 -{ - public class IcicleStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Staff"); - 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 = 4.25f; - item.value = 80000; - item.rare = 1; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WintersFury"); - item.shootSpeed = 11f; - } - - 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; - } - } +using System; +using System.Collections.Generic; +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"); + 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 = 4.25f; + item.value = 80000; + item.rare = 1; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WintersFury"); + item.shootSpeed = 11f; + } + + 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 diff --git a/Items/Weapons/Impaler.cs b/Items/Weapons/Impaler.cs index b0a34eea57..43fc526bb4 100644 --- a/Items/Weapons/Impaler.cs +++ b/Items/Weapons/Impaler.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 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"); } - public override void SetDefaults() - { - item.damage = 90; - 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 = 1050000; - item.rare = 9; - 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"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), (int)((double)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(); - } - } + public override void SetDefaults() + { + item.damage = 90; + 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 = 1050000; + item.rare = 9; + 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"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), (int)((double)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 diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs index eb41bba3ef..c73eea6848 100644 --- a/Items/Weapons/InfernaCutter.cs +++ b/Items/Weapons/InfernaCutter.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 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"); } - public override void SetDefaults() - { - item.damage = 85; - item.melee = true; - item.width = 60; - item.height = 46; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.axe = 27; - item.useStyle = 1; - item.knockBack = 7.75f; - item.value = 500000; - item.rare = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurityAxe"); - recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(4) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - if(Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } - } + public override void SetDefaults() + { + item.damage = 85; + item.melee = true; + item.width = 60; + item.height = 46; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.axe = 27; + item.useStyle = 1; + item.knockBack = 7.75f; + item.value = 500000; + item.rare = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurityAxe"); + recipe.AddIngredient(ItemID.SoulofFright, 8); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(4) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + if(Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/InfernalRift.cs b/Items/Weapons/InfernalRift.cs index f236505471..c85678a16f 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 = 42; - 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 = 600000; - item.rare = 6; - 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; - } - } + public override void SetDefaults() + { + item.damage = 42; + 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 = 600000; + item.rare = 6; + 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 diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs index 2abbee0a8e..50e41ca4fd 100644 --- a/Items/Weapons/Interfacer.cs +++ b/Items/Weapons/Interfacer.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; -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"); } - 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 = 3000000; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = 10; - item.useAmmo = 97; - } - - 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 Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 101) <= 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(); - } - } + 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 = 3000000; + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = 10; + item.useAmmo = 97; + } + + 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 Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 101) <= 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 diff --git a/Items/Weapons/IonBlaster.cs b/Items/Weapons/IonBlaster.cs index e58043a345..932897c6b1 100644 --- a/Items/Weapons/IonBlaster.cs +++ b/Items/Weapons/IonBlaster.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; - -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\nThe higher your mana the more damage they will do"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 25; - 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 = 750000; - item.rare = 6; - 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 = 25; + 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 = 750000; + item.rare = 6; + 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 40bd82749e..c38c82802a 100644 --- a/Items/Weapons/Judgement.cs +++ b/Items/Weapons/Judgement.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 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 = 385; - 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 = 10000000; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WhiteFlame"); - item.shootSpeed = 30f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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; - } - } + public override void SetDefaults() + { + item.damage = 385; + 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 = 10000000; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WhiteFlame"); + item.shootSpeed = 30f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/Lacerator.cs b/Items/Weapons/Lacerator.cs index 01da50ef30..a46d5449fa 100644 --- a/Items/Weapons/Lacerator.cs +++ b/Items/Weapons/Lacerator.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 Lacerator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lacerator"); - Tooltip.SetDefault("Enemies that are close to 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 = 700; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7f; - item.value = 1000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LaceratorProjectile"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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, type, damage, knockBack, player.whoAmI, 0.0f, 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 +{ + public class Lacerator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lacerator"); + Tooltip.SetDefault("Enemies that are close to 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 = 700; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7f; + item.value = 1000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LaceratorProjectile"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Lazhar.cs b/Items/Weapons/Lazhar.cs index 6f925966d0..264a9d01b6 100644 --- a/Items/Weapons/Lazhar.cs +++ b/Items/Weapons/Lazhar.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 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"); } - 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 = 1050000; - 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(); - } - } + 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 = 1050000; + 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 diff --git a/Items/Weapons/Leviathan/Atlantis.cs b/Items/Weapons/Leviathan/Atlantis.cs index 1fc366c47b..af9ff97dd7 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"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 45; - 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 = 600000; - 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(); - } - } + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 45; + 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 = 600000; + 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 diff --git a/Items/Weapons/Leviathan/BrackishFlask.cs b/Items/Weapons/Leviathan/BrackishFlask.cs index b87dab9e43..69bf439ca7 100644 --- a/Items/Weapons/Leviathan/BrackishFlask.cs +++ b/Items/Weapons/Leviathan/BrackishFlask.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 BrackishFlask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brackish Flask"); - Tooltip.SetDefault("Full of poisonous saltwater"); - } - - public override void SetDefaults() - { - item.width = 28; - item.damage = 42; - item.thrown = true; - 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.maxStack = 1; - item.value = 600000; - item.rare = 7; - item.shoot = mod.ProjectileType("BrackishFlask"); - item.shootSpeed = 12f; - } - - 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.Weapons.Leviathan +{ + public class BrackishFlask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brackish Flask"); + Tooltip.SetDefault("Full of poisonous saltwater"); + } + + public override void SetDefaults() + { + item.width = 28; + item.damage = 42; + item.thrown = true; + 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.maxStack = 1; + item.value = 600000; + item.rare = 7; + item.shoot = mod.ProjectileType("BrackishFlask"); + item.shootSpeed = 12f; + } + + 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 8edf9ba0a6..fc11bff88f 100644 --- a/Items/Weapons/Leviathan/Greentide.cs +++ b/Items/Weapons/Leviathan/Greentide.cs @@ -1,120 +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 = 750000; - 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; - 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 = 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"), num73, 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); - } - } - } + + 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 = 750000; + 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 diff --git a/Items/Weapons/Leviathan/Leviatitan.cs b/Items/Weapons/Leviathan/Leviatitan.cs index 78c1f0df80..48a951b1ee 100644 --- a/Items/Weapons/Leviathan/Leviatitan.cs +++ b/Items/Weapons/Leviathan/Leviatitan.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.Weapons.Leviathan -{ - public class Leviatitan : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviatitan"); - } - - public override void SetDefaults() - { - item.damage = 93; - item.ranged = true; - item.width = 82; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 5f; - item.value = 750000; - item.rare = 7; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquaBlast"); //idk why but all the guns in the vanilla source have this - 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(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - if (Main.rand.Next(3) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlastToxic"), (int)((double)damage * 1.5f), knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlast"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 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.Leviathan +{ + public class Leviatitan : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviatitan"); + } + + public override void SetDefaults() + { + item.damage = 93; + item.ranged = true; + item.width = 82; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 5f; + item.value = 750000; + item.rare = 7; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquaBlast"); //idk why but all the guns in the vanilla source have this + 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(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + if (Main.rand.Next(3) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlastToxic"), (int)((double)damage * 1.5f), knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlast"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.cs b/Items/Weapons/Leviathan/LureofEnthrallment.cs index 50025e5abc..ee24bb95d4 100644 --- a/Items/Weapons/Leviathan/LureofEnthrallment.cs +++ b/Items/Weapons/Leviathan/LureofEnthrallment.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.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 lure to fight for you\nThe lure 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 = 500000; - 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"), 0, 0f, 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(); - } - } + + public override void SetDefaults() + { + item.width = 56; + item.height = 56; + item.value = 500000; + 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"), 0, 0f, 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 diff --git a/Items/Weapons/Leviathan/SirensSong.cs b/Items/Weapons/Leviathan/SirensSong.cs index 2809fd24c8..f9379ac090 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 = 55; - 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 = 750000; - item.rare = 7; - item.UseSound = SoundID.Item26; - 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; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 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.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 = 55; + 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 = 750000; + item.rare = 7; + item.UseSound = SoundID.Item26; + 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; + 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 diff --git a/Items/Weapons/LifefruitScythe.cs b/Items/Weapons/LifefruitScythe.cs index 5dfbbd6923..ce99c08892 100644 --- a/Items/Weapons/LifefruitScythe.cs +++ b/Items/Weapons/LifefruitScythe.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 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"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 115; - 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 = 1250000; - item.shoot = mod.ProjectileType("LifeScythe"); - item.shootSpeed = 9f; - } - - 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 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) - { - return; - } - player.statLife += 3; - player.HealEffect(3); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 115; + 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 = 1250000; + item.shoot = mod.ProjectileType("LifeScythe"); + item.shootSpeed = 9f; + } + + 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 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) + { + return; + } + player.statLife += 3; + player.HealEffect(3); + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } +} diff --git a/Items/Weapons/Lucrecia.cs b/Items/Weapons/Lucrecia.cs index 431f88c97c..3ec1ab16ce 100644 --- a/Items/Weapons/Lucrecia.cs +++ b/Items/Weapons/Lucrecia.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; - -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\nStriking an enemy with the blade has a 50% chance to make you immune for a short time"); } - 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 = 3000000; - item.rare = 8; - } - - 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 (Main.rand.Next(2) == 0) - { - player.immune = true; - player.immuneTime = 15; - } - } - } -} + 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 = 3000000; + item.rare = 8; + } + + 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 (Main.rand.Next(2) == 0) + { + player.immune = true; + player.immuneTime = 15; + } + } + } +} diff --git a/Items/Weapons/LunarianBow.cs b/Items/Weapons/LunarianBow.cs index 5e846bdc94..232af48443 100644 --- a/Items/Weapons/LunarianBow.cs +++ b/Items/Weapons/LunarianBow.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; -//using TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class LunarianBow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lunarian Bow"); } - 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 = 300000; - item.rare = 5; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt"); - item.shootSpeed = 8f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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"), (int)((double)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(); - } - } + 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 = 300000; + item.rare = 5; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt"); + item.shootSpeed = 8f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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"), (int)((double)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 diff --git a/Items/Weapons/LunicEye.cs b/Items/Weapons/LunicEye.cs index 80f5be9e26..dcd5ed81c9 100644 --- a/Items/Weapons/LunicEye.cs +++ b/Items/Weapons/LunicEye.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 LunicEye : 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 LunicEye : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lunic Eye"); Tooltip.SetDefault("Fires lunic beams that reduce enemy protection\nProjectile 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 = 100000; - 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 + player.thrownDamage + 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 = 100000; + 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 + player.thrownDamage + 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 c831703e45..0ba5872a05 100644 --- a/Items/Weapons/MagnaCannon.cs +++ b/Items/Weapons/MagnaCannon.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 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"); } - 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 = 90000; - item.rare = 3; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnaBlast"); - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int num6 = 3; - for (int index = 0; index < num6; ++index) - { - 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.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(); - } - } + 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 = 90000; + item.rare = 3; + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnaBlast"); + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int num6 = 3; + for (int index = 0; index < num6; ++index) + { + 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.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 diff --git a/Items/Weapons/MagnaStriker.cs b/Items/Weapons/MagnaStriker.cs index 8ecedb050f..8908194c38 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 = 900000; - 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(); - } - } + 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 = 900000; + 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 diff --git a/Items/Weapons/MagneticMeltdown.cs b/Items/Weapons/MagneticMeltdown.cs index cec8758ad4..b7f41be76c 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,56 +18,56 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 127; - 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 = 1000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MagneticOrb"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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(); - } - } + public override void SetDefaults() + { + item.damage = 127; + 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 = 1000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MagneticOrb"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/MajesticGuard.cs b/Items/Weapons/MajesticGuard.cs index 85fe8c4b01..3b0b14a867 100644 --- a/Items/Weapons/MajesticGuard.cs +++ b/Items/Weapons/MajesticGuard.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 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\nIf 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 = 600000; - item.rare = 5; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - if (Main.rand.Next(5) == 0) - { - target.defense -= 10; - } - if (target.defense <= 0) - { - player.statLife += 6; - player.HealEffect(6); - } - } - - 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 = 600000; + item.rare = 5; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + if (Main.rand.Next(5) == 0) + { + target.defense -= 10; + } + if (target.defense <= 0) + { + player.statLife += 6; + player.HealEffect(6); + } + } + + 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/Malachite.cs b/Items/Weapons/Malachite.cs index e4ce681c91..47f2dc5cd4 100644 --- a/Items/Weapons/Malachite.cs +++ b/Items/Weapons/Malachite.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 Malachite : 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 Malachite : ModItem + { 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 SetDefaults() - { - item.width = 26; - item.damage = 46; - item.thrown = true; - 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 = 5000000; - item.shoot = mod.ProjectileType("Malachite"); - item.shootSpeed = 10f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, 203, 103); - } - } - } - - 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 * 2.5f), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - } -} + public override void SetDefaults() + { + item.width = 26; + item.damage = 58; + item.thrown = true; + 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 = 5000000; + item.shoot = mod.ProjectileType("Malachite"); + item.shootSpeed = 10f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, 203, 103); + } + } + } + + 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 * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + } +} diff --git a/Items/Weapons/ManaRose.cs b/Items/Weapons/ManaRose.cs index 3eb3b9b7e9..d6ee8d7465 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 = 11; - 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 = 50000; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 11; + 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 = 50000; + 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 diff --git a/Items/Weapons/MandibleBow.cs b/Items/Weapons/MandibleBow.cs index 99fdc51499..8b40abc6b9 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 = 15000; - 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"); - }*/ - } + 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 = 15000; + 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 diff --git a/Items/Weapons/MandibleClaws.cs b/Items/Weapons/MandibleClaws.cs index 45851dab64..c4754cddf8 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 = 10000; - 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 = 10000; + item.rare = 1; + } + } +} diff --git a/Items/Weapons/MangroveChakram.cs b/Items/Weapons/MangroveChakram.cs index 0d59177b3e..df80494dfe 100644 --- a/Items/Weapons/MangroveChakram.cs +++ b/Items/Weapons/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.Weapons -{ - public class MangroveChakram : 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 MangroveChakram : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mangrove Chakram"); } - public override void SetDefaults() - { - item.width = 38; - item.damage = 56; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.thrown = true; - item.height = 38; - item.value = 500000; - item.rare = 6; - item.shoot = mod.ProjectileType("MangroveChakramProjectile"); - 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 = 56; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.thrown = true; + item.height = 38; + item.value = 500000; + item.rare = 6; + item.shoot = mod.ProjectileType("MangroveChakramProjectile"); + 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/MangroveChakramMelee.cs b/Items/Weapons/MangroveChakramMelee.cs index b524593fea..a3e0950ce4 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 = 56; - 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 = 500000; - item.rare = 6; - 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 = 56; + 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 = 500000; + item.rare = 6; + 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 d41d30dc71..1bd4e34e3f 100644 --- a/Items/Weapons/MantisClaws.cs +++ b/Items/Weapons/MantisClaws.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 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"); } - - public override void SetDefaults() - { - item.width = 26; - item.damage = 90; - 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 = 500000; - item.rare = 8; - } - - 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, damage, knockback, Main.myPlayer); - } - } -} + + public override void SetDefaults() + { + item.width = 26; + item.damage = 90; + 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 = 500000; + item.rare = 8; + } + + 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, (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } +} diff --git a/Items/Weapons/Mariana.cs b/Items/Weapons/Mariana.cs index cd21077e10..dc5e9f80db 100644 --- a/Items/Weapons/Mariana.cs +++ b/Items/Weapons/Mariana.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 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"); } - public override void SetDefaults() - { - item.damage = 75; - 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 = 500000; - item.rare = 7; - item.shoot = mod.ProjectileType("MarianaProjectile"); - 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(4, 6); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5f), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophyteClaymore); - recipe.AddIngredient(ItemID.Coral, 3); - recipe.AddIngredient(ItemID.Starfish, 3); - recipe.AddIngredient(ItemID.Seashell, 3); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 = 75; + 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 = 500000; + item.rare = 7; + item.shoot = mod.ProjectileType("MarianaProjectile"); + 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(4, 6); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5f), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ChlorophyteClaymore); + recipe.AddIngredient(ItemID.Coral, 3); + recipe.AddIngredient(ItemID.Starfish, 3); + recipe.AddIngredient(ItemID.Seashell, 3); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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 80aa8e85a4..f8a4a8e779 100644 --- a/Items/Weapons/MarkedMagnum.cs +++ b/Items/Weapons/MarkedMagnum.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 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; + +namespace CalamityMod.Items.Weapons +{ + public class MarkedMagnum : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Marked Magnum"); Tooltip.SetDefault("Shots reduce enemy protection\nProjectile 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 = 30000; - 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 + player.thrownDamage + 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(); - } - } + 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 = 30000; + 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 + player.thrownDamage + 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 diff --git a/Items/Weapons/MarniteRifleSpear.cs b/Items/Weapons/MarniteRifleSpear.cs index 347435bb58..d3931582ec 100644 --- a/Items/Weapons/MarniteRifleSpear.cs +++ b/Items/Weapons/MarniteRifleSpear.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 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"); } - 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 = 40000; - 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(); - } - } + 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 = 40000; + 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 diff --git a/Items/Weapons/MarniteSpear.cs b/Items/Weapons/MarniteSpear.cs index d374d7cb8f..beda07a84e 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 = 65000; - 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 = 65000; + 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 18484d6f1e..bcbaf4e02f 100644 --- a/Items/Weapons/Megafleet.cs +++ b/Items/Weapons/Megafleet.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.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"); } - public override void SetDefaults() - { - item.damage = 370; - 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 = 10000000; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 370; + 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 = 10000000; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/Megafleet.png b/Items/Weapons/Megafleet.png index 34fbdc1c95..839b2a8aab 100644 Binary files a/Items/Weapons/Megafleet.png and b/Items/Weapons/Megafleet.png differ diff --git a/Items/Weapons/Megalodon.cs b/Items/Weapons/Megalodon.cs index ff255327e9..3ada31ca11 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 = 750000; - item.rare = 8; - 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(); - } - } + 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 = 750000; + item.rare = 8; + 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 diff --git a/Items/Weapons/Meowthrower.cs b/Items/Weapons/Meowthrower.cs index cbd22fcda1..f7f71ef85e 100644 --- a/Items/Weapons/Meowthrower.cs +++ b/Items/Weapons/Meowthrower.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 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"); } - 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 = 100000; - item.rare = 3; - 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; - } - } + 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 = 100000; + item.rare = 3; + 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 diff --git a/Items/Weapons/MeteorFist.cs b/Items/Weapons/MeteorFist.cs index 2f6115d852..28108ea56a 100644 --- a/Items/Weapons/MeteorFist.cs +++ b/Items/Weapons/MeteorFist.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class MeteorFist : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class MeteorFist : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Meteor Fist"); } - public override void SetDefaults() - { - item.width = 22; - item.damage = 15; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = 5; - item.useTime = 30; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 28; - item.value = 75000; - item.rare = 2; - item.shoot = mod.ProjectileType("MeteorFist"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 22; + item.damage = 15; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 30; + item.useStyle = 5; + item.useTime = 30; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.height = 28; + item.value = 75000; + item.rare = 2; + item.shoot = mod.ProjectileType("MeteorFist"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MineralMortar.cs b/Items/Weapons/MineralMortar.cs index f24b5b3b43..8a25937f0a 100644 --- a/Items/Weapons/MineralMortar.cs +++ b/Items/Weapons/MineralMortar.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 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"); } - 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 = 300000; - 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, 0.0f, 0.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(); - } - } + 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 = 300000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/Minigun.cs b/Items/Weapons/Minigun.cs index bde9837e0e..48392ab600 100644 --- a/Items/Weapons/Minigun.cs +++ b/Items/Weapons/Minigun.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.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 = 310; - 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 = 1750000; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 22f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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(); - } - } + public override void SetDefaults() + { + item.damage = 310; + 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 = 1750000; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 22f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs index 95a3eb7f85..6eee443cf3 100644 --- a/Items/Weapons/MirrorBlade.cs +++ b/Items/Weapons/MirrorBlade.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; - -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\nYou must hit an enemy with the blade to trigger this effect\nConsumes mana to fire mirror blasts"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 260; - 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 = 60; - item.value = 2000000; - item.shootSpeed = 16f; - item.shoot = mod.ProjectileType("MirrorBlast"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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, 0.0f, 0.0f); - return false; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int conDamage = target.damage + 260; - if (conDamage < 260) - { - conDamage = 260; - } - if (conDamage > 500) - { - conDamage = 500; - } - item.damage = conDamage; - } - } -} + public override void SetDefaults() + { + item.width = 50; + item.damage = 260; + 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 = 60; + item.value = 2000000; + item.shootSpeed = 16f; + item.shoot = mod.ProjectileType("MirrorBlast"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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, 0.0f, 0.0f); + return false; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int conDamage = target.damage + 260; + if (conDamage < 260) + { + conDamage = 260; + } + if (conDamage > 500) + { + conDamage = 500; + } + item.damage = conDamage; + } + } +} diff --git a/Items/Weapons/Mistlestorm.cs b/Items/Weapons/Mistlestorm.cs index 1eacd74f2f..a1846f7045 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,64 +18,64 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 54; - 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 = 3000000; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.shoot = 336; - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 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(); - } - } + public override void SetDefaults() + { + item.damage = 54; + 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 = 3000000; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.shoot = 336; + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 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 diff --git a/Items/Weapons/MolecularManipulator.cs b/Items/Weapons/MolecularManipulator.cs index c1eab97446..6eb815bdbf 100644 --- a/Items/Weapons/MolecularManipulator.cs +++ b/Items/Weapons/MolecularManipulator.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 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!\nFires a fast null bullet that distorts NPC stats\nUses 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 = 3250000; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = mod.ProjectileType("NullShot2"); - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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, 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; - 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(); - } - } + 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 = 3250000; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = mod.ProjectileType("NullShot2"); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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, 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; + 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 diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs index 02fa3189c9..e880537204 100644 --- a/Items/Weapons/Monsoon.cs +++ b/Items/Weapons/Monsoon.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; -//using TerrariaOverhaul; - -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 TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class Monsoon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Monsoon"); } - public override void SetDefaults() - { - item.damage = 55; - item.ranged = true; - item.width = 30; - item.height = 62; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = 1000000; - item.rare = 9; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 10f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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(12)) - { - case 1: type = 408; break; - default: break; - } - switch (Main.rand.Next(25)) - { - case 1: type = mod.ProjectileType("TyphoonArrow"); break; - default: break; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 15); - recipe.AddIngredient(ItemID.Tsunami); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 55; + item.ranged = true; + item.width = 30; + item.height = 62; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = 1000000; + item.rare = 9; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 10f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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(12)) + { + case 1: type = 408; break; + default: break; + } + switch (Main.rand.Next(25)) + { + case 1: type = mod.ProjectileType("TyphoonArrow"); break; + default: break; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num121].noDropItem = true; + } + 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 diff --git a/Items/Weapons/MortarRound.cs b/Items/Weapons/MortarRound.cs index eabb25ff9f..a114652881 100644 --- a/Items/Weapons/MortarRound.cs +++ b/Items/Weapons/MortarRound.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 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\nUsed 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(); - } - } + 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 diff --git a/Items/Weapons/Mourningstar.cs b/Items/Weapons/Mourningstar.cs index 8cbad32f4f..274b940e8a 100644 --- a/Items/Weapons/Mourningstar.cs +++ b/Items/Weapons/Mourningstar.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; - -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"); } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 330; - 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 = 3000000; - item.shootSpeed = 24f; - item.shoot = 611; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 = 330; + 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 = 3000000; + item.shootSpeed = 24f; + item.shoot = 611; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 c4f6950cdd..755fac9835 100644 --- a/Items/Weapons/Murasama.cs +++ b/Items/Weapons/Murasama.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 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; + +namespace CalamityMod.Items.Weapons +{ + public class Murasama : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Murasama"); - Tooltip.SetDefault("There will be blood!\n" + + Tooltip.SetDefault("There will be blood!\n" + "ID and power-level locked. Prove your strength or have the correct user ID to wield this sword."); } - public override void SetDefaults() - { - item.width = 72; - item.damage = 666; - 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 = 30000000; - item.shoot = mod.ProjectileType("Murasama"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override bool 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 = 666; + 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 = 30000000; + item.shoot = mod.ProjectileType("Murasama"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override bool 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/MythrilKnife.cs b/Items/Weapons/MythrilKnife.cs index 085f6beba9..0df9e75ff9 100644 --- a/Items/Weapons/MythrilKnife.cs +++ b/Items/Weapons/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.Weapons -{ - public class MythrilKnife : 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 MythrilKnife : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mythril Knife"); } - public override void SetDefaults() - { - item.width = 12; - item.damage = 32; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 12; + item.damage = 32; + item.thrown = true; + 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; + } + + 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/Weapons/NapalmArrow.cs b/Items/Weapons/NapalmArrow.cs index 12388f7c1d..5cb138a26a 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(); - } - } + 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 diff --git a/Items/Weapons/Needler.cs b/Items/Weapons/Needler.cs index 16ee628dd3..28eb32eaa1 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 = 35; - 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 = 250000; - 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, 0.0f, 0.0f); - return false; - } - } + public override void SetDefaults() + { + item.damage = 35; + 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 = 250000; + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/NeptunesBounty.cs b/Items/Weapons/NeptunesBounty.cs index db2c7c2394..7140a9a9be 100644 --- a/Items/Weapons/NeptunesBounty.cs +++ b/Items/Weapons/NeptunesBounty.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; - -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\nThe lower the enemies' defense the more damage they take from this debuff"); + Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\nThe lower the enemies' defense the more damage they take from this debuff"); } - public override void SetDefaults() - { - item.width = 80; - item.damage = 345; - 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 = 5000000; - item.shoot = mod.ProjectileType("NeptuneOrb"); - item.shootSpeed = 25f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 = 345; + 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 = 5000000; + item.shoot = mod.ProjectileType("NeptuneOrb"); + item.shootSpeed = 25f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 b0f8cdf8ce..c91d43ebfe 100644 --- a/Items/Weapons/NettlelineGreatbow.cs +++ b/Items/Weapons/NettlelineGreatbow.cs @@ -1,82 +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 TerrariaOverhaul; - -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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class NettlelineGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nettlevine Greatbow"); } - 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 = 1200000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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) - { - for(int i = 0; i < 5; 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(4)) - { - case 1: type = ProjectileID.VenomArrow; break; - case 2: type = ProjectileID.ChlorophyteArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.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(); - } - } + 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 = 1200000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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) + { + for(int i = 0; i < 5; i++) + { + float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + if (type == ProjectileID.WoodenArrowFriendly) + { + switch (Main.rand.Next(4)) + { + case 1: type = ProjectileID.VenomArrow; break; + case 2: type = ProjectileID.ChlorophyteArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[index].noDropItem = true; + } + else + { + int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 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(null, "UeliaceBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/NightsRay.cs b/Items/Weapons/NightsRay.cs index dc49d6bb54..6fcc9946fe 100644 --- a/Items/Weapons/NightsRay.cs +++ b/Items/Weapons/NightsRay.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 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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 30; - 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 = 100000; - item.rare = 5; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 30; + 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 = 100000; + item.rare = 5; + 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 diff --git a/Items/Weapons/NightsStabber.cs b/Items/Weapons/NightsStabber.cs index e3eeaea4f6..3621a29c59 100644 --- a/Items/Weapons/NightsStabber.cs +++ b/Items/Weapons/NightsStabber.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 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\nEnemies 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 = 500000; - 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"), damage, 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 = 500000; + 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 65a83526fa..bfdcddd5af 100644 --- a/Items/Weapons/NuclearFury.cs +++ b/Items/Weapons/NuclearFury.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 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 = 5; - item.value = 2500000; - item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NuclearFuryProjectile"); - item.shootSpeed = 16f; - } - - 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) - { - 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(); - } - } + 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 = 5; + item.value = 2500000; + item.UseSound = SoundID.Item84; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NuclearFuryProjectile"); + item.shootSpeed = 16f; + } + + 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) + { + 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 diff --git a/Items/Weapons/NullificationRifle.cs b/Items/Weapons/NullificationRifle.cs index 08502ead1b..29ab76a10e 100644 --- a/Items/Weapons/NullificationRifle.cs +++ b/Items/Weapons/NullificationRifle.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 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!\nFires a fast null bullet that distorts NPC stats\nUses 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 = 1250000; - item.rare = 9; - 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; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + 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 = 1250000; + item.rare = 9; + 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; + 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 diff --git a/Items/Weapons/OldLordOathsword.cs b/Items/Weapons/OldLordOathsword.cs index b3bde92cd5..e7272ce503 100644 --- a/Items/Weapons/OldLordOathsword.cs +++ b/Items/Weapons/OldLordOathsword.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 -{ - 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"); } - 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 = 120000; - item.rare = 3; - } - } -} + 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 = 120000; + item.rare = 3; + } + } +} diff --git a/Items/Weapons/OmegaBiomeBlade.cs b/Items/Weapons/OmegaBiomeBlade.cs index c986e5eba3..6d6ddf2f0e 100644 --- a/Items/Weapons/OmegaBiomeBlade.cs +++ b/Items/Weapons/OmegaBiomeBlade.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; - -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\nProjectiles 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 = 1200000; - item.rare = 9; - item.shoot = mod.ProjectileType("OmegaBiomeOrb"); - 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) - { - 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 = 1200000; + item.rare = 9; + item.shoot = mod.ProjectileType("OmegaBiomeOrb"); + 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) + { + 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 952b466b00..ff2b9d9ac1 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 points"); } - public override void SetDefaults() - { - item.width = 100; - item.damage = 84; - 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 = 120; - item.value = 1500000; - 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 = 100; + item.damage = 84; + 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 = 120; + item.value = 1500000; + 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 aab4122a64..4d51dea3a2 100644 --- a/Items/Weapons/OnyxChainBlaster.cs +++ b/Items/Weapons/OnyxChainBlaster.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 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"); } - 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 = 1750000; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 24f; - item.useAmmo = 97; - } - - 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 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, 0.0f, 0.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, 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.OnyxBlaster); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + 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 = 1750000; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 24f; + item.useAmmo = 97; + } + + 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 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, 0.0f, 0.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, 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.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 diff --git a/Items/Weapons/OpalStriker.cs b/Items/Weapons/OpalStriker.cs index 45738807f1..31050ba648 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 = 1f; - item.value = 90000; - item.rare = 3; - 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, knockBack, player.whoAmI, 0.0f, 0.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(); - } - } + 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 = 90000; + item.rare = 3; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/OrichalcumSpikedGemstone.cs b/Items/Weapons/OrichalcumSpikedGemstone.cs index eebf4ce227..5e57aac0a7 100644 --- a/Items/Weapons/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/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.Weapons -{ - public class OrichalcumSpikedGemstone : 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 OrichalcumSpikedGemstone : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Orichalcum Spiked Gemstone"); } - public override void SetDefaults() - { - item.width = 14; - item.damage = 25; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 14; + item.damage = 25; + item.thrown = true; + 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; + } + + 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/Weapons/P90.cs b/Items/Weapons/P90.cs index def4cc21e4..e0768c8727 100644 --- a/Items/Weapons/P90.cs +++ b/Items/Weapons/P90.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 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"); } - 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 = 750000; - 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.AddIngredient(null, "CoreofEleum", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LeadBar, 10); - recipe.AddIngredient(null, "CoreofEleum", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + 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 = 750000; + 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.AddIngredient(null, "CoreofEleum", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LeadBar, 10); + recipe.AddIngredient(null, "CoreofEleum", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/PaintballBlaster.cs b/Items/Weapons/PaintballBlaster.cs index 8dc7df9219..427e6f60dc 100644 --- a/Items/Weapons/PaintballBlaster.cs +++ b/Items/Weapons/PaintballBlaster.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 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"); } - 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 = 300000; - 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(); - } - } + 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 = 300000; + 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 diff --git a/Items/Weapons/PalladiumJavelin.cs b/Items/Weapons/PalladiumJavelin.cs index 2e4c862a06..61607c3eb6 100644 --- a/Items/Weapons/PalladiumJavelin.cs +++ b/Items/Weapons/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.Weapons -{ - public class PalladiumJavelin : 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 PalladiumJavelin : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Palladium Javelin"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 41; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 44; + item.damage = 41; + item.thrown = true; + 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; + } + + 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/Weapons/Perforators/Aorta.cs b/Items/Weapons/Perforators/Aorta.cs index ac95591322..c2d7e49021 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 = 70000; - 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(); - } - } + + 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 = 70000; + 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 diff --git a/Items/Weapons/Perforators/BloodBath.cs b/Items/Weapons/Perforators/BloodBath.cs index 2257b4cfee..b5f46bfbda 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("Drench 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; //so the item's animation doesn't do damage - item.knockBack = 5.75f; - item.value = 90000; - 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; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 5.75f; + item.value = 90000; + 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 diff --git a/Items/Weapons/Perforators/BloodClotStaff.cs b/Items/Weapons/Perforators/BloodClotStaff.cs index 84f3bc0388..96dbb64901 100644 --- a/Items/Weapons/Perforators/BloodClotStaff.cs +++ b/Items/Weapons/Perforators/BloodClotStaff.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.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 = 55000; - 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 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("BloodClotMinion"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + + 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 = 55000; + 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 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("BloodClotMinion"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Perforators/BloodyRupture.cs b/Items/Weapons/Perforators/BloodyRupture.cs index 9ef0588d29..0fccab6e19 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 = 12000; - 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"), damage, 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 = 12000; + 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 19aecbab29..d31fcf90a7 100644 --- a/Items/Weapons/Perforators/Eviscerator.cs +++ b/Items/Weapons/Perforators/Eviscerator.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.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"); } - - public override void SetDefaults() - { - item.damage = 57; - 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 = 80000; - 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, 0.0f, 0.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(); - } - } + + public override void SetDefaults() + { + item.damage = 57; + 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 = 80000; + 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, 0.0f, 0.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 diff --git a/Items/Weapons/Perforators/SausageMaker.cs b/Items/Weapons/Perforators/SausageMaker.cs index d4ff0ee5d5..bf510e502a 100644 --- a/Items/Weapons/Perforators/SausageMaker.cs +++ b/Items/Weapons/Perforators/SausageMaker.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.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"); } - - 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 = 105000; - 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 = 105000; + 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/ToothBall.cs b/Items/Weapons/Perforators/ToothBall.cs index 9f949c615a..04ff5b3117 100644 --- a/Items/Weapons/Perforators/ToothBall.cs +++ b/Items/Weapons/Perforators/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.Weapons.Perforators -{ - public class ToothBall : 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 ToothBall : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Tooth Ball"); } - - public override void SetDefaults() - { - item.width = 30; - item.damage = 20; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 30; + item.damage = 20; + item.thrown = true; + 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; + } + + 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/Weapons/Perforators/VeinBurster.cs b/Items/Weapons/Perforators/VeinBurster.cs index 6ff5f72da0..04126882c9 100644 --- a/Items/Weapons/Perforators/VeinBurster.cs +++ b/Items/Weapons/Perforators/VeinBurster.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.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"); } - - 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 = 50000; - item.rare = 4; - 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 = 50000; + item.rare = 4; + 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 ac863b5e8c..74493df33c 100644 --- a/Items/Weapons/Phangasm.cs +++ b/Items/Weapons/Phangasm.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.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"); } - public override void SetDefaults() - { - item.damage = 200; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 3f; - item.value = 3000000; - 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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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, 0.0f, 0.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(); - } - } + public override void SetDefaults() + { + item.damage = 200; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 3f; + item.value = 3000000; + 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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, 0.0f, 0.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 diff --git a/Items/Weapons/PhantasmalFury.cs b/Items/Weapons/PhantasmalFury.cs index 2057597718..771e60f74a 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,45 +18,45 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 400; - 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 = 800000; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PhantasmalFury"); - item.shootSpeed = 12f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.damage = 400; + 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 = 800000; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PhantasmalFury"); + item.shootSpeed = 12f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreStaff); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/PhoenixBlade.cs b/Items/Weapons/PhoenixBlade.cs index 75d00152e7..5353698c88 100644 --- a/Items/Weapons/PhoenixBlade.cs +++ b/Items/Weapons/PhoenixBlade.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.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"); } - public override void SetDefaults() - { - item.width = 106; - item.damage = 35; - item.melee = true; - item.useAnimation = 30; - item.useStyle = 1; - item.useTime = 30; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 106; - item.value = 300000; - item.rare = 5; - item.shootSpeed = 12f; - } - - 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, 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; - if (Main.rand.Next(4) == 0) - { - 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"), 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"), 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", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 106; + item.damage = 35; + item.melee = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 106; + item.value = 300000; + item.rare = 5; + item.shootSpeed = 12f; + } + + 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, 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; + if (Main.rand.Next(4) == 0) + { + 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", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Photoviscerator.cs b/Items/Weapons/Photoviscerator.cs index 9f88a15ba7..5d38391722 100644 --- a/Items/Weapons/Photoviscerator.cs +++ b/Items/Weapons/Photoviscerator.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 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 melt everything"); } - public override void SetDefaults() - { - item.damage = 84; - 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 = 100000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ExoFire"); - item.shootSpeed = 6f; - item.useAmmo = 23; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 92; + 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 = 100000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ExoFire"); + item.shootSpeed = 6f; + item.useAmmo = 23; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 diff --git a/Items/Weapons/Plaguebringer/DiseasedPike.cs b/Items/Weapons/Plaguebringer/DiseasedPike.cs index 1cb55f9a21..8fbe637b55 100644 --- a/Items/Weapons/Plaguebringer/DiseasedPike.cs +++ b/Items/Weapons/Plaguebringer/DiseasedPike.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 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.maxStack = 1; - item.value = 800000; - 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.maxStack = 1; + item.value = 800000; + 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 b07c74de27..ebe001f04b 100644 --- a/Items/Weapons/Plaguebringer/Malevolence.cs +++ b/Items/Weapons/Plaguebringer/Malevolence.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.Plaguebringer -{ - public class Malevolence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malevolence"); - } - - 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; //so the item's animation doesn't do damage - item.knockBack = 3f; - item.value = 500000; - item.rare = 8; - item.UseSound = SoundID.Item97; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("PlagueArrow"); //idk why but all the guns in the vanilla source have this - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.Plaguebringer +{ + public class Malevolence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malevolence"); + } + + 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; //so the item's animation doesn't do damage + item.knockBack = 3f; + item.value = 500000; + item.rare = 8; + item.UseSound = SoundID.Item97; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("PlagueArrow"); //idk why but all the guns in the vanilla source have this + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/MepheticSprayer.cs b/Items/Weapons/Plaguebringer/MepheticSprayer.cs index 0095fba8d0..3be1e04081 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; //so the item's animation doesn't do damage - item.knockBack = 2f; - item.UseSound = SoundID.Item34; - item.value = 1200000; - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CorossiveFlames"); //idk why but all the guns in the vanilla source have this - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 2f; + item.UseSound = SoundID.Item34; + item.value = 1200000; + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CorossiveFlames"); //idk why but all the guns in the vanilla source have this + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/PestilentDefiler.cs b/Items/Weapons/Plaguebringer/PestilentDefiler.cs index 3e37b911da..0b3a176713 100644 --- a/Items/Weapons/Plaguebringer/PestilentDefiler.cs +++ b/Items/Weapons/Plaguebringer/PestilentDefiler.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.Plaguebringer { -public class PestilentDefiler : 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 PestilentDefiler : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Pestilent Defiler"); } - - 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; //so the item's animation doesn't do damage - item.knockBack = 9.5f; - item.value = 950000; - 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, 0.0f, 0.0f); - return false; - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 9.5f; + item.value = 950000; + 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, 0.0f, 0.0f); + return false; + } }} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/PlagueStaff.cs b/Items/Weapons/Plaguebringer/PlagueStaff.cs index e70393f4a4..8fcb31b30b 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 = 8; - item.value = 1250000; - 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; - } - } + + 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 = 8; + item.value = 1250000; + 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 diff --git a/Items/Weapons/Plaguebringer/TheHive.cs b/Items/Weapons/Plaguebringer/TheHive.cs index 433c2539ea..474539f02f 100644 --- a/Items/Weapons/Plaguebringer/TheHive.cs +++ b/Items/Weapons/Plaguebringer/TheHive.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 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"); } - - 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; //so the item's animation doesn't do damage - item.knockBack = 3.5f; - item.value = 500000; - item.rare = 8; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BeeRPG"); //idk why but all the guns in the vanilla source have this - 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, 0.0f, 0.0f); - return false; - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 3.5f; + item.value = 500000; + item.rare = 8; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeeRPG"); //idk why but all the guns in the vanilla source have this + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/ThePlaguebringer.cs b/Items/Weapons/Plaguebringer/ThePlaguebringer.cs index 59f9e71abc..c11744d2f3 100644 --- a/Items/Weapons/Plaguebringer/ThePlaguebringer.cs +++ b/Items/Weapons/Plaguebringer/ThePlaguebringer.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.Plaguebringer { -public class ThePlaguebringer : 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 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 = 90; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 2.5f; - item.value = 1000000; - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ThePlaguebringer"); - } - - public override bool 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); - return false; - } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 90; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 2.5f; + item.value = 1000000; + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ThePlaguebringer"); + } + + public override bool 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); + return false; + } }} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/VirulentKatana.cs b/Items/Weapons/Plaguebringer/VirulentKatana.cs index 781aced43d..7888b1208d 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"); - } - - public override void SetDefaults() - { - item.width = 42; - 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 = 52; - item.maxStack = 1; - item.value = 755000; - 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"); + } + + public override void SetDefaults() + { + item.width = 42; + 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 = 52; + item.maxStack = 1; + item.value = 755000; + 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 06780d37e4..c0ed0f40e6 100644 --- a/Items/Weapons/PlanetaryAnnihilation.cs +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -1,120 +1,140 @@ -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 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class PlanetaryAnnihilation : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Planetary Annihilation"); } - 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 = 2000000; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraBall"); - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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); - } - } - } - - 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; - 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)); - 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(); - } - } + 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 = 2000000; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraBall"); + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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); + } + } + } + + 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 diff --git a/Items/Weapons/PlasmaRifle.cs b/Items/Weapons/PlasmaRifle.cs index c0bcc2163d..c61d5256c9 100644 --- a/Items/Weapons/PlasmaRifle.cs +++ b/Items/Weapons/PlasmaRifle.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 -{ - 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\nRight click to change modes"); } - public override void SetDefaults() - { - item.damage = 422; - 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 = 1500000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("PlasmaShot"); - } - - 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 AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.mana = 40; - item.useTime = 40; - item.useAnimation = 40; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - } - else - { - item.mana = 5; - item.useTime = 8; - item.useAnimation = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - } - 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("PlasmaShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaBolt"), (int)((double)damage * 0.75f), 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(); - } - } + public override void SetDefaults() + { + item.damage = 422; + 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 = 1500000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("PlasmaShot"); + } + + 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 AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.mana = 40; + item.useTime = 40; + item.useAnimation = 40; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + } + else + { + item.mana = 5; + item.useTime = 8; + item.useAnimation = 8; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + } + 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("PlasmaShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaBolt"), (int)((double)damage * 0.75f), 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 diff --git a/Items/Weapons/PlasmaRod.cs b/Items/Weapons/PlasmaRod.cs index 414a941108..273cad3453 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 = 60000; - item.rare = 3; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaRay"); - item.shootSpeed = 6f; - } - } + 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 = 60000; + item.rare = 3; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaRay"); + item.shootSpeed = 6f; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs index a326b6645e..4cb56a848b 100644 --- a/Items/Weapons/Polterghast/BansheeHook.cs +++ b/Items/Weapons/Polterghast/BansheeHook.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.Polterghast -{ - public class BansheeHook : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Banshee Hook"); - Tooltip.SetDefault("Swings a banshee hook that explodes on contact"); - } - - public override void SetDefaults() - { - item.width = 16; - item.damage = 130; - 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 = 1000000; - item.shoot = mod.ProjectileType("BansheeHook"); - item.shootSpeed = 42f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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 explodes on contact"); + } + + public override void SetDefaults() + { + item.width = 16; + item.damage = 130; + 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 = 1000000; + item.shoot = mod.ProjectileType("BansheeHook"); + item.shootSpeed = 42f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 bca419ae77..a30b0ba4f8 100644 --- a/Items/Weapons/Polterghast/DaemonsFlame.cs +++ b/Items/Weapons/Polterghast/DaemonsFlame.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.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 = 130; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 4f; - item.value = 1000000; - 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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DaemonsFlame"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override void SetDefaults() + { + item.damage = 130; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 4f; + item.value = 1000000; + 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("DaemonsFlame"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs index 992c50ed61..16f80c0127 100644 --- a/Items/Weapons/Polterghast/EtherealSubjugator.cs +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -1,92 +1,92 @@ -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 = 110; - 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 = 1000000; - item.UseSound = SoundID.Item82; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PhantomGuy"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 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; - } - } +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 = 110; + 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 = 1000000; + item.UseSound = SoundID.Item82; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PhantomGuy"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 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 diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index 49cdd234a2..a26b8809d8 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.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; - -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 fire that follows 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 = 1000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FatesReveal"); - item.shootSpeed = 1f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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 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 = 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); - 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; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); - } - return false; - } - } + + 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 = 1000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FatesReveal"); + item.shootSpeed = 1f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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 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 = 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); + 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; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Polterghast/GhastlyVisage.cs b/Items/Weapons/Polterghast/GhastlyVisage.cs index d4a9a990fe..e7a7cf3efa 100644 --- a/Items/Weapons/Polterghast/GhastlyVisage.cs +++ b/Items/Weapons/Polterghast/GhastlyVisage.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.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"); @@ -18,40 +18,40 @@ namespace CalamityMod.Items.Weapons.Polterghast } - public override void SetDefaults() - { - item.damage = 110; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 20; - item.width = 78; - item.height = 70; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = 1000000; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("GhastlyVisage"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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("GhastlyVisage"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override void SetDefaults() + { + item.damage = 110; + item.magic = true; + item.noUseGraphic = true; + item.channel = true; + item.mana = 20; + item.width = 78; + item.height = 70; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = 1000000; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("GhastlyVisage"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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("GhastlyVisage"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Polterghast/GhoulishGouger.cs b/Items/Weapons/Polterghast/GhoulishGouger.cs index 65a0b3a4e0..50647ffd79 100644 --- a/Items/Weapons/Polterghast/GhoulishGouger.cs +++ b/Items/Weapons/Polterghast/GhoulishGouger.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; - -namespace CalamityMod.Items.Weapons.Polterghast -{ - public class GhoulishGouger : 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 GhoulishGouger : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ghoulish Gouger"); Tooltip.SetDefault("Throws a ghoulish scythe"); } - public override void SetDefaults() - { - item.width = 68; - item.damage = 150; - item.thrown = true; - 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 = 1000000; - item.shoot = mod.ProjectileType("GhoulishGouger"); - item.shootSpeed = 20f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - } -} + public override void SetDefaults() + { + item.width = 68; + item.damage = 150; + item.thrown = true; + 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 = 1000000; + item.shoot = mod.ProjectileType("GhoulishGouger"); + item.shootSpeed = 20f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + } +} diff --git a/Items/Weapons/Polterghast/TerrorBlade.cs b/Items/Weapons/Polterghast/TerrorBlade.cs index 6d8e278a66..5c811e227f 100644 --- a/Items/Weapons/Polterghast/TerrorBlade.cs +++ b/Items/Weapons/Polterghast/TerrorBlade.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; - -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\nOn every bounce it emits an explosion"); } - public override void SetDefaults() - { - item.width = 88; - item.damage = 330; - 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 = 1000000; - item.shoot = mod.ProjectileType("TerrorBeam"); - item.shootSpeed = 20f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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 = 330; + 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 = 1000000; + item.shoot = mod.ProjectileType("TerrorBeam"); + item.shootSpeed = 20f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 fc6f9e5cd2..8617fa5463 100644 --- a/Items/Weapons/PrimordialAncient.cs +++ b/Items/Weapons/PrimordialAncient.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 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"); } - public override void SetDefaults() - { - item.damage = 235; - 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 = 10000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Ancient"); - item.shootSpeed = 8f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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(); - } - } + public override void SetDefaults() + { + item.damage = 235; + 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 = 10000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Ancient"); + item.shootSpeed = 8f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Weapons/PrimordialEarth.cs b/Items/Weapons/PrimordialEarth.cs index f4db7e33ec..3288426412 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("An ancient relic from an ancient land"); } - public override void SetDefaults() - { - item.damage = 80; - 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 = 1000000; - 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(); - } - } + public override void SetDefaults() + { + item.damage = 80; + 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 = 1000000; + 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 diff --git a/Items/Weapons/ProfanedSword.cs b/Items/Weapons/ProfanedSword.cs index d5ba3fd7b6..0d7e9f2918 100644 --- a/Items/Weapons/ProfanedSword.cs +++ b/Items/Weapons/ProfanedSword.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 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"); } - 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 = 300000; - item.rare = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Brimblast"), damage, knockback, Main.myPlayer); - } - - 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, 235); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + 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 = 300000; + item.rare = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + 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) + { + int dust = 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 diff --git a/Items/Weapons/ProporsePistol.cs b/Items/Weapons/ProporsePistol.cs index 2c3e8642e0..d8a13eb956 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 on tile hits"); } - public override void SetDefaults() - { - item.damage = 45; - 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 = 100000; - 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, 0.0f, 0.0f); - return false; - } - } + public override void SetDefaults() + { + item.damage = 45; + 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 = 100000; + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Providence/BlissfulBombardier.cs b/Items/Weapons/Providence/BlissfulBombardier.cs index 45d7e0ed43..55e914ac20 100644 --- a/Items/Weapons/Providence/BlissfulBombardier.cs +++ b/Items/Weapons/Providence/BlissfulBombardier.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.Providence -{ - public class BlissfulBombardier : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blissful Bombardier"); - Tooltip.SetDefault("Fires flare rockets"); - } - - public override void SetDefaults() - { - item.damage = 85; - 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 = 5000000; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Nuke"); - item.useAmmo = 771; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-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); - } - } - } - - public override bool 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, 0.0f, 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.Providence +{ + public class BlissfulBombardier : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blissful Bombardier"); + Tooltip.SetDefault("Fires flare rockets"); + } + + public override void SetDefaults() + { + item.damage = 85; + 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 = 5000000; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("Nuke"); + item.useAmmo = 771; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-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); + } + } + } + + public override bool 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Providence/HolyCollider.cs b/Items/Weapons/Providence/HolyCollider.cs index 71b68a4834..1976bf1613 100644 --- a/Items/Weapons/Providence/HolyCollider.cs +++ b/Items/Weapons/Providence/HolyCollider.cs @@ -1,70 +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.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.maxStack = 1; - item.value = 5000000; - item.shootSpeed = 10f; - } - - 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 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; - int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), (int)((double)damage * 0.25), 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("HolyFire2"), (int)((double)damage * 0.25), knockback, Main.myPlayer); - Main.projectile[projectile1].hostile = false; - Main.projectile[projectile1].friendly = true; - Main.projectile[projectile1].timeLeft = 60; - Main.projectile[projectile2].hostile = false; - Main.projectile[projectile2].friendly = true; - Main.projectile[projectile2].timeLeft = 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.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.maxStack = 1; + item.value = 5000000; + item.shootSpeed = 10f; + } + + 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 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.4), 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.4), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/Providence/MoltenAmputator.cs b/Items/Weapons/Providence/MoltenAmputator.cs index d81b34f2dc..6a5d08a1b6 100644 --- a/Items/Weapons/Providence/MoltenAmputator.cs +++ b/Items/Weapons/Providence/MoltenAmputator.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 MoltenAmputator : 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 MoltenAmputator : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Amputator"); } - - public override void SetDefaults() - { - item.width = 60; //The width of the .png file in pixels divided by 2. - item.damage = 220; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 9f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.thrown = true; //Dictates whether the weapon can be "auto-fired". - item.height = 60; //The height of the .png file in pixels divided by 2. - item.value = 5000000; //Value is calculated in copper coins. - item.shoot = mod.ProjectileType("MoltenAmputator"); - item.shootSpeed = 12f; - } - - 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 void SetDefaults() + { + item.width = 60; //The width of the .png file in pixels divided by 2. + item.damage = 220; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 9f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.thrown = true; //Dictates whether the weapon can be "auto-fired". + item.height = 60; //The height of the .png file in pixels divided by 2. + item.value = 5000000; //Value is calculated in copper coins. + item.shoot = mod.ProjectileType("MoltenAmputator"); + item.shootSpeed = 12f; + } + + 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/Weapons/Providence/PurgeGuzzler.cs b/Items/Weapons/Providence/PurgeGuzzler.cs index 3ca28bf5e1..5088bf02be 100644 --- a/Items/Weapons/Providence/PurgeGuzzler.cs +++ b/Items/Weapons/Providence/PurgeGuzzler.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.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 3 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 = 5000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HolyLaser"); - item.shootSpeed = 6f; - } - - 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) - { - 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; - } - } + + 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 = 5000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HolyLaser"); + item.shootSpeed = 6f; + } + + 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) + { + 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 diff --git a/Items/Weapons/Providence/SolarFlare.cs b/Items/Weapons/Providence/SolarFlare.cs index 2e958b561f..74444d3558 100644 --- a/Items/Weapons/Providence/SolarFlare.cs +++ b/Items/Weapons/Providence/SolarFlare.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 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 = 88; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = 1000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarFlareYoyo"); - } - - 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 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); - 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.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 = 88; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7.5f; + item.value = 1000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SolarFlareYoyo"); + } + + 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 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); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs index 404dc2377b..fb22354f51 100644 --- a/Items/Weapons/Providence/TelluricGlare.cs +++ b/Items/Weapons/Providence/TelluricGlare.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.Providence -{ - public class TelluricGlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Telluric Glare"); - } - - 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 = 4; - item.value = 1000000; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TelluricGlare"); - item.shootSpeed = 12f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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("TelluricGlare"), damage, knockBack, player.whoAmI, 0.0f, 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.Providence +{ + public class TelluricGlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Telluric Glare"); + } + + 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 = 4; + item.value = 1000000; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TelluricGlare"); + item.shootSpeed = 12f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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("TelluricGlare"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Pumpler.cs b/Items/Weapons/Pumpler.cs index 621b5a57f1..ec51a83a89 100644 --- a/Items/Weapons/Pumpler.cs +++ b/Items/Weapons/Pumpler.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 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"); } - 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 = 50000; - 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 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) <= 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(); - } - } + 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 = 50000; + 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 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) <= 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 diff --git a/Items/Weapons/Purge.cs b/Items/Weapons/Purge.cs index 3d5ac6d03a..a747ef891d 100644 --- a/Items/Weapons/Purge.cs +++ b/Items/Weapons/Purge.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 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"); } - 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 = 900000; - 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; - } - } + 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 = 900000; + 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 diff --git a/Items/Weapons/PurityAxe.cs b/Items/Weapons/PurityAxe.cs index 3ec8767010..41318414e1 100644 --- a/Items/Weapons/PurityAxe.cs +++ b/Items/Weapons/PurityAxe.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 PurityAxe : 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 PurityAxe : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Axe of Purity"); } - public override void SetDefaults() - { - item.damage = 43; - item.melee = true; - item.width = 58; - item.height = 46; - item.useTime = 19; - item.useAnimation = 19; - item.useTurn = true; - item.axe = 25; - item.useStyle = 1; - item.knockBack = 7.5f; - item.value = 300000; - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddIngredient(ItemID.CrystalShard, 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, 58); - } - } - } + public override void SetDefaults() + { + item.damage = 43; + item.melee = true; + item.width = 58; + item.height = 46; + item.useTime = 19; + item.useAnimation = 19; + item.useTurn = true; + item.axe = 25; + item.useStyle = 1; + item.knockBack = 7.5f; + item.value = 300000; + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FellerofEvergreens"); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddIngredient(ItemID.CrystalShard, 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, 58); + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/Pwnagehammer.cs b/Items/Weapons/Pwnagehammer.cs index 3514faedc9..a7423f1c94 100644 --- a/Items/Weapons/Pwnagehammer.cs +++ b/Items/Weapons/Pwnagehammer.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 Pwnagehammer : 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 Pwnagehammer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); } - 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.thrown = true; - item.height = 68; - item.value = 300000; - item.rare = 6; - item.shoot = mod.ProjectileType("Pwnagehammer"); - 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(); - } - } -} + 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.thrown = true; + item.height = 68; + item.value = 300000; + item.rare = 6; + item.shoot = mod.ProjectileType("Pwnagehammer"); + 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/PwnagehammerMelee.cs b/Items/Weapons/PwnagehammerMelee.cs index 6e895dd2d5..8a21455386 100644 --- a/Items/Weapons/PwnagehammerMelee.cs +++ b/Items/Weapons/PwnagehammerMelee.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 PwnagehammerMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pwnagehammer"); - } - - 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 = 300000; - 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"); + } + + 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 = 300000; + 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 19a0a3751f..e313e1fd76 100644 --- a/Items/Weapons/Quagmire.cs +++ b/Items/Weapons/Quagmire.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 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 = 43; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.4f; - item.value = 150000; - item.rare = 6; - item.autoReuse = true; - item.shoot = mod.ProjectileType("QuagmireProjectile"); - } - - public override bool 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); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.HelFire); + item.damage = 43; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.4f; + item.value = 150000; + item.rare = 6; + item.autoReuse = true; + item.shoot = mod.ProjectileType("QuagmireProjectile"); + } + + public override bool 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); + return false; + } + + 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 diff --git a/Items/Weapons/RaidersGlory.cs b/Items/Weapons/RaidersGlory.cs index 232357aab2..da0dc8f93b 100644 --- a/Items/Weapons/RaidersGlory.cs +++ b/Items/Weapons/RaidersGlory.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons -{ - public class RaidersGlory : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Raider's Glory"); - } - - public override void SetDefaults() - { - item.damage = 37; - 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 = 100000; - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("crossbow"); - }*/ - } +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 RaidersGlory : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Raider's Glory"); + } + + public override void SetDefaults() + { + item.damage = 37; + 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 = 100000; + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("crossbow"); + }*/ + } } \ No newline at end of file diff --git a/Items/Weapons/Ravager/Hematemesis.cs b/Items/Weapons/Ravager/Hematemesis.cs index 4f4a2f04af..2e04379af7 100644 --- a/Items/Weapons/Ravager/Hematemesis.cs +++ b/Items/Weapons/Ravager/Hematemesis.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.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"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 100; - 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 = 600000; - 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; - } - } + 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 = 600000; + 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 diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs index 9ae36ba9fc..335afef63c 100644 --- a/Items/Weapons/RedSun.cs +++ b/Items/Weapons/RedSun.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 RedSun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Sun"); - Tooltip.SetDefault("Over paradise"); - } - - 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 = 10000000; - item.shoot = mod.ProjectileType("SolarFlare"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("SolarFlare"), damage, 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"), 500); - } - } -} +using System; +using System.Collections.Generic; +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"); + } + + 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 = 10000000; + item.shoot = mod.ProjectileType("SolarFlare"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("SolarFlare"), damage, 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"), 500); + } + } +} diff --git a/Items/Weapons/RedtideSword.cs b/Items/Weapons/RedtideSword.cs index 9b3d328f21..30d5c6bc01 100644 --- a/Items/Weapons/RedtideSword.cs +++ b/Items/Weapons/RedtideSword.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 RedtideSword : 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 RedtideSword : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Redtide Sword"); } - public override void SetDefaults() - { - item.width = 42; - item.damage = 23; - 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.maxStack = 1; - item.value = 50000; - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } -}} + public override void SetDefaults() + { + item.width = 42; + item.damage = 23; + 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.maxStack = 1; + item.value = 50000; + item.rare = 2; + } + + 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 4579b709d2..9ecb9e4630 100644 --- a/Items/Weapons/RelicofRuin.cs +++ b/Items/Weapons/RelicofRuin.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 RelicofRuin : 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 RelicofRuin : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Relic of Ruin"); } - 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 = 350000; - 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(); - } + 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 = 350000; + 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 diff --git a/Items/Weapons/RoyalKnives.cs b/Items/Weapons/RoyalKnives.cs index 4b17a2aadc..46822b2335 100644 --- a/Items/Weapons/RoyalKnives.cs +++ b/Items/Weapons/RoyalKnives.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class RoyalKnives : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Illustrious Knives"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 1200; - item.thrown = 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.maxStack = 1; - item.value = 8000000; - item.shoot = mod.ProjectileType("RoyalKnife"); - item.shootSpeed = 9f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override bool 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, "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 RoyalKnives : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Illustrious Knives"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 1200; + item.thrown = 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.maxStack = 1; + item.value = 8000000; + item.shoot = mod.ProjectileType("RoyalKnife"); + item.shootSpeed = 9f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override bool 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, "EmpyreanKnives"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs index e6b027f3c5..780c764ec1 100644 --- a/Items/Weapons/RoyalKnivesMelee.cs +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 1200; - 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.maxStack = 1; - item.value = 8000000; - item.shoot = mod.ProjectileType("RoyalKnifeMelee"); - item.shootSpeed = 9f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override bool 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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 1200; + 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.maxStack = 1; + item.value = 8000000; + item.shoot = mod.ProjectileType("RoyalKnifeMelee"); + item.shootSpeed = 9f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override bool 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 cd83b854a7..8ebb43bd6c 100644 --- a/Items/Weapons/RubberMortarRound.cs +++ b/Items/Weapons/RubberMortarRound.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 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\nWill destroy tiles on each bounce\nUsed 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(); - } - } + 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 diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index ca1e4faa69..45d8e6b15c 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.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 SDFMG : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SDFMG"); - Tooltip.SetDefault("It came from the edge of Terraria\n50% chance to not consume ammo"); - } - - public override void SetDefaults() - { - item.damage = 172; - 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 = 3000000; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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, 0.0f, 0.0f); - } - 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.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(); - } - } +using System; +using System.Collections.Generic; +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\n50% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 172; + 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 = 3000000; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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, 0.0f, 0.0f); + } + 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.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 diff --git a/Items/Weapons/SHPC.cs b/Items/Weapons/SHPC.cs index 0c8abb355f..d5b76f225a 100644 --- a/Items/Weapons/SHPC.cs +++ b/Items/Weapons/SHPC.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 -{ - 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 a powerful energy beam\n" + + "Right click to fire a powerful energy beam\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.value = 5000000; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SHPB"); - item.shootSpeed = 20f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, Main.DiscoG, 155); - } - } - } - - 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.1f), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } - } + 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.value = 5000000; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SHPB"); + item.shootSpeed = 20f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, Main.DiscoG, 155); + } + } + } + + 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.1f), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs index ff25fab5f0..56316869ae 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,55 +18,55 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 182; - 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 = 1000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SanguineFlare"); - item.shootSpeed = 8f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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(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(); - } - } + public override void SetDefaults() + { + item.damage = 182; + 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 = 1000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SanguineFlare"); + item.shootSpeed = 8f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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(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 diff --git a/Items/Weapons/Scorpion.cs b/Items/Weapons/Scorpion.cs index 434f9d2fc1..549ae00b37 100644 --- a/Items/Weapons/Scorpion.cs +++ b/Items/Weapons/Scorpion.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; - -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("Rockets\nRight click to change modes"); } - 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 = 3050000; - 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 * 3f), 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(); - } - } + 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 = 3050000; + 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 * 3f), 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 diff --git a/Items/Weapons/ScourgeoftheCosmos.cs b/Items/Weapons/ScourgeoftheCosmos.cs index df28f0ae68..2346882186 100644 --- a/Items/Weapons/ScourgeoftheCosmos.cs +++ b/Items/Weapons/ScourgeoftheCosmos.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 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"); } - public override void SetDefaults() - { - item.width = 18; - item.damage = 2000; - 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 = 4000000; - item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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 = 2000; + 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 = 4000000; + item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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/ScourgeoftheCosmosThrown.cs b/Items/Weapons/ScourgeoftheCosmosThrown.cs index 7d58bf740f..351ac0db69 100644 --- a/Items/Weapons/ScourgeoftheCosmosThrown.cs +++ b/Items/Weapons/ScourgeoftheCosmosThrown.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 ScourgeoftheCosmosThrown : 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 ScourgeoftheCosmosThrown : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Cosmos"); } - public override void SetDefaults() - { - item.width = 18; - item.damage = 2000; - item.thrown = 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 = 4000000; - item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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 SetDefaults() + { + item.width = 18; + item.damage = 2000; + item.thrown = 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 = 4000000; + item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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/Weapons/ScourgeoftheDesert.cs b/Items/Weapons/ScourgeoftheDesert.cs index b52af02701..1130261b7f 100644 --- a/Items/Weapons/ScourgeoftheDesert.cs +++ b/Items/Weapons/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.Weapons -{ - public class ScourgeoftheDesert : 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 ScourgeoftheDesert : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Desert"); - Tooltip.SetDefault("Revengeance drop"); + Tooltip.SetDefault("Revengeance drop"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 18; - item.thrown = true; - 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 = 15000; - item.rare = 2; - item.shoot = mod.ProjectileType("ScourgeoftheDesert"); - item.shootSpeed = 12f; - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 18; + item.thrown = true; + 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 = 15000; + item.rare = 2; + item.shoot = mod.ProjectileType("ScourgeoftheDesert"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Weapons/Seabow.cs b/Items/Weapons/Seabow.cs index ac7c834fcc..758aca024f 100644 --- a/Items/Weapons/Seabow.cs +++ b/Items/Weapons/Seabow.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 Seabow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seabow"); - } - - 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 = 45000; - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class Seabow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seabow"); + } + + 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 = 45000; + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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 diff --git a/Items/Weapons/Seadragon.cs b/Items/Weapons/Seadragon.cs index 0f904d0d2b..d40bfa24d6 100644 --- a/Items/Weapons/Seadragon.cs +++ b/Items/Weapons/Seadragon.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 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"); } - public override void SetDefaults() - { - item.damage = 158; - 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 = 1500000; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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, 0.0f, 0.0f); - if (Main.rand.Next(10) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SeaDragonRocket"), damage * 2, 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(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(); - } - } + public override void SetDefaults() + { + item.damage = 158; + 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 = 1500000; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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, 0.0f, 0.0f); + if (Main.rand.Next(10) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SeaDragonRocket"), damage * 2, 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(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 diff --git a/Items/Weapons/Seadragon.png b/Items/Weapons/Seadragon.png index 3e7745cc33..442f7e2cac 100644 Binary files a/Items/Weapons/Seadragon.png and b/Items/Weapons/Seadragon.png differ diff --git a/Items/Weapons/SeashellBoomerang.cs b/Items/Weapons/SeashellBoomerang.cs index b01e269c75..5e66b174fd 100644 --- a/Items/Weapons/SeashellBoomerang.cs +++ b/Items/Weapons/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.Weapons -{ - public class SeashellBoomerang : 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.thrown = true; - item.height = 34; - item.value = 50000; - item.rare = 2; - item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); - 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 SeashellBoomerang : 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.thrown = true; + item.height = 34; + item.value = 50000; + item.rare = 2; + item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); + 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/SeashellBoomerangMelee.cs b/Items/Weapons/SeashellBoomerangMelee.cs index f82c7489ce..a85ad56310 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; //The width of the .png file in pixels divided by 2. - item.damage = 15; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 5.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.melee = true; //Dictates whether the weapon can be "auto-fired". - item.height = 34; //The height of the .png file in pixels divided by 2. - item.value = 50000; //Value is calculated in copper coins. - item.rare = 2; //Ranges from 1 to 11. - 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; //The width of the .png file in pixels divided by 2. + item.damage = 15; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 5.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.melee = true; //Dictates whether the weapon can be "auto-fired". + item.height = 34; //The height of the .png file in pixels divided by 2. + item.value = 50000; //Value is calculated in copper coins. + item.rare = 2; //Ranges from 1 to 11. + 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 a2117551a4..05d5907ca2 100644 --- a/Items/Weapons/ShadecrystalTome.cs +++ b/Items/Weapons/ShadecrystalTome.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 ShadecrystalTome : 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 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 = 550000; - 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(); - } + 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 = 550000; + 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 diff --git a/Items/Weapons/ShadowboltStaff.cs b/Items/Weapons/ShadowboltStaff.cs index 7d1d0f1a4e..83739b121c 100644 --- a/Items/Weapons/ShadowboltStaff.cs +++ b/Items/Weapons/ShadowboltStaff.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 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 = 126; - 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 = 800000; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Shadowbolt"); - item.shootSpeed = 6f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArmoredShell", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(ItemID.ShadowbeamStaff); - 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 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 = 126; + 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 = 800000; + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Shadowbolt"); + item.shootSpeed = 6f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArmoredShell", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(ItemID.ShadowbeamStaff); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/Shimmerspark.cs b/Items/Weapons/Shimmerspark.cs index 8d53eebc77..2beb7b5553 100644 --- a/Items/Weapons/Shimmerspark.cs +++ b/Items/Weapons/Shimmerspark.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 Shimmerspark : 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 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 = 32; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.2f; - item.value = 100000; - 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(); - } + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Chik); + item.damage = 32; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.2f; + item.value = 100000; + 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 diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index a3d8abc798..f1a77b6b6a 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,91 +19,91 @@ 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 = 1000000; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - } - - 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 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) - { - int num6 = Main.rand.Next(5, 12); - for (int index = 0; index < num6; ++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, 0.0f, 0.0f); - Main.projectile[shot].timeLeft = 180; - } - return false; - } - else - { - int num6 = Main.rand.Next(5, 12); - for (int index = 0; index < num6; ++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"), (int)((double)damage * 1.2), knockBack, player.whoAmI, 0.0f, 0.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(); - } - } + 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 = 1000000; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + } + + 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 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) + { + int num6 = Main.rand.Next(5, 12); + for (int index = 0; index < num6; ++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, 0.0f, 0.0f); + Main.projectile[shot].timeLeft = 180; + } + return false; + } + else + { + int num6 = Main.rand.Next(5, 12); + for (int index = 0; index < num6; ++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"), (int)((double)damage * 1.2), knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/Shroomer.cs b/Items/Weapons/Shroomer.cs index 216d96c3c0..a6bb0c52ba 100644 --- a/Items/Weapons/Shroomer.cs +++ b/Items/Weapons/Shroomer.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 Shroomer : 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 Shroomer : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Shroomer"); } - 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 = 900000; - 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, 0.0f, 0.0f); - if (Main.rand.Next(5) == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shroom"), (int)((double)damage * 1.5f), knockBack, player.whoAmI, 0.0f, 0.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(); - } + 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 = 900000; + 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, 0.0f, 0.0f); + if (Main.rand.Next(5) == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shroom"), (int)((double)damage * 1.5f), knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/SkyGlaze.cs b/Items/Weapons/SkyGlaze.cs index dbbb85a173..9bb289c9dc 100644 --- a/Items/Weapons/SkyGlaze.cs +++ b/Items/Weapons/SkyGlaze.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; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons { -public class SkyGlaze : 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 SkyGlaze : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Glaze"); @@ -17,74 +17,74 @@ public class SkyGlaze : ModItem Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 8; - 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 = 30000; - 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; - } + public override void SetDefaults() + { + item.damage = 8; + 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 = 30000; + 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 diff --git a/Items/Weapons/SlagMagnum.cs b/Items/Weapons/SlagMagnum.cs index bf18a9069a..74a445fddb 100644 --- a/Items/Weapons/SlagMagnum.cs +++ b/Items/Weapons/SlagMagnum.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 SlagMagnum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slag Magnum"); - } - - 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 = 100000; - 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, 0.0f, 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 +{ + public class SlagMagnum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slag Magnum"); + } + + 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 = 100000; + 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/AbyssalTome.cs b/Items/Weapons/SlimeGod/AbyssalTome.cs index 3637bdbcb5..4d6dcbf166 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 = 150000; - item.rare = 4; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AbyssBall"); - item.shootSpeed = 9f; - } - } +using System; +using System.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 = 150000; + item.rare = 4; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AbyssBall"); + item.shootSpeed = 9f; + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/AbyssalTome.png b/Items/Weapons/SlimeGod/AbyssalTome.png index 0b1ed2c541..3c233be4bb 100644 Binary files a/Items/Weapons/SlimeGod/AbyssalTome.png and b/Items/Weapons/SlimeGod/AbyssalTome.png differ diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.cs b/Items/Weapons/SlimeGod/CorroslimeStaff.cs index 51311996a1..2bcf65bce4 100644 --- a/Items/Weapons/SlimeGod/CorroslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CorroslimeStaff.cs @@ -1,92 +1,92 @@ -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 = 150000; - 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 Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Corroslime"), num73, num74, i, 0f, 0f); - return false; - } - } +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 = 150000; + 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 Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Corroslime"), num73, num74, i, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs index 5fc35845ab..d76c1fe898 100644 --- a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.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.SlimeGod -{ - public class CorruptedCrusherBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupted Crusher Blade"); - } - - 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 = 90000; - 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 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.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 15); - recipe.AddIngredient(ItemID.EbonstoneBlock, 50); - recipe.AddIngredient(ItemID.ShadowScale, 5); - recipe.AddIngredient(ItemID.LeadBar, 4); - recipe.AddTile(TileID.DemonAltar); - 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.SlimeGod +{ + public class CorruptedCrusherBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupted Crusher Blade"); + } + + 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 = 90000; + 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 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.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 15); + recipe.AddIngredient(ItemID.EbonstoneBlock, 50); + recipe.AddIngredient(ItemID.ShadowScale, 5); + recipe.AddIngredient(ItemID.LeadBar, 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.cs b/Items/Weapons/SlimeGod/CrimslimeStaff.cs index 869cff00f9..a8ff56f1d5 100644 --- a/Items/Weapons/SlimeGod/CrimslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CrimslimeStaff.cs @@ -1,92 +1,92 @@ -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 = 150000; - 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 Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Crimslime"), num73, num74, i, 0f, 0f); - return false; - } - } +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 = 150000; + 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 Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Crimslime"), num73, num74, i, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs index d91956af08..2acc40e8d9 100644 --- a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.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.SlimeGod -{ - public class CrimsonCrusherBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Crusher Blade"); - } - - 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 = 90000; - 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 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.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 15); - recipe.AddIngredient(ItemID.CrimstoneBlock, 50); - recipe.AddIngredient(ItemID.TissueSample, 5); - recipe.AddIngredient(ItemID.LeadBar, 4); - recipe.AddTile(TileID.DemonAltar); - 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.SlimeGod +{ + public class CrimsonCrusherBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Crusher Blade"); + } + + 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 = 90000; + 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 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.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 15); + recipe.AddIngredient(ItemID.CrimstoneBlock, 50); + recipe.AddIngredient(ItemID.TissueSample, 5); + recipe.AddIngredient(ItemID.LeadBar, 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/EldritchTome.cs b/Items/Weapons/SlimeGod/EldritchTome.cs index b7b4e2c450..aa652f4817 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 = 180000; - 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; - } - } +using System; +using System.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 = 180000; + 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 diff --git a/Items/Weapons/SlimeGod/EldritchTome.png b/Items/Weapons/SlimeGod/EldritchTome.png index 5791ff3da4..d7e49af5cc 100644 Binary files a/Items/Weapons/SlimeGod/EldritchTome.png and b/Items/Weapons/SlimeGod/EldritchTome.png differ diff --git a/Items/Weapons/SlimeGod/GelDart.cs b/Items/Weapons/SlimeGod/GelDart.cs index 05b3b00036..d2b68af432 100644 --- a/Items/Weapons/SlimeGod/GelDart.cs +++ b/Items/Weapons/SlimeGod/GelDart.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.SlimeGod -{ - public class GelDart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gel Dart"); - } - - public override void SetDefaults() - { - item.width = 14; - item.damage = 25; - item.thrown = true; - 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; - } - - 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.Weapons.SlimeGod +{ + public class GelDart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gel Dart"); + } + + public override void SetDefaults() + { + item.width = 14; + item.damage = 25; + item.thrown = true; + 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; + } + + 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/Weapons/SlimeGod/GeliticBlade.cs b/Items/Weapons/SlimeGod/GeliticBlade.cs index 476bdb6793..50711c1803 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"); - } - - 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.maxStack = 1; - item.value = 250000; - 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, 200); - } - } -} +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"); + } + + 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.maxStack = 1; + item.value = 250000; + 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, 200); + } + } +} diff --git a/Items/Weapons/SlimeGod/Goobow.cs b/Items/Weapons/SlimeGod/Goobow.cs index 86f0386a4c..7fd928846f 100644 --- a/Items/Weapons/SlimeGod/Goobow.cs +++ b/Items/Weapons/SlimeGod/Goobow.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.SlimeGod -{ - public class Goobow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Goobow"); - } - - public override void SetDefaults() - { - item.damage = 42; - item.ranged = true; - item.width = 30; - item.height = 48; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = 105000; - item.rare = 4; - 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, "PurifiedGel", 18); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.SlimeGod +{ + public class Goobow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goobow"); + } + + public override void SetDefaults() + { + item.damage = 42; + item.ranged = true; + item.width = 30; + item.height = 48; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = 105000; + item.rare = 4; + 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, "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 diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs index c61cf29298..f672f24bd4 100644 --- a/Items/Weapons/SlimeGod/GunkShot.cs +++ b/Items/Weapons/SlimeGod/GunkShot.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.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"); } - - public override void SetDefaults() - { - item.damage = 25; - 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 = 220000; - 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, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - 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(); - } - } + + public override void SetDefaults() + { + item.damage = 25; + 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 = 220000; + 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, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + 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 diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 3f484c3032..15fd2ac98b 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.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 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"); } - - 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 = 100000; - 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) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(5, 6); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } + + 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 = 100000; + 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) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(5, 6); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/TheGodsGambit.cs b/Items/Weapons/SlimeGod/TheGodsGambit.cs index 5438688d7f..dd47999ddf 100644 --- a/Items/Weapons/SlimeGod/TheGodsGambit.cs +++ b/Items/Weapons/SlimeGod/TheGodsGambit.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.SlimeGod -{ - public class TheGodsGambit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The God's Gambit"); - } - - 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 = 300000; - 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(); - } - } +using System; +using System.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"); + } + + 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 = 300000; + 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 diff --git a/Items/Weapons/SolsticeClaymore.cs b/Items/Weapons/SolsticeClaymore.cs index fd8ae10070..796f8c0b4b 100644 --- a/Items/Weapons/SolsticeClaymore.cs +++ b/Items/Weapons/SolsticeClaymore.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; - -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 = 315; - 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 = 2400000; - item.shoot = mod.ProjectileType("SolsticeBeam"); - item.shootSpeed = 16f; - } - - 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 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 = 315; + 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 = 2400000; + item.shoot = mod.ProjectileType("SolsticeBeam"); + item.shootSpeed = 16f; + } + + 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 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 54711ae6ab..c835f75460 100644 --- a/Items/Weapons/SomaPrime.cs +++ b/Items/Weapons/SomaPrime.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.Weapons -{ - public class SomaPrime : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soma Prime"); - } - - public override void SetDefaults() - { - item.damage = 300; - item.ranged = true; - item.width = 94; - item.height = 34; - item.crit += 50; - item.useTime = 1; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = 10000000; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SlashRound"); - item.shootSpeed = 30f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +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"); + } + + public override void SetDefaults() + { + item.damage = 300; + item.ranged = true; + item.width = 94; + item.height = 34; + item.crit += 50; + item.useTime = 1; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = 10000000; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SlashRound"); + item.shootSpeed = 30f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/SoulHarvester.cs b/Items/Weapons/SoulHarvester.cs index d8fd14a328..f72885563a 100644 --- a/Items/Weapons/SoulHarvester.cs +++ b/Items/Weapons/SoulHarvester.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 SoulHarvester : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Harvester"); - Tooltip.SetDefault("Enemies explode when on low health, spreading the plague"); - } - - public override void SetDefaults() - { - item.width = 62; - item.damage = 98; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 64; - item.maxStack = 1; - item.value = 550000; - item.rare = 9; - 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"), 200); - target.AddBuff(BuffID.CursedInferno, 200); - if (target.life <= (target.lifeMax * 0.15f)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), damage, knockback, Main.myPlayer); - player.position.X = player.position.X + (float)(player.width / 2); - player.position.Y = player.position.Y + (float)(player.height / 2); - player.position.X = player.position.X - (float)(player.width / 2); - player.position.Y = player.position.Y - (float)(player.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} +using System; +using System.Collections.Generic; +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("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.maxStack = 1; + item.value = 550000; + item.rare = 9; + 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"), 200); + target.AddBuff(BuffID.CursedInferno, 200); + if (target.life <= (target.lifeMax * 0.15f)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + player.position.X = player.position.X + (float)(player.width / 2); + player.position.Y = player.position.Y + (float)(player.height / 2); + player.position.X = player.position.X - (float)(player.width / 2); + player.position.Y = player.position.Y - (float)(player.height / 2); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/Items/Weapons/SoulPiercer.cs b/Items/Weapons/SoulPiercer.cs index 4738fe56bc..8d99c225dd 100644 --- a/Items/Weapons/SoulPiercer.cs +++ b/Items/Weapons/SoulPiercer.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 SoulPiercer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Piercer"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 150; - 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 = 1350000; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SoulPiercer"); - item.shootSpeed = 6f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - 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 SoulPiercer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Piercer"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 150; + 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 = 1350000; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SoulPiercer"); + item.shootSpeed = 6f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/SpatialLance.cs b/Items/Weapons/SpatialLance.cs index 30c3b0e7e3..0ff80262e3 100644 --- a/Items/Weapons/SpatialLance.cs +++ b/Items/Weapons/SpatialLance.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 SpatialLance : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Lance"); - Tooltip.SetDefault("Rend the cosmos asunder!"); - } - - public override void SetDefaults() - { - item.width = 88; - item.damage = 104; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = 5; - item.useTime = 18; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = 10000000; - item.shoot = mod.ProjectileType("SpatialLanceProjectile"); - item.shootSpeed = 12f; - } - - 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 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!"); + } + + public override void SetDefaults() + { + item.width = 88; + item.damage = 104; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 5; + item.useTime = 18; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 88; + item.value = 10000000; + item.shoot = mod.ProjectileType("SpatialLanceProjectile"); + item.shootSpeed = 12f; + } + + 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 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/SpearofPaleolith.cs b/Items/Weapons/SpearofPaleolith.cs index fc2f1201f6..c58b788a7b 100644 --- a/Items/Weapons/SpearofPaleolith.cs +++ b/Items/Weapons/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.Weapons -{ - public class SpearofPaleolith : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear of Paleolith"); - Tooltip.SetDefault("Throws an ancient spear that shatters enemy armor at high velocity\nSpears rain fossil shards as they travel"); - } - - public override void SetDefaults() - { - item.width = 54; - item.damage = 50; - item.thrown = true; - 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.maxStack = 1; - item.value = 330000; - item.rare = 5; - item.shoot = mod.ProjectileType("SpearofPaleolith"); - item.shootSpeed = 35f; - } - - 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.Weapons +{ + public class SpearofPaleolith : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear of Paleolith"); + Tooltip.SetDefault("Throws an ancient spear that shatters enemy armor at high velocity\nSpears rain fossil shards as they travel"); + } + + public override void SetDefaults() + { + item.width = 54; + item.damage = 50; + item.thrown = true; + 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.maxStack = 1; + item.value = 330000; + item.rare = 5; + item.shoot = mod.ProjectileType("SpearofPaleolith"); + item.shootSpeed = 35f; + } + + 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/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index a4afcad259..fc41abaf08 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.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 -{ - 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; + +namespace CalamityMod.Items.Weapons +{ + public class SpectralstormCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Spectralstorm Cannon"); Tooltip.SetDefault("70% chance to not consume flares\nFires 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 = 900000; - 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 projectile2 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile2].magic = false; - Main.projectile[projectile2].ranged = 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(); - } - } + 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 = 900000; + 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 projectile2 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile2].magic = false; + Main.projectile[projectile2].ranged = 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 diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs index 08aa3c6f7f..5b3403bbd2 100644 --- a/Items/Weapons/SpectreRifle.cs +++ b/Items/Weapons/SpectreRifle.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 SpectreRifle : 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 SpectreRifle : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Spectre Rifle"); } - public override void SetDefaults() - { - item.damage = 150; - item.ranged = true; - item.width = 68; - item.height = 24; - item.crit += 22; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7; - item.value = 550000; - item.rare = 8; - item.UseSound = SoundID.Item40; - item.autoReuse = false; - item.shoot = 297; - item.shootSpeed = 24f; - 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 projectile2 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile2].magic = false; - Main.projectile[projectile2].ranged = 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(); - } + public override void SetDefaults() + { + item.damage = 150; + item.ranged = true; + item.width = 68; + item.height = 24; + item.crit += 22; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7; + item.value = 550000; + item.rare = 8; + item.UseSound = SoundID.Item40; + item.autoReuse = false; + item.shoot = 297; + item.shootSpeed = 24f; + 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 projectile2 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile2].magic = false; + Main.projectile[projectile2].ranged = 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 diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs index 774bd672e2..99202a0b79 100644 --- a/Items/Weapons/SporeKnife.cs +++ b/Items/Weapons/SporeKnife.cs @@ -1,62 +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 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; //Ranges from 1 to 55. - item.width = 28; //The width of the .png file in pixels divided by 2. - item.height = 28; //The height of the .png file in pixels divided by 2. - item.damage = 33; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.knockBack = 5.75f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.maxStack = 1; - item.value = 45000; //Value is calculated in copper coins. - item.rare = 3; //Ranges from 1 to 11. - } - - 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) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), damage, knockback, Main.myPlayer); - } - } -}} +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 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; //Ranges from 1 to 55. + item.width = 28; //The width of the .png file in pixels divided by 2. + item.height = 28; //The height of the .png file in pixels divided by 2. + item.damage = 33; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.knockBack = 5.75f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.maxStack = 1; + item.value = 45000; //Value is calculated in copper coins. + item.rare = 3; //Ranges from 1 to 11. + } + + 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) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/Spyker.cs b/Items/Weapons/Spyker.cs index 7a81fd88e9..6e0510a46a 100644 --- a/Items/Weapons/Spyker.cs +++ b/Items/Weapons/Spyker.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 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 that also stick to enemies/tiles and explode"); } - public override void SetDefaults() - { - item.damage = 182; - 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 = 1250000; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("Spyker"); - item.useAmmo = 97; - } - - 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 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(); - } - } + public override void SetDefaults() + { + item.damage = 182; + 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 = 1250000; + item.UseSound = SoundID.Item108; + item.autoReuse = true; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("Spyker"); + item.useAmmo = 97; + } + + 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 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 diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 919c08be12..cfa3ebd9cb 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; - -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; + +namespace CalamityMod.Items.Weapons +{ + public class StarCannonEX : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Star Cannon EX"); } - - public override void SetDefaults() - { - item.damage = 70; - 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 = 750000; - 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, 0.0f, 0.0f); - Main.projectile[star].ranged = true; - Main.projectile[star].magic = false; - Main.projectile[star].melee = false; - Main.projectile[star].netUpdate = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StarCannon); - recipe.AddIngredient(null, "AstralBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + + public override void SetDefaults() + { + item.damage = 70; + 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 = 750000; + 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, 0.0f, 0.0f); + Main.projectile[star].ranged = true; + Main.projectile[star].magic = false; + Main.projectile[star].melee = false; + Main.projectile[star].netUpdate = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StarCannon); + recipe.AddIngredient(null, "AstralBar", 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/StardustStaff.cs b/Items/Weapons/StardustStaff.cs index b653bb0dec..1f44f0934c 100644 --- a/Items/Weapons/StardustStaff.cs +++ b/Items/Weapons/StardustStaff.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 StardustStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Staff"); - Tooltip.SetDefault("The power of an ancient cultist resonates within this staff"); - 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 = 7; - item.value = 1550000; - 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; - } - } +using System; +using System.Collections.Generic; +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"); + 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 = 7; + item.value = 1550000; + 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 diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs index 39052c501b..0de2fe2b42 100644 --- a/Items/Weapons/Starfleet.cs +++ b/Items/Weapons/Starfleet.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 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"); } - - 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 = 1000000; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaBlast"); - item.shootSpeed = 12f; - item.useAmmo = 75; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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); - } - } - } - - public override bool 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(5, 6); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 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(); - } - } + + 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 = 1000000; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaBlast"); + item.shootSpeed = 12f; + item.useAmmo = 75; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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); + } + } + } + + public override bool 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(5, 6); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 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 diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs index fc471d5431..881d69ce4f 100644 --- a/Items/Weapons/StarfleetMK2.cs +++ b/Items/Weapons/StarfleetMK2.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 -{ - public class StarfleetMK2 : 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 StarfleetMK2 : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Starmada"); } - - public override void SetDefaults() - { - item.damage = 300; - item.knockBack = 15f; - item.shootSpeed = 16f; - item.useStyle = 5; - item.useAnimation = 27; - item.useTime = 27; - item.reuseDelay = 0; - item.width = 98; - item.height = 32; - item.UseSound = SoundID.Item92; - item.shoot = mod.ProjectileType("StarfleetMK2"); - item.rare = 15; - item.value = Item.sellPrice(5, 0, 0, 0); - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = 75; - item.autoReuse = true; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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(); - } - } + + public override void SetDefaults() + { + item.damage = 300; + item.knockBack = 15f; + item.shootSpeed = 16f; + item.useStyle = 5; + item.useAnimation = 27; + item.useTime = 27; + item.reuseDelay = 0; + item.width = 98; + item.height = 32; + item.UseSound = SoundID.Item92; + item.shoot = mod.ProjectileType("StarfleetMK2"); + item.rare = 15; + item.value = Item.sellPrice(5, 0, 0, 0); + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.useTurn = false; + item.useAmmo = 75; + item.autoReuse = true; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/StarnightLance.cs b/Items/Weapons/StarnightLance.cs index 5916651eec..7c184bc4e9 100644 --- a/Items/Weapons/StarnightLance.cs +++ b/Items/Weapons/StarnightLance.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 StarnightLance : 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 StarnightLance : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Starnight Lance"); - } - - public override void SetDefaults() - { - item.width = 72; //The width of the .png file in pixels divided by 2. - item.damage = 50; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 5; - item.useTime = 23; - item.knockBack = 6; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". - item.height = 72; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 325000; //Value is calculated in copper coins. - item.rare = 5; //Ranges from 1 to 11. - 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(); - } -}} + } + + public override void SetDefaults() + { + item.width = 72; //The width of the .png file in pixels divided by 2. + item.damage = 50; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 5; + item.useTime = 23; + item.knockBack = 6; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". + item.height = 72; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 325000; //Value is calculated in copper coins. + item.rare = 5; //Ranges from 1 to 11. + 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 e856f8da1d..619e0ffe41 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -1,125 +1,125 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -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; + +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.maxStack = 1; - item.value = 800000; - item.shootSpeed = 12f; - } - - 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 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 meteor = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, damage, knockback, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[meteor].magic = false; - Main.projectile[meteor].melee = 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.maxStack = 1; + item.value = 800000; + item.shootSpeed = 12f; + } + + 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 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 meteor = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((float)item.damage * player.meleeDamage), knockback, i, 0f, (float)Main.rand.Next(3)); + Main.projectile[meteor].magic = false; + Main.projectile[meteor].melee = 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 11cf50e65b..c8485ef661 100644 --- a/Items/Weapons/StormDragoon.cs +++ b/Items/Weapons/StormDragoon.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 StormDragoon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Dragoon"); - } - - public override void SetDefaults() - { - item.damage = 110; - 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 = 1500000; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - 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, 0.0f, 0.0f); - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) <= 90) - 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 +{ + public class StormDragoon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Dragoon"); + } + + public override void SetDefaults() + { + item.damage = 110; + 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 = 1500000; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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, 0.0f, 0.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 diff --git a/Items/Weapons/StormRuler.cs b/Items/Weapons/StormRuler.cs index f4ac384fc5..2e254e5121 100644 --- a/Items/Weapons/StormRuler.cs +++ b/Items/Weapons/StormRuler.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 StormRuler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Ruler"); - Tooltip.SetDefault("Only a storm can fell a greatwood"); - } - - public override void SetDefaults() - { - item.width = 74; - item.damage = 105; - 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 = 3000000; - 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"); + } + + public override void SetDefaults() + { + item.width = 74; + item.damage = 105; + 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 = 3000000; + 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 0b446961b9..3a3e0ba4a7 100644 --- a/Items/Weapons/StormSaber.cs +++ b/Items/Weapons/StormSaber.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; - -namespace CalamityMod.Items.Weapons -{ - public class StormSaber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Saber"); - } - - 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 = 300000; - 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"); + } + + 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 = 300000; + 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 64f3f2b9d8..8f59f608ce 100644 --- a/Items/Weapons/StormSurge.cs +++ b/Items/Weapons/StormSurge.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 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\nDoes 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; //so the item's animation doesn't do damage - item.knockBack = 5f; - item.UseSound = SoundID.Item122; - item.value = 10000; - item.rare = 2; - item.autoReuse = false; - item.shoot = mod.ProjectileType("StormSurge"); //idk why but all the guns in the vanilla source have this - 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(); - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 5f; + item.UseSound = SoundID.Item122; + item.value = 10000; + item.rare = 2; + item.autoReuse = false; + item.shoot = mod.ProjectileType("StormSurge"); //idk why but all the guns in the vanilla source have this + 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 diff --git a/Items/Weapons/StreamGouge.cs b/Items/Weapons/StreamGouge.cs index e04ecd5bfe..26ab510255 100644 --- a/Items/Weapons/StreamGouge.cs +++ b/Items/Weapons/StreamGouge.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 StreamGouge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream Gouge"); - Tooltip.SetDefault("Fires an essence flame beam\nThis spear ignores npc immunity frames"); - } - - public override void SetDefaults() - { - item.width = 86; - item.damage = 280; - 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.maxStack = 1; - item.value = 1350000; - item.shoot = mod.ProjectileType("StreamGouge"); - item.shootSpeed = 15f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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\nThis spear ignores npc immunity frames"); + } + + public override void SetDefaults() + { + item.width = 86; + item.damage = 280; + 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.maxStack = 1; + item.value = 1350000; + item.shoot = mod.ProjectileType("StreamGouge"); + item.shootSpeed = 15f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 97b15c29ce..056505108c 100644 --- a/Items/Weapons/SubsumingVortex.cs +++ b/Items/Weapons/SubsumingVortex.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 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 = 165; - 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 = 100000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Vortex"); - item.shootSpeed = 9f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override bool 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(); - } - } + public override void SetDefaults() + { + item.damage = 182; + 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 = 100000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Vortex"); + item.shootSpeed = 9f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/SunGodStaff.cs b/Items/Weapons/SunGodStaff.cs index 39f33085c4..4861fa00c7 100644 --- a/Items/Weapons/SunGodStaff.cs +++ b/Items/Weapons/SunGodStaff.cs @@ -1,102 +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 = 120000; - item.rare = 6; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarGod"); - item.shootSpeed = 10f; - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = 0; - 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 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - 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(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("SolarGod"), num73, num74, i, 0f, 0f); - return false; - } - } +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 = 120000; + 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 diff --git a/Items/Weapons/SunSpiritStaff.cs b/Items/Weapons/SunSpiritStaff.cs index a370d3bcb5..0a7cb0e5c0 100644 --- a/Items/Weapons/SunSpiritStaff.cs +++ b/Items/Weapons/SunSpiritStaff.cs @@ -1,99 +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 = 6; - 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 = 12000; - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarPixie"); - item.shootSpeed = 10f; - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = 0; - 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 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - 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(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("SolarPixie"), num73, num74, i, 0f, 0f); - return false; - } - } +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 = 6; + 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 = 12000; + 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 diff --git a/Items/Weapons/SuperballBullet.cs b/Items/Weapons/SuperballBullet.cs index 077626f922..28db59ec15 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(); - } - } + + 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 diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs index 560a0e4f1a..ef42dea8aa 100644 --- a/Items/Weapons/Svantechnical.cs +++ b/Items/Weapons/Svantechnical.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 Svantechnical : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Svantechnical"); - } - - public override void SetDefaults() - { - item.damage = 350; - 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 = 500000; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = 10; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - 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(); - } - } +using System; +using System.Collections.Generic; +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"); + } + + public override void SetDefaults() + { + item.damage = 350; + 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 = 500000; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = 10; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + 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 diff --git a/Items/Weapons/T1000.cs b/Items/Weapons/T1000.cs index a07fb3b671..9dc3e4a28a 100644 --- a/Items/Weapons/T1000.cs +++ b/Items/Weapons/T1000.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 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"); } - public override void SetDefaults() - { - item.damage = 174; - 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 = 10000000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("T1000"); - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - } - } + public override void SetDefaults() + { + item.damage = 174; + 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 = 10000000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("T1000"); + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Weapons/TarragonThrowingDart.cs b/Items/Weapons/TarragonThrowingDart.cs index f50763c414..372895572c 100644 --- a/Items/Weapons/TarragonThrowingDart.cs +++ b/Items/Weapons/TarragonThrowingDart.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 TarragonThrowingDart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Throwing Dart"); - } - - public override void SetDefaults() - { - item.width = 34; - item.damage = 184; - item.thrown = true; - 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; - } - - 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 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.Weapons +{ + public class TarragonThrowingDart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Throwing Dart"); + } + + public override void SetDefaults() + { + item.width = 34; + item.damage = 184; + item.thrown = true; + 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; + } + + 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 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/Weapons/TeardropCleaver.cs b/Items/Weapons/TeardropCleaver.cs index 58afd59ca7..44356e680c 100644 --- a/Items/Weapons/TeardropCleaver.cs +++ b/Items/Weapons/TeardropCleaver.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 { -public class TeardropCleaver : 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 TeardropCleaver : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Teardrop Cleaver"); Tooltip.SetDefault("Makes your enemies cry"); } - - public override void SetDefaults() - { - item.width = 52; //The width of the .png file in pixels divided by 2. - item.damage = 15; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 4.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 50000; //Value is calculated in copper coins. - item.rare = 2; //Ranges from 1 to 11. - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 60); - } -}} + + public override void SetDefaults() + { + item.width = 52; //The width of the .png file in pixels divided by 2. + item.damage = 15; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 4.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 56; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 50000; //Value is calculated in copper coins. + item.rare = 2; //Ranges from 1 to 11. + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 60); + } +}} diff --git a/Items/Weapons/TearsofHeaven.cs b/Items/Weapons/TearsofHeaven.cs index a1a41f1c54..06154f49ae 100644 --- a/Items/Weapons/TearsofHeaven.cs +++ b/Items/Weapons/TearsofHeaven.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.Weapons -{ - public class TearsofHeaven : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tears of Heaven"); - Tooltip.SetDefault("Casts slow-moving balls of heavenly light"); - } - - public override void SetDefaults() - { - item.damage = 65; - 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 = 1000000; - 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", 3); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.Bookcases); - 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 TearsofHeaven : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tears of Heaven"); + Tooltip.SetDefault("Casts slow-moving balls of heavenly light"); + } + + public override void SetDefaults() + { + item.damage = 65; + 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 = 1000000; + 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", 3); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/TearsofHeaven.png b/Items/Weapons/TearsofHeaven.png index b471a3f3ed..ca1c1b6933 100644 Binary files a/Items/Weapons/TearsofHeaven.png and b/Items/Weapons/TearsofHeaven.png differ diff --git a/Items/Weapons/TemporalFloeSword.cs b/Items/Weapons/TemporalFloeSword.cs index b5666e96d1..06c16adbe1 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..."); - } - - 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.maxStack = 1; - item.value = 1500000; - 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..."); + } + + 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.maxStack = 1; + item.value = 1500000; + 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 1b73399771..114ba79217 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 = 13; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 2000; - item.rare = 3; - 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(); - } - } + + 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 = 2000; + item.rare = 3; + 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 diff --git a/Items/Weapons/TerraBullet.cs b/Items/Weapons/TerraBullet.cs index bb45ed7be5..485fa78476 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 = 12; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 750; - item.rare = 8; - 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(); - } - } + + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 750; + item.rare = 8; + 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 diff --git a/Items/Weapons/TerraEdge.cs b/Items/Weapons/TerraEdge.cs index cfcbc50d2d..936f1e2177 100644 --- a/Items/Weapons/TerraEdge.cs +++ b/Items/Weapons/TerraEdge.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; - -namespace CalamityMod.Items.Weapons -{ - public class TerraEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Edge"); - Tooltip.SetDefault("Heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 58; - item.damage = 150; - 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 = 1060000; - 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.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TrueNightsEdge); - recipe.AddIngredient(ItemID.TrueExcalibur); - 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, 74); - } - } - - 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(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"); + } + + public override void SetDefaults() + { + item.width = 58; + item.damage = 150; + 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 = 1060000; + 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.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TrueNightsEdge); + recipe.AddIngredient(ItemID.TrueExcalibur); + 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, 74); + } + } + + 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(2) + 2); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } +} diff --git a/Items/Weapons/TerraFlameburster.cs b/Items/Weapons/TerraFlameburster.cs index 5978e4c2d6..9a53265a54 100644 --- a/Items/Weapons/TerraFlameburster.cs +++ b/Items/Weapons/TerraFlameburster.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 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; //so the item's animation doesn't do damage - item.knockBack = 3.25f; - item.UseSound = SoundID.Item34; - item.value = 1000000; - item.rare = 9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen"); //idk why but all the guns in the vanilla source have this - 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", 5); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddIngredient(null, "PlagueCellCluster", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 3.25f; + item.UseSound = SoundID.Item34; + item.value = 1000000; + item.rare = 9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraFireGreen"); //idk why but all the guns in the vanilla source have this + 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", 5); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddIngredient(null, "PlagueCellCluster", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/TerraLance.cs b/Items/Weapons/TerraLance.cs index 5bc0785109..8f752994cc 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 -{ +using System; +using System.Collections.Generic; +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"); } - - public override void SetDefaults() - { - item.width = 44; //The width of the .png file in pixels divided by 2. - item.damage = 100; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = 5; - item.useTime = 17; - item.knockBack = 8.5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 44; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 885000; //Value is calculated in copper coins. - item.rare = 8; //Ranges from 1 to 11. - 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(null, "StarnightLance"); - recipe.AddIngredient(null, "HellionFlowerSpear"); - recipe.AddIngredient(null, "ExsanguinationLance"); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } -}} + + public override void SetDefaults() + { + item.width = 44; //The width of the .png file in pixels divided by 2. + item.damage = 100; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 17; + item.useStyle = 5; + item.useTime = 17; + item.knockBack = 8.5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 44; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 885000; //Value is calculated in copper coins. + item.rare = 8; //Ranges from 1 to 11. + 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(null, "StarnightLance"); + recipe.AddIngredient(null, "HellionFlowerSpear"); + recipe.AddIngredient(null, "ExsanguinationLance"); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } +}} diff --git a/Items/Weapons/TerraRay.cs b/Items/Weapons/TerraRay.cs index 10b55e075a..a599e67589 100644 --- a/Items/Weapons/TerraRay.cs +++ b/Items/Weapons/TerraRay.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 TerraRay : 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 TerraRay : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Ray"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 55; - item.magic = true; - item.mana = 10; - item.width = 54; - item.height = 54; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 5.5f; - item.value = 1000000; - 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, "LivingShard", 7); - recipe.AddIngredient(null, "NightsRay"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddIngredient(null, "CarnageRay"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void SetDefaults() + { + item.damage = 55; + item.magic = true; + item.mana = 10; + item.width = 54; + item.height = 54; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 5.5f; + item.value = 1000000; + 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, "LivingShard", 7); + recipe.AddIngredient(null, "NightsRay"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddIngredient(null, "CarnageRay"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } }} \ No newline at end of file diff --git a/Items/Weapons/TerraShiv.cs b/Items/Weapons/TerraShiv.cs index 232337216c..7e264fdcc1 100644 --- a/Items/Weapons/TerraShiv.cs +++ b/Items/Weapons/TerraShiv.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; - -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 = 140; - 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 = 1500000; - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueNightsStabber"); - recipe.AddIngredient(null, "TrueExcaliburShortsword"); - 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 = 140; + 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 = 1500000; + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueNightsStabber"); + recipe.AddIngredient(null, "TrueExcaliburShortsword"); + 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 0f299f0f98..04c5aec3f4 100644 --- a/Items/Weapons/Terracotta.cs +++ b/Items/Weapons/Terracotta.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; - -namespace CalamityMod.Items.Weapons -{ - public class Terracotta : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra-cotta"); - Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death\nEnemies explode on death"); - } - - public 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.maxStack = 1; - item.value = 800000; - item.rare = 8; - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BurntSienna"); - recipe.AddIngredient(null, "UnholyCore", 3); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (target.life <= 0) - { - for (i = 0; i < 1; i++) - { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), damage, knockback, Main.myPlayer); - int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), damage, knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), damage, knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), damage, knockback, Main.myPlayer); - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } - } - } -} +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\nEnemies explode on death"); + } + + 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.maxStack = 1; + item.value = 800000; + item.rare = 8; + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BurntSienna"); + recipe.AddIngredient(null, "UnholyCore", 3); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (target.life <= 0) + { + for (i = 0; i < 1; i++) + { + float randomSpeedX = (float)Main.rand.Next(3); + float randomSpeedY = (float)Main.rand.Next(3, 5); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); + int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), item.damage, knockback, Main.myPlayer); + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + } + } + } +} diff --git a/Items/Weapons/Terratomere.cs b/Items/Weapons/Terratomere.cs index 0c4e7aed55..a687cb1b5d 100644 --- a/Items/Weapons/Terratomere.cs +++ b/Items/Weapons/Terratomere.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 Terratomere : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terratomere"); - Tooltip.SetDefault("Linked to the essence of Terraria\n" + - "Heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 64; - item.damage = 100; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = 1500000; - item.rare = 10; - item.shoot = mod.ProjectileType("TerratomereProjectile"); - item.shootSpeed = 20f; - } - - public override bool 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 num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "XerocsGreatsword"); - recipe.AddIngredient(null, "Floodtide"); - recipe.AddIngredient(null, "Hellkite"); - recipe.AddIngredient(null, "TemporalFloeSword"); - recipe.AddIngredient(ItemID.TerraBlade); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "XerocsGreatsword"); - recipe.AddIngredient(null, "Floodtide"); - recipe.AddIngredient(null, "Hellkite"); - recipe.AddIngredient(null, "TemporalFloeSword"); - recipe.AddIngredient(null, "TerraEdge"); - 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, 74); - } - } - - 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"), 300); - } - target.AddBuff(BuffID.CursedInferno, 680); - target.AddBuff(BuffID.Frostburn, 620); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Ichor, 300); - if (target.type == NPCID.TargetDummy) - { - return; - } - int healAmount = (Main.rand.Next(3) + 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; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Terratomere : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terratomere"); + Tooltip.SetDefault("Linked to the essence of Terraria\n" + + "Heals the player on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 64; + item.damage = 100; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; + item.value = 1500000; + item.rare = 10; + item.shoot = mod.ProjectileType("TerratomereProjectile"); + item.shootSpeed = 20f; + } + + public override bool 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 num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "XerocsGreatsword"); + recipe.AddIngredient(null, "Floodtide"); + recipe.AddIngredient(null, "Hellkite"); + recipe.AddIngredient(null, "TemporalFloeSword"); + recipe.AddIngredient(ItemID.TerraBlade); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "XerocsGreatsword"); + recipe.AddIngredient(null, "Floodtide"); + recipe.AddIngredient(null, "Hellkite"); + recipe.AddIngredient(null, "TemporalFloeSword"); + recipe.AddIngredient(null, "TerraEdge"); + 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, 74); + } + } + + 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"), 300); + } + target.AddBuff(BuffID.CursedInferno, 680); + target.AddBuff(BuffID.Frostburn, 620); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Ichor, 300); + if (target.type == NPCID.TargetDummy) + { + return; + } + int healAmount = (Main.rand.Next(3) + 2); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } +} diff --git a/Items/Weapons/TheBallista.cs b/Items/Weapons/TheBallista.cs index 72a7656d89..144598ce10 100644 --- a/Items/Weapons/TheBallista.cs +++ b/Items/Weapons/TheBallista.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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons -{ - public class TheBallista : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ballista"); - } - - public override void SetDefaults() - { - item.damage = 95; - 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 = 6000000; - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BallistaGreatArrow"); - item.shootSpeed = 20f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.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(); - } - } +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 TheBallista : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ballista"); + } + + public override void SetDefaults() + { + item.damage = 95; + 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 = 6000000; + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BallistaGreatArrow"); + item.shootSpeed = 20f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.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 diff --git a/Items/Weapons/TheEmpyrean.cs b/Items/Weapons/TheEmpyrean.cs index c250e33961..5f443f4a16 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 = 900000; - 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(); - } - } + + 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 = 900000; + 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 diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs index 03870699cc..4b3eddbe39 100644 --- a/Items/Weapons/TheEnforcer.cs +++ b/Items/Weapons/TheEnforcer.cs @@ -1,119 +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 TheEnforcer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Enforcer"); - } - - public override void SetDefaults() - { - item.width = 64; - item.damage = 1650; - 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.maxStack = 1; - item.value = 1350000; - item.shoot = mod.ProjectileType("EssenceBurst"); - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - 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; - int num73 = Main.rand.Next(200, 280); - 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"), num73, 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"); + } + + public override void SetDefaults() + { + item.width = 64; + item.damage = 1650; + 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.maxStack = 1; + item.value = 1350000; + item.shoot = mod.ProjectileType("EssenceBurst"); + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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)((double)((float)item.damage * player.meleeDamage) * 0.25), 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 cf69548de7..27daa4610a 100644 --- a/Items/Weapons/TheMutilator.cs +++ b/Items/Weapons/TheMutilator.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -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 = 630; - 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.maxStack = 1; - item.value = 1000000; - item.shootSpeed = 10f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.2f)) - { - 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 = 630; + 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.maxStack = 1; + item.value = 1000000; + item.shootSpeed = 10f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.2f)) + { + 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 75946d337e..ead430b7ae 100644 --- a/Items/Weapons/TheStorm.cs +++ b/Items/Weapons/TheStorm.cs @@ -1,113 +1,125 @@ -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 TheStorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Storm"); - } - - 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 = 1000000; - item.UseSound = SoundID.Item122; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Bolt"); - item.shootSpeed = 28f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 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) - { - 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; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.9f), mod.ProjectileType("Bolt"), num73, num74, i, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.8f), mod.ProjectileType("Bolt"), num73, num74, i, 0f, (float)Main.rand.Next(6)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.7f), mod.ProjectileType("Bolt"), num73, num74, i, 0f, (float)Main.rand.Next(9)); - } - 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class TheStorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Storm"); + } + + 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 = 1000000; + item.UseSound = SoundID.Item122; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Bolt"); + item.shootSpeed = 28f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 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) + { + 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 diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs index eed1a93169..4375a3ee20 100644 --- a/Items/Weapons/TheSwarmer.cs +++ b/Items/Weapons/TheSwarmer.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 TheSwarmer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Swarmer"); - } - - 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 = 1000000; - 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, 0.0f, 0.0f); - Main.projectile[wasps].penetrate = 1; - } - 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, 181, damage, 0f, player.whoAmI, 0.0f, 0.0f); - Main.projectile[bees].penetrate = 1; - } - 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 +{ + public class TheSwarmer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Swarmer"); + } + + 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 = 1000000; + 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, 0.0f, 0.0f); + Main.projectile[wasps].penetrate = 1; + } + 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, 181, damage, 0f, player.whoAmI, 0.0f, 0.0f); + Main.projectile[bees].penetrate = 1; + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/TheWand.cs b/Items/Weapons/TheWand.cs index 64f1a6a0d3..5d7c6dc6c8 100644 --- a/Items/Weapons/TheWand.cs +++ b/Items/Weapons/TheWand.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; - -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 = 30000000; - item.shoot = mod.ProjectileType("SparkInfernal"); - item.shootSpeed = 24f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - 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 = 30000000; + item.shoot = mod.ProjectileType("SparkInfernal"); + item.shootSpeed = 24f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + 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 9ad1c8f0a3..9813d6ddd1 100644 --- a/Items/Weapons/TitaniumRailgun.cs +++ b/Items/Weapons/TitaniumRailgun.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 TitaniumRailgun : 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 TitaniumRailgun : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Titanium Railgun"); } - - public override void SetDefaults() - { - item.damage = 50; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 3.5f; - item.value = 550000; - 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(); - } + + public override void SetDefaults() + { + item.damage = 50; + item.ranged = true; + item.width = 62; + item.height = 26; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 3.5f; + item.value = 550000; + 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 diff --git a/Items/Weapons/TitaniumShuriken.cs b/Items/Weapons/TitaniumShuriken.cs index 4488a7f72e..8a5d81275d 100644 --- a/Items/Weapons/TitaniumShuriken.cs +++ b/Items/Weapons/TitaniumShuriken.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 TitaniumShuriken : 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 TitaniumShuriken : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Titanium Shuriken"); } - - public override void SetDefaults() - { - item.width = 38; //The width of the .png file in pixels divided by 2. - item.damage = 31; //Keep this reasonable please. - item.thrown = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 9; - item.scale = 0.75f; - item.crit = 10; - item.useStyle = 1; - item.useTime = 9; - item.knockBack = 3f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 38; //The height of the .png file in pixels divided by 2. - item.maxStack = 999; - item.value = 2000; //Value is calculated in copper coins. - item.rare = 4; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 30); - recipe.AddRecipe(); - } -}} + + public override void SetDefaults() + { + item.width = 38; //The width of the .png file in pixels divided by 2. + item.damage = 31; //Keep this reasonable please. + item.thrown = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 9; + item.scale = 0.75f; + item.crit = 10; + item.useStyle = 1; + item.useTime = 9; + item.knockBack = 3f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 38; //The height of the .png file in pixels divided by 2. + item.maxStack = 999; + item.value = 2000; //Value is calculated in copper coins. + item.rare = 4; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); + item.shootSpeed = 16f; + } + + 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/Weapons/TomeofFates.cs b/Items/Weapons/TomeofFates.cs index 0acd36b487..76a91c6198 100644 --- a/Items/Weapons/TomeofFates.cs +++ b/Items/Weapons/TomeofFates.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 TomeofFates : 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 TomeofFates : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Tome of Fates"); Tooltip.SetDefault("Casts cosmic tentacles to spear your enemies\nCan 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; //so the item's animation doesn't do damage - item.knockBack = 3.5f; - item.value = 300000; - 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; - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 3.5f; + item.value = 300000; + 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 diff --git a/Items/Weapons/Tradewinds.cs b/Items/Weapons/Tradewinds.cs index e1fc7f7301..b4f13bb2a1 100644 --- a/Items/Weapons/Tradewinds.cs +++ b/Items/Weapons/Tradewinds.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 Tradewinds : 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 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; //so the item's animation doesn't do damage - item.knockBack = 5; - item.value = 150000; - 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(); - } + + 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; //so the item's animation doesn't do damage + item.knockBack = 5; + item.value = 150000; + 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 diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs index 1c8d5dc52a..b585cf98e3 100644 --- a/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.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 TriactisTruePaladinianMageHammerofMight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - } - - public override void SetDefaults() - { - item.width = 160; //The width of the .png file in pixels divided by 2. - item.damage = 3500; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 50f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.thrown = true; //Dictates whether the weapon can be "auto-fired". - item.height = 160; //The height of the .png file in pixels divided by 2. - item.value = 100000000; //Value is calculated in copper coins. - item.shoot = mod.ProjectileType("TriactisOPHammer"); - item.shootSpeed = 25f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TruePaladinsHammer"); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(null, "ShadowspecBar", 5); - 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 TriactisTruePaladinianMageHammerofMight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); + } + + public override void SetDefaults() + { + item.width = 160; //The width of the .png file in pixels divided by 2. + item.damage = 3500; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 50f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.thrown = true; //Dictates whether the weapon can be "auto-fired". + item.height = 160; //The height of the .png file in pixels divided by 2. + item.value = 100000000; //Value is calculated in copper coins. + item.shoot = mod.ProjectileType("TriactisOPHammer"); + item.shootSpeed = 25f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TruePaladinsHammer"); + recipe.AddIngredient(ItemID.SoulofMight, 30); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs index 1356b58f1c..49791feb6b 100644 --- a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.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 TriactisTruePaladinianMageHammerofMightMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - } - - public override void SetDefaults() - { - item.width = 160; //The width of the .png file in pixels divided by 2. - item.damage = 3500; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 50f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.melee = true; //Dictates whether the weapon can be "auto-fired". - item.height = 160; //The height of the .png file in pixels divided by 2. - item.value = 100000000; //Value is calculated in copper coins. - item.shoot = mod.ProjectileType("TriactisOPHammerMelee"); - item.shootSpeed = 25f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, 0, 255); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TruePaladinsHammerMelee"); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(null, "ShadowspecBar", 5); - 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 TriactisTruePaladinianMageHammerofMightMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); + } + + public override void SetDefaults() + { + item.width = 160; //The width of the .png file in pixels divided by 2. + item.damage = 3500; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 50f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.melee = true; //Dictates whether the weapon can be "auto-fired". + item.height = 160; //The height of the .png file in pixels divided by 2. + item.value = 100000000; //Value is calculated in copper coins. + item.shoot = mod.ProjectileType("TriactisOPHammerMelee"); + item.shootSpeed = 25f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, 0, 255); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TruePaladinsHammerMelee"); + recipe.AddIngredient(ItemID.SoulofMight, 30); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs index 98ef6a87ed..3dc4ce11ad 100644 --- a/Items/Weapons/Trinity.cs +++ b/Items/Weapons/Trinity.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 Trinity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trinity"); - } - - 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 = 110000; - 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(6)) - { - case 1: type = 125; break; - case 2: type = 123; break; - case 3: 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 projectile1 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6f), knockBack, Main.myPlayer); - Main.projectile[projectile1].magic = false; - Main.projectile[projectile1].melee = 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; + +namespace CalamityMod.Items.Weapons +{ + public class Trinity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trinity"); + } + + 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 = 110000; + 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(6)) + { + case 1: type = 125; break; + case 2: type = 123; break; + case 3: 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 projectile1 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6f), knockBack, Main.myPlayer); + Main.projectile[projectile1].magic = false; + Main.projectile[projectile1].melee = 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 18c4cda80b..965dc60fde 100644 --- a/Items/Weapons/Triploon.cs +++ b/Items/Weapons/Triploon.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 Triploon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triploon"); - } - - public override void SetDefaults() - { - item.damage = 70; - 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 = 800000; - item.rare = 8; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("Triploon"); - } - - public override bool 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(ItemID.Ectoplasm, 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 Triploon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triploon"); + } + + public override void SetDefaults() + { + item.damage = 70; + 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 = 800000; + item.rare = 8; + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("Triploon"); + } + + public override bool 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(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 70d8a3b494..ce1047eb2f 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -1,147 +1,147 @@ -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 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 = 82; - 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 = 1000000; - 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); - int num73 = Main.rand.Next(60, 91); - 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 = 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(-160, 161) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; - int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, num73, num74, i, 0f, (float)Main.rand.Next(10)); - Main.projectile[star].ranged = false; - Main.projectile[star].melee = true; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), num73, 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"), 500); - } - } - } -} +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 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 = 82; + 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 = 1000000; + 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); + int num73 = Main.rand.Next(60, 91); + 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 = 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(-160, 161) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; + int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, num73, num74, i, 0f, (float)Main.rand.Next(10)); + Main.projectile[star].ranged = false; + Main.projectile[star].melee = true; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), num73, 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"), 500); + } + } + } +} diff --git a/Items/Weapons/TrueBiomeBlade.cs b/Items/Weapons/TrueBiomeBlade.cs index f02f6d2464..f5f6b74613 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 = 94; - 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 = 800000; - 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 = 94; + 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 = 800000; + 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 81f6c622ca..b076e1152e 100644 --- a/Items/Weapons/TrueBloodyEdge.cs +++ b/Items/Weapons/TrueBloodyEdge.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; - -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\nFires a bloody blade"); - } - - public override void SetDefaults() - { - item.width = 48; - item.damage = 88; - 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 = 560000; - 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\nFires a bloody blade"); + } + + public override void SetDefaults() + { + item.width = 48; + item.damage = 88; + 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 = 560000; + 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 fc6ae9e340..a5c04c828d 100644 --- a/Items/Weapons/TrueCausticEdge.cs +++ b/Items/Weapons/TrueCausticEdge.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 TrueCausticEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Caustic Edge"); - Tooltip.SetDefault("Pestilent Defilement"); - } - - public override void SetDefaults() - { - item.width = 62; //The width of the .png file in pixels divided by 2. - item.damage = 42; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 28; - item.useStyle = 1; - item.useTime = 28; - item.useTurn = true; - item.knockBack = 5.75f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 68; //The height of the .png file in pixels divided by 2. - item.value = 635000; //Value is calculated in copper coins. - item.rare = 8; //Ranges from 1 to 11. - 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.OnFire, 300); - target.AddBuff(BuffID.Venom, 180); - } - } -} +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("Pestilent Defilement"); + } + + public override void SetDefaults() + { + item.width = 62; //The width of the .png file in pixels divided by 2. + item.damage = 42; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.useAnimation = 28; + item.useStyle = 1; + item.useTime = 28; + item.useTurn = true; + item.knockBack = 5.75f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 68; //The height of the .png file in pixels divided by 2. + item.value = 635000; //Value is calculated in copper coins. + item.rare = 8; //Ranges from 1 to 11. + 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.OnFire, 300); + target.AddBuff(BuffID.Venom, 180); + } + } +} diff --git a/Items/Weapons/TrueExcaliburShortsword.cs b/Items/Weapons/TrueExcaliburShortsword.cs index 664403e702..2756547d8b 100644 --- a/Items/Weapons/TrueExcaliburShortsword.cs +++ b/Items/Weapons/TrueExcaliburShortsword.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.Items.Weapons { -public class TrueExcaliburShortsword : 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 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; //Ranges from 1 to 55. - item.width = 50; //The width of the .png file in pixels divided by 2. - item.height = 50; //The height of the .png file in pixels divided by 2. - item.damage = 70; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.knockBack = 5.75f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.shoot = mod.ProjectileType("ShortBeam"); - item.shootSpeed = 12f; - item.value = 1000000; //Value is calculated in copper coins. - item.rare = 8; //Ranges from 1 to 11. - } - - 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); - } - } -}} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; //Ranges from 1 to 55. + item.width = 50; //The width of the .png file in pixels divided by 2. + item.height = 50; //The height of the .png file in pixels divided by 2. + item.damage = 70; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.knockBack = 5.75f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.shoot = mod.ProjectileType("ShortBeam"); + item.shootSpeed = 12f; + item.value = 1000000; //Value is calculated in copper coins. + item.rare = 8; //Ranges from 1 to 11. + } + + 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 40cdf0e93f..a5d4bf2c64 100644 --- a/Items/Weapons/TrueForbiddenOathblade.cs +++ b/Items/Weapons/TrueForbiddenOathblade.cs @@ -1,75 +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 TrueForbiddenOathblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Forbidden Oathblade"); - Tooltip.SetDefault("Sword of an ancient demon god"); - } - - 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 = 1000000; - 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, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ForbiddenOathblade"); - recipe.AddIngredient(null, "EssenceofChaos", 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); - } - } -} +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("Sword of an ancient demon god"); + } + + 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 = 1000000; + 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, 0.0f, 0.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); + } + } +} diff --git a/Items/Weapons/TrueNightsStabber.cs b/Items/Weapons/TrueNightsStabber.cs index c119190dd7..13e1e4c0d1 100644 --- a/Items/Weapons/TrueNightsStabber.cs +++ b/Items/Weapons/TrueNightsStabber.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.Items.Weapons { -public class TrueNightsStabber : 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 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; //Ranges from 1 to 55. - item.width = 40; //The width of the .png file in pixels divided by 2. - item.height = 40; //The height of the .png file in pixels divided by 2. - item.damage = 75; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.knockBack = 6.25f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.shoot = mod.ProjectileType("ShortNightBeam"); - item.shootSpeed = 8f; - item.value = 1000000; //Value is calculated in copper coins. - item.rare = 8; //Ranges from 1 to 11. - } - - 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); - } - } -}} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 16; + item.useTime = 16; //Ranges from 1 to 55. + item.width = 40; //The width of the .png file in pixels divided by 2. + item.height = 40; //The height of the .png file in pixels divided by 2. + item.damage = 75; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.knockBack = 6.25f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.shoot = mod.ProjectileType("ShortNightBeam"); + item.shootSpeed = 8f; + item.value = 1000000; //Value is calculated in copper coins. + item.rare = 8; //Ranges from 1 to 11. + } + + 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/TruePaladinsHammer.cs b/Items/Weapons/TruePaladinsHammer.cs index 52f0be1e19..9c55f47b23 100644 --- a/Items/Weapons/TruePaladinsHammer.cs +++ b/Items/Weapons/TruePaladinsHammer.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 TruePaladinsHammer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Paladin's Hammer"); - } - - public override void SetDefaults() - { - item.width = 14; //The width of the .png file in pixels divided by 2. - item.damage = 128; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 20f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.thrown = true; //Dictates whether the weapon can be "auto-fired". - item.height = 28; //The height of the .png file in pixels divided by 2. - item.value = 9000000; //Value is calculated in copper coins. - item.rare = 9; //Ranges from 1 to 11. - item.shoot = mod.ProjectileType("OPHammer"); - 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 TruePaladinsHammer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Paladin's Hammer"); + } + + public override void SetDefaults() + { + item.width = 14; //The width of the .png file in pixels divided by 2. + item.damage = 128; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 20f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.thrown = true; //Dictates whether the weapon can be "auto-fired". + item.height = 28; //The height of the .png file in pixels divided by 2. + item.value = 9000000; //Value is calculated in copper coins. + item.rare = 9; //Ranges from 1 to 11. + item.shoot = mod.ProjectileType("OPHammer"); + 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/TruePaladinsHammerMelee.cs b/Items/Weapons/TruePaladinsHammerMelee.cs index 32836ab0c8..d5718c190f 100644 --- a/Items/Weapons/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/TruePaladinsHammerMelee.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 TruePaladinsHammerMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Paladin's Hammer"); - } - - public override void SetDefaults() - { - item.width = 14; //The width of the .png file in pixels divided by 2. - item.damage = 128; //Keep this reasonable please. - item.noMelee = true; //Dictates whether this is a melee-class weapon. - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 20f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.melee = true; //Dictates whether the weapon can be "auto-fired". - item.height = 28; //The height of the .png file in pixels divided by 2. - item.value = 9000000; //Value is calculated in copper coins. - item.rare = 9; //Ranges from 1 to 11. - 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"); + } + + public override void SetDefaults() + { + item.width = 14; //The width of the .png file in pixels divided by 2. + item.damage = 128; //Keep this reasonable please. + item.noMelee = true; //Dictates whether this is a melee-class weapon. + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 20f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.melee = true; //Dictates whether the weapon can be "auto-fired". + item.height = 28; //The height of the .png file in pixels divided by 2. + item.value = 9000000; //Value is calculated in copper coins. + item.rare = 9; //Ranges from 1 to 11. + 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 52fa981ce7..5bcc0ba855 100644 --- a/Items/Weapons/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/TrueTyrantYharimsUltisword.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; - -namespace CalamityMod.Items.Weapons -{ - public class TrueTyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Tyrant's Ultisword"); - Tooltip.SetDefault("Contains the essence of a forgotten age\n50% chance to give the player the tyrant's fury buff on enemy hits\nThis buff increases melee damage, speed, and crit chance by 30%"); - } - - public override void SetDefaults() - { - item.width = 86; - item.damage = 165; - 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 = 86; - item.value = 5250000; - item.shoot = mod.ProjectileType("BlazingPhantomBlade"); - item.shootSpeed = 12f; - } - - 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) - { - 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) - { - if (Main.rand.Next(2) == 0) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 300); - } - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(BuffID.CursedInferno, 180); - 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("Contains the essence of a forgotten age\n50% chance to give the player the tyrant's fury buff on enemy hits\nThis buff increases melee damage, speed, and crit chance by 30%"); + } + + public override void SetDefaults() + { + item.width = 86; + item.damage = 165; + 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 = 86; + item.value = 5250000; + item.shoot = mod.ProjectileType("BlazingPhantomBlade"); + item.shootSpeed = 12f; + } + + 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) + { + 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) + { + if (Main.rand.Next(2) == 0) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 300); + } + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.CursedInferno, 180); + 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 815f909f66..f8f578d553 100644 --- a/Items/Weapons/TyrantYharimsUltisword.cs +++ b/Items/Weapons/TyrantYharimsUltisword.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; - -namespace CalamityMod.Items.Weapons -{ - public class TyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tyrant Yharim's Ultisword"); - Tooltip.SetDefault("Necrotic blade of Jungle King Yharim\n50% chance to give the player the tyrant's fury buff on enemy hits\nThis buff increases melee damage, speed, and crit chance by 30%"); - } - - public override void SetDefaults() - { - item.width = 84; //The width of the .png file in pixels divided by 2. - item.damage = 64; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.useAnimation = 26; - item.useStyle = 1; - item.useTime = 26; - item.useTurn = true; - item.knockBack = 5.50f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". - item.height = 84; //The height of the .png file in pixels divided by 2. - item.value = 1250000; //Value is calculated in copper coins. - item.rare = 9; //Ranges from 1 to 11. - 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) - { - if (Main.rand.Next(2) == 0) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 180); - } - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(BuffID.CursedInferno, 180); - } - } -} +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("Necrotic blade of Jungle King Yharim\n50% chance to give the player the tyrant's fury buff on enemy hits\nThis buff increases melee damage, speed, and crit chance by 30%"); + } + + public override void SetDefaults() + { + item.width = 84; //The width of the .png file in pixels divided by 2. + item.damage = 64; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.useAnimation = 26; + item.useStyle = 1; + item.useTime = 26; + item.useTurn = true; + item.knockBack = 5.50f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = true; //Dictates whether the weapon can be "auto-fired". + item.height = 84; //The height of the .png file in pixels divided by 2. + item.value = 1250000; //Value is calculated in copper coins. + item.rare = 9; //Ranges from 1 to 11. + 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) + { + if (Main.rand.Next(2) == 0) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 180); + } + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.CursedInferno, 180); + } + } +} diff --git a/Items/Weapons/UltraLiquidator.cs b/Items/Weapons/UltraLiquidator.cs index 33f8ca413a..e10bcc44c3 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,78 +19,78 @@ 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 = 3000000; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LiquidBlade"); - item.shootSpeed = 16f; - } - - 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 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; - } - } + 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 = 3000000; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LiquidBlade"); + item.shootSpeed = 16f; + } + + 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 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 diff --git a/Items/Weapons/UrchinSpear.cs b/Items/Weapons/UrchinSpear.cs index 4b9e7c0a84..ff5804042b 100644 --- a/Items/Weapons/UrchinSpear.cs +++ b/Items/Weapons/UrchinSpear.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 UrchinSpear : 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 UrchinSpear : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin Spear"); } - - public override void SetDefaults() - { - item.width = 56; //The width of the .png file in pixels divided by 2. - item.damage = 17; //Keep this reasonable please. - item.melee = true; //Dictates whether this is a melee-class weapon. - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 25; - item.knockBack = 5f; //Ranges from 1 to 9. - item.UseSound = SoundID.Item1; - item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". - item.height = 56; //The height of the .png file in pixels divided by 2. - item.maxStack = 1; - item.value = 45000; //Value is calculated in copper coins. - item.rare = 2; //Ranges from 1 to 11. - 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(); - } -}} + + public override void SetDefaults() + { + item.width = 56; //The width of the .png file in pixels divided by 2. + item.damage = 17; //Keep this reasonable please. + item.melee = true; //Dictates whether this is a melee-class weapon. + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 25; + item.knockBack = 5f; //Ranges from 1 to 9. + item.UseSound = SoundID.Item1; + item.autoReuse = false; //Dictates whether the weapon can be "auto-fired". + item.height = 56; //The height of the .png file in pixels divided by 2. + item.maxStack = 1; + item.value = 45000; //Value is calculated in copper coins. + item.rare = 2; //Ranges from 1 to 11. + 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/UrchinStinger.cs b/Items/Weapons/UrchinStinger.cs index c5f9122579..f48e2dc27e 100644 --- a/Items/Weapons/UrchinStinger.cs +++ b/Items/Weapons/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.Weapons -{ - public class UrchinStinger : 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 UrchinStinger : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin Stinger"); } - public override void SetDefaults() - { - item.width = 10; - item.damage = 15; - item.thrown = true; - 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; - } - } -} + public override void SetDefaults() + { + item.width = 10; + item.damage = 15; + item.thrown = true; + 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; + } + } +} diff --git a/Items/Weapons/VanquisherArrow.cs b/Items/Weapons/VanquisherArrow.cs index f0919eab9a..dbab8dccec 100644 --- a/Items/Weapons/VanquisherArrow.cs +++ b/Items/Weapons/VanquisherArrow.cs @@ -1,55 +1,55 @@ -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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } + + 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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + 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 diff --git a/Items/Weapons/Vehemenc.cs b/Items/Weapons/Vehemenc.cs index 45ebe2efc5..0abe4e2cf0 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 500,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; //so the item's animation doesn't do damage - item.knockBack = 5.75f; - item.value = 100000000; - 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; - } - } +using System; +using System.Collections.Generic; +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 500,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; //so the item's animation doesn't do damage + item.knockBack = 5.75f; + item.value = 100000000; + 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 diff --git a/Items/Weapons/VenusianTrident.cs b/Items/Weapons/VenusianTrident.cs index bad61334a5..78e7926ebf 100644 --- a/Items/Weapons/VenusianTrident.cs +++ b/Items/Weapons/VenusianTrident.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 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 = 360; - 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 = 800000; - item.UseSound = SoundID.Item45; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VenusianBolt"); - item.shootSpeed = 19f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.InfernoFork); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "TwistingNether"); - 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 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 = 360; + 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 = 800000; + item.UseSound = SoundID.Item45; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VenusianBolt"); + item.shootSpeed = 19f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.InfernoFork); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "TwistingNether"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/VenusianTrident.png b/Items/Weapons/VenusianTrident.png index 94ac16dcf8..4bc9e27dd7 100644 Binary files a/Items/Weapons/VenusianTrident.png and b/Items/Weapons/VenusianTrident.png differ diff --git a/Items/Weapons/Verdant.cs b/Items/Weapons/Verdant.cs index 635d64bf4e..edb6ba9e43 100644 --- a/Items/Weapons/Verdant.cs +++ b/Items/Weapons/Verdant.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 Verdant : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Verdant"); - Tooltip.SetDefault("Fires leaf crystals 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 = 1200000; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VerdantProjectile"); - } - - 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 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); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 6); - 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 Verdant : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verdant"); + Tooltip.SetDefault("Fires leaf crystals 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 = 1200000; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VerdantProjectile"); + } + + 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 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); + return false; + } + + 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 diff --git a/Items/Weapons/VeriumBullet.cs b/Items/Weapons/VeriumBullet.cs index 4a94878856..43ec15a5d1 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 = 9; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 500; - item.rare = 5; - 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(); - } - } + + 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 = 500; + item.rare = 5; + 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 diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs index 75cfdbc422..7c7cb9d419 100644 --- a/Items/Weapons/Vesuvius.cs +++ b/Items/Weapons/Vesuvius.cs @@ -1,140 +1,140 @@ -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 = 55; - 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 = 5000000; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("AsteroidMolten"); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, Main.DiscoG, 0); - } - } - } - - 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 = 5000000; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("AsteroidMolten"); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, Main.DiscoG, 0); + } + } + } + + 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 3d58804085..bdb9fff9ee 100644 --- a/Items/Weapons/Viscera.cs +++ b/Items/Weapons/Viscera.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 Viscera : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viscera"); - Tooltip.SetDefault("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 = 180; - item.magic = true; - item.mana = 20; - item.width = 50; - item.height = 52; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = 1000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Viscera"); - item.shootSpeed = 6f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 0); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 4); - 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 Viscera : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viscera"); + Tooltip.SetDefault("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 = 180; + item.magic = true; + item.mana = 20; + item.width = 50; + item.height = 52; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = 1000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Viscera"); + item.shootSpeed = 6f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 0); + } + } + } + + 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 diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs index 29d9690c91..1d5b8409bd 100644 --- a/Items/Weapons/VividClarity.cs +++ b/Items/Weapons/VividClarity.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 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"); @@ -20,107 +20,107 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 165; - 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 = 100000000; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VividClarity"); - item.shootSpeed = 6f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(108, 45, 199); - } - } - } - - public override bool 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(); - } - } + public override void SetDefaults() + { + item.damage = 198; + 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 = 100000000; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VividClarity"); + item.shootSpeed = 6f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(108, 45, 199); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/Vortexpopper.cs b/Items/Weapons/Vortexpopper.cs index 356483b734..5e01dca413 100644 --- a/Items/Weapons/Vortexpopper.cs +++ b/Items/Weapons/Vortexpopper.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; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class Vortexpopper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vortexpopper"); - } - - public override void SetDefaults() - { - item.damage = 15; - 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 = 1000000; - 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(); - } - } +using System; +using System.Collections.Generic; +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"); + } + + public override void SetDefaults() + { + item.damage = 15; + 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 = 1000000; + 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 diff --git a/Items/Weapons/Waraxe.cs b/Items/Weapons/Waraxe.cs index ebdc497da8..29291c3d34 100644 --- a/Items/Weapons/Waraxe.cs +++ b/Items/Weapons/Waraxe.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.Weapons { -public class Waraxe : 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 Waraxe : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Waraxe"); } - - 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 = 50000; - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + + 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 = 50000; + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } }} \ No newline at end of file diff --git a/Items/Weapons/Warblade.cs b/Items/Weapons/Warblade.cs index 802abf6145..cb4a896c0d 100644 --- a/Items/Weapons/Warblade.cs +++ b/Items/Weapons/Warblade.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.Weapons { -public class Warblade : 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 Warblade : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Warblade"); } - - 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 = 50000; - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } + + 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 = 50000; + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } }} \ No newline at end of file diff --git a/Items/Weapons/WindBlade.cs b/Items/Weapons/WindBlade.cs index 28e9bcdc3e..67990f16f1 100644 --- a/Items/Weapons/WindBlade.cs +++ b/Items/Weapons/WindBlade.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 WindBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wind Blade"); - } - - public override void SetDefaults() - { - item.width = 58; - item.damage = 29; - 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 = 100000; - item.rare = 3; - } - - 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"); + } + + public override void SetDefaults() + { + item.width = 58; + item.damage = 29; + 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 = 100000; + item.rare = 3; + } + + 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 cb65677da9..b148417ede 100644 --- a/Items/Weapons/Wingman.cs +++ b/Items/Weapons/Wingman.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 Wingman : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wingman"); - } - - 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 = 500000; - 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, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 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 +{ + public class Wingman : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wingman"); + } + + 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 = 500000; + 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, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/WrathoftheAncients.cs b/Items/Weapons/WrathoftheAncients.cs index f13c7cc0b2..b2fcec2fcd 100644 --- a/Items/Weapons/WrathoftheAncients.cs +++ b/Items/Weapons/WrathoftheAncients.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 WrathoftheAncients : 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 WrathoftheAncients : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Wrath of the Ancients"); } - - public override void SetDefaults() - { - item.damage = 52; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 6f; - item.value = 500000; - 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; - } + + public override void SetDefaults() + { + item.damage = 52; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.useTime = 38; + item.useAnimation = 38; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 6f; + item.value = 500000; + 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 diff --git a/Items/Weapons/WulfrumBlade.cs b/Items/Weapons/WulfrumBlade.cs index 1f2bf1fa2c..4ae2f74683 100644 --- a/Items/Weapons/WulfrumBlade.cs +++ b/Items/Weapons/WulfrumBlade.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 WulfrumBlade : 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 WulfrumBlade : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Blade"); } - public override void SetDefaults() - { - item.width = 46; - item.damage = 15; - 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 = 20000; - 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(); - } -}} + public override void SetDefaults() + { + item.width = 46; + item.damage = 15; + 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 = 20000; + 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 8a7a171291..5d03d58597 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 = 25000; - 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(); - } - } +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 = 25000; + 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 diff --git a/Items/Weapons/WulfrumKnife.cs b/Items/Weapons/WulfrumKnife.cs index 14ec302569..cf04494547 100644 --- a/Items/Weapons/WulfrumKnife.cs +++ b/Items/Weapons/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.Weapons -{ - public class WulfrumKnife : 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 WulfrumKnife : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Knife"); } - public override void SetDefaults() - { - item.width = 22; - item.damage = 8; - item.thrown = true; - 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; - } - - 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 SetDefaults() + { + item.width = 22; + item.damage = 8; + item.thrown = true; + 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; + } + + 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/Weapons/WulfrumStaff.cs b/Items/Weapons/WulfrumStaff.cs index 4fd817efd0..840d8d1aa1 100644 --- a/Items/Weapons/WulfrumStaff.cs +++ b/Items/Weapons/WulfrumStaff.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 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("Fires 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 = 20000; - item.rare = 1; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WulfrumBolt"); - 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) - { - 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, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + + 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 = 20000; + item.rare = 1; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WulfrumBolt"); + 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) + { + 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, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Weapons/XerocPitchfork.cs b/Items/Weapons/XerocPitchfork.cs index 9a82f76875..c6186d5f1c 100644 --- a/Items/Weapons/XerocPitchfork.cs +++ b/Items/Weapons/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.Weapons -{ - public class XerocPitchfork : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Pitchfork"); - } - - public override void SetDefaults() - { - item.width = 48; - item.damage = 300; - item.thrown = true; - 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; - } - - 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.Weapons +{ + public class XerocPitchfork : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Pitchfork"); + } + + public override void SetDefaults() + { + item.width = 48; + item.damage = 300; + item.thrown = true; + 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; + } + + 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/Weapons/XerocsGreatsword.cs b/Items/Weapons/XerocsGreatsword.cs index b491df3b16..ceb1fd6a2c 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 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 = 400000; - 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, 500); - } - } -} +using System; +using System.Collections.Generic; +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 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 = 400000; + 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, 500); + } + } +} diff --git a/Items/Weapons/YharimsCrystal.cs b/Items/Weapons/YharimsCrystal.cs index c2fd2990d4..ea75c5a97c 100644 --- a/Items/Weapons/YharimsCrystal.cs +++ b/Items/Weapons/YharimsCrystal.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 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; + +namespace CalamityMod.Items.Weapons +{ + public class YharimsCrystal : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Yharim's Crystal"); @@ -18,69 +18,69 @@ namespace CalamityMod.Items.Weapons "Only those that are worthy can use this item before Yharon is defeated"); } - public override void SetDefaults() - { - item.damage = 110; - 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 = 100000000; - item.shoot = mod.ProjectileType("YharimsCrystal"); - item.shootSpeed = 30f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(255, Main.DiscoG, 53); - } - } - } - - public override bool 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, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - } + public override void SetDefaults() + { + item.damage = 110; + 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 = 100000000; + item.shoot = mod.ProjectileType("YharimsCrystal"); + item.shootSpeed = 30f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(255, Main.DiscoG, 53); + } + } + } + + public override bool 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, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs index 07208657a6..f20e710133 100644 --- a/Items/Weapons/Yharon/AngryChickenStaff.cs +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -1,94 +1,94 @@ -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" + - "The dragon imbues your melee attacks with Holy Flames while summoned\n" + - "Requires 4 minion slots to use"); - } - - public override void SetDefaults() - { - item.mana = 50; - item.damage = 232; - item.useStyle = 1; - item.width = 32; - item.height = 32; - item.useTime = 36; - item.useAnimation = 36; - item.noMelee = true; - item.knockBack = 7f; - item.value = 10000000; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("AngryChicken"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AngryChicken"), num73, num74, i, 0f, 0f); - return false; - } - } +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" + + "The dragon imbues your melee attacks with Holy Flames while summoned\n" + + "Requires 4 minion slots to use"); + } + + public override void SetDefaults() + { + item.mana = 50; + item.damage = 232; + item.useStyle = 1; + item.width = 32; + item.height = 32; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 7f; + item.value = 10000000; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("AngryChicken"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 = 0f; + num79 = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AngryChicken"), num73, num74, i, 0f, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Yharon/ChickenCannon.cs b/Items/Weapons/Yharon/ChickenCannon.cs index 40240db26c..ee721debe3 100644 --- a/Items/Weapons/Yharon/ChickenCannon.cs +++ b/Items/Weapons/Yharon/ChickenCannon.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.Yharon -{ - public class ChickenCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chicken Cannon"); - Tooltip.SetDefault("Fires chicken rockets"); - } - - public override void SetDefaults() - { - item.damage = 22; - 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 = 10000000; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Chicken"); - item.useAmmo = 771; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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, 0.0f, 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.Yharon +{ + public class ChickenCannon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chicken Cannon"); + Tooltip.SetDefault("Fires chicken rockets"); + } + + public override void SetDefaults() + { + item.damage = 22; + 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 = 10000000; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("Chicken"); + item.useAmmo = 771; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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, 0.0f, 0.0f); + return false; + } + } } \ No newline at end of file diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs index 729d3c28f0..d7855c57f3 100644 --- a/Items/Weapons/Yharon/DragonRage.cs +++ b/Items/Weapons/Yharon/DragonRage.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; - -namespace CalamityMod.Items.Weapons.Yharon -{ - public class DragonRage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Rage"); - } - - public override void SetDefaults() - { - item.width = 68; - item.damage = 683; - 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.maxStack = 1; - item.value = 10000000; - item.shoot = mod.ProjectileType("DragonRage"); - item.shootSpeed = 14f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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 + 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; - float SpeedX4 = speedX - 20f * 0.05f; - float SpeedY4 = speedY - 20f * 0.05f; - float SpeedX5 = speedX + 20f * 0.05f; - float SpeedY5 = speedY + 20f * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, (int)((double)damage * 0.75f), 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"); + } + + public override void SetDefaults() + { + item.width = 68; + item.damage = 683; + 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.maxStack = 1; + item.value = 10000000; + item.shoot = mod.ProjectileType("DragonRage"); + item.shootSpeed = 14f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 + 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; + float SpeedX4 = speedX - 20f * 0.05f; + float SpeedY4 = speedY - 20f * 0.05f; + float SpeedX5 = speedX + 20f * 0.05f; + float SpeedY5 = speedY + 20f * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, type, (int)((double)damage * 0.75f), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, (int)((double)damage * 0.75f), 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 3ea0a939ae..79ad375415 100644 --- a/Items/Weapons/Yharon/DragonsBreath.cs +++ b/Items/Weapons/Yharon/DragonsBreath.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.Weapons.Yharon -{ - public class DragonsBreath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon's Breath"); - Tooltip.SetDefault("80% chance to not consume ammo"); - } - - public override void SetDefaults() - { - item.damage = 236; - 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 = 10000000; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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(-65, 66) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("DragonBurst"), 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; - } - } +using System; +using System.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"); + } + + public override void SetDefaults() + { + item.damage = 236; + 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 = 10000000; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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, 0.0f, 0.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 diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs index 83e0e8f848..06f2aa591e 100644 --- a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.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.Yharon { -public class PhoenixFlameBarrage : 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.Yharon { +public class PhoenixFlameBarrage : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("Phoenix Flame Barrage"); Tooltip.SetDefault("Baptism by holy fire"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 235; - item.magic = true; - item.mana = 20; - item.width = 72; - item.height = 70; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; //so the item's animation doesn't do damage - item.knockBack = 3.5f; - item.value = 10000000; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HolyFlame"); - item.shootSpeed = 30f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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; - } + + public override void SetDefaults() + { + item.damage = 235; + item.magic = true; + item.mana = 20; + item.width = 72; + item.height = 70; + item.useTime = 15; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; //so the item's animation doesn't do damage + item.knockBack = 3.5f; + item.value = 10000000; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HolyFlame"); + item.shootSpeed = 30f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 diff --git a/Items/Weapons/Yharon/ProfanedTrident.cs b/Items/Weapons/Yharon/ProfanedTrident.cs index 2c0a00d1b2..731d248662 100644 --- a/Items/Weapons/Yharon/ProfanedTrident.cs +++ b/Items/Weapons/Yharon/ProfanedTrident.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.Yharon -{ - public class ProfanedTrident : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernal Spear"); - } - - public override void SetDefaults() - { - item.width = 72; - item.damage = 1040; - item.thrown = true; - 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.maxStack = 1; - item.value = 10000000; - item.shoot = mod.ProjectileType("ProfanedTrident"); - item.shootSpeed = 28f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - } -} +using System; +using System.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 ProfanedTrident : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Spear"); + } + + public override void SetDefaults() + { + item.width = 72; + item.damage = 1040; + item.thrown = true; + 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.maxStack = 1; + item.value = 10000000; + item.shoot = mod.ProjectileType("ProfanedTrident"); + item.shootSpeed = 28f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + } +} diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs index bc4c22d986..5e8a7caf9d 100644 --- a/Items/Weapons/Yharon/TheBurningSky.cs +++ b/Items/Weapons/Yharon/TheBurningSky.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; - -namespace CalamityMod.Items.Weapons.Yharon -{ - public class TheBurningSky : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Burning Sky"); - } - - public override void SetDefaults() - { - item.width = 56; - item.damage = 210; - item.melee = true; - item.useTime = 5; - item.useAnimation = 15; - item.useStyle = 1; - item.useTurn = true; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; - item.maxStack = 1; - item.value = 10000000; - item.shoot = mod.ProjectileType("BurningMeteor"); - item.shootSpeed = 35f; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool 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; - int projectile = 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"); + } + + public override void SetDefaults() + { + item.width = 56; + item.damage = 210; + item.melee = true; + item.useTime = 5; + item.useAnimation = 15; + item.useStyle = 1; + item.useTurn = true; + item.knockBack = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; + item.maxStack = 1; + item.value = 10000000; + item.shoot = mod.ProjectileType("BurningMeteor"); + item.shootSpeed = 35f; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool 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 18fff75021..2f766eaa06 100644 --- a/Items/Weapons/YinYo.cs +++ b/Items/Weapons/YinYo.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 YinYo : 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 YinYo : ModItem +{ public override void SetStaticDefaults() { DisplayName.SetDefault("YinYo"); Tooltip.SetDefault("Fires light or dark shards when enemies are near\nLight 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.2f; - item.value = 130000; - 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(); - } + + 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.2f; + item.value = 130000; + 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 diff --git a/Items/Weapons/Zapper.cs b/Items/Weapons/Zapper.cs index 1b8e9d24fb..2cdf37a215 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 = 30; - item.magic = true; - item.mana = 4; - item.width = 46; - item.height = 22; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = 180000; - 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(); - } - } +using System; +using System.Collections.Generic; +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 = 30; + item.magic = true; + item.mana = 4; + item.width = 46; + item.height = 22; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = 180000; + 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 diff --git a/Items/WulfrumAxe.cs b/Items/WulfrumAxe.cs index d0b18e7918..984a643cc3 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 = 10; - item.melee = true; - item.width = 62; - item.height = 48; - item.useTime = 8; - item.useAnimation = 16; - item.useTurn = true; - item.axe = 7; - item.useStyle = 1; - item.knockBack = 3f; - item.value = 25000; - 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(); - } - } +using System; +using 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 = 10; + item.melee = true; + item.width = 62; + item.height = 48; + item.useTime = 8; + item.useAnimation = 16; + item.useTurn = true; + item.axe = 7; + item.useStyle = 1; + item.knockBack = 3f; + item.value = 25000; + 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 diff --git a/Items/WulfrumHammer.cs b/Items/WulfrumHammer.cs index b5ec4f5734..34db36e12c 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 = 8; - item.melee = true; - item.width = 56; - item.height = 56; - item.useTime = 8; - item.useAnimation = 16; - item.useTurn = true; - item.hammer = 35; - item.useStyle = 1; - item.knockBack = 4f; - item.value = 25000; - 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(); - } - } +using System; +using 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 = 8; + item.melee = true; + item.width = 56; + item.height = 56; + item.useTime = 8; + item.useAnimation = 16; + item.useTurn = true; + item.hammer = 35; + item.useStyle = 1; + item.knockBack = 4f; + item.value = 25000; + 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 diff --git a/Items/WulfrumPickaxe.cs b/Items/WulfrumPickaxe.cs index 02dfe98e04..b15287d221 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 = 8; - item.melee = true; - item.width = 48; - item.height = 48; - item.useTime = 7; - item.useAnimation = 14; - item.useTurn = true; - item.pick = 35; - item.useStyle = 1; - item.knockBack = 2; - item.value = 25000; - 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(); - } - } +using System; +using 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 = 8; + item.melee = true; + item.width = 48; + item.height = 48; + item.useTime = 7; + item.useAnimation = 14; + item.useTurn = true; + item.pick = 35; + item.useStyle = 1; + item.knockBack = 2; + item.value = 25000; + 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 diff --git a/Items/WulfrumShard.cs b/Items/WulfrumShard.cs index 3d67c4168b..74fa213b84 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 = 1750; - item.rare = 1; - } - } +using System; +using 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 = 1750; + item.rare = 1; + } + } } \ No newline at end of file diff --git a/Items/YharimsStimulants.cs b/Items/YharimsStimulants.cs index 7a5cb73b30..1ca72f7437 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 = 10000; - } - - 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(); - } - } +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 = 10000; + } + + 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 diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs index 1e6764b9a9..c8aa618812 100644 --- a/Items/Yharon/ChickenEgg.cs +++ b/Items/Yharon/ChickenEgg.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; - -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; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(43, 96, 222); - } - } - } - - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")); - } - - 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(null, "DraedonsForge"); - 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.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; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(43, 96, 222); + } + } + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")); + } + + 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(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Yharon/HellcasterFragment.cs b/Items/Yharon/HellcasterFragment.cs index c9866f26fa..74b899be4b 100644 --- a/Items/Yharon/HellcasterFragment.cs +++ b/Items/Yharon/HellcasterFragment.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.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 = 15000; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } - } - } - } +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 = 15000; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + } + } + } } \ No newline at end of file diff --git a/Items/Yharon/YharimsGift.cs b/Items/Yharon/YharimsGift.cs index 91509ab89b..06972d9d69 100644 --- a/Items/Yharon/YharimsGift.cs +++ b/Items/Yharon/YharimsGift.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.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 = 50000000; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.meleeDamage += 0.15f; - player.thrownDamage += 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; - } - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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 = 50000000; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.meleeDamage += 0.15f; + player.thrownDamage += 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 diff --git a/Items/Yharon/YharonBag.cs b/Items/Yharon/YharonBag.cs index 36c55272d4..220d15f8bb 100644 --- a/Items/Yharon/YharonBag.cs +++ b/Items/Yharon/YharonBag.cs @@ -1,74 +1,74 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -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) - { - player.TryGettingDevArmor(); - 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")); - } - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("DrewsWings")); - player.QuickSpawnItem(mod.ItemType("FoxDrive")); - } - player.QuickSpawnItem(mod.ItemType("YharimsGift")); - } - } +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +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) + { + player.TryGettingDevArmor(); + 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")); + } + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("DrewsWings")); + player.QuickSpawnItem(mod.ItemType("FoxDrive")); + } + player.QuickSpawnItem(mod.ItemType("YharimsGift")); + } + } } \ No newline at end of file diff --git a/Items/ZenPotion.cs b/Items/ZenPotion.cs index 4ebd41431f..814e45307d 100644 --- a/Items/ZenPotion.cs +++ b/Items/ZenPotion.cs @@ -1,49 +1,49 @@ -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 = 10000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CalmingPotion); - recipe.AddIngredient(ItemID.PinkGel, 3); - recipe.AddIngredient(null, "EbonianGel", 3); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + 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 = 10000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CalmingPotion); + recipe.AddIngredient(ItemID.PinkGel, 3); + recipe.AddIngredient(null, "EbonianGel", 3); + 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 diff --git a/Items/ZergPotion.cs b/Items/ZergPotion.cs index 4433fa73bf..867bb02704 100644 --- a/Items/ZergPotion.cs +++ b/Items/ZergPotion.cs @@ -1,49 +1,49 @@ -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 = 10000; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BattlePotion); - recipe.AddIngredient(null, "DemonicBoneAsh"); - recipe.AddIngredient(null, "MurkySludge", 2); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + 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 = 10000; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BattlePotion); + recipe.AddIngredient(null, "DemonicBoneAsh"); + recipe.AddIngredient(null, "MurkySludge", 2); + 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 diff --git a/MiscImplementation/BezierCurve.cs b/MiscImplementation/BezierCurve.cs index 313d2a817e..33b1f73bb6 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 a029ffa93a..3133d8102b 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 31af871a21..3ba8e4265a 100644 --- a/ModSupport.cs +++ b/ModSupport.cs @@ -1,81 +1,81 @@ -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; - -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; - } - 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; - } - } +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; + +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; + } + 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 diff --git a/NPCs/AbyssNPCs/AquaticParasite.cs b/NPCs/AbyssNPCs/AquaticParasite.cs index f48d8a78b7..d5c5be644d 100644 --- a/NPCs/AbyssNPCs/AquaticParasite.cs +++ b/NPCs/AbyssNPCs/AquaticParasite.cs @@ -1,240 +1,240 @@ -using System; -using System.Collections.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 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, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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, 240, 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); - } - } - } - } +using System; +using System.Collections.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 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, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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, 240, 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 diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index d0ff52c0a4..dcf7f77505 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -1,377 +1,377 @@ -using System; -using System.Collections.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 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 ? 81000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 95000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 7800000 : 7200000; - } - 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; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - } - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, 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.Projectiles; + +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 ? 8600000 : 7900000; + } + 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; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + } + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index 36dc3e320f..95134ceba3 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.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; - -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 ? 81000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 95000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 7800000 : 7200000; - } - 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; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - } - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, 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.Projectiles; + +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 ? 8600000 : 7900000; + } + 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; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + } + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index 5637012869..863f8c43d9 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -1,618 +1,618 @@ -using System; -using System.Collections.Generic; -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.AbyssNPCs -{ - [AutoloadBossHead] - public class AquaticScourgeHead : ModNPC - { - public bool detectsPlayer = false; - public bool flies = true; - public const int minLength = 30; - public const int maxLength = 31; - public float speed = 5f; //10 - public float turnSpeed = 0.08f; //0.15 - bool TailSpawned = false; - public 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 ? 81000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 95000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 7800000 : 7200000; - } - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 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 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - } - 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 ? 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 (npc.localAI[1] >= (npc.GetGlobalNPC(mod).enraged ? 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) - { - despawning = true; - npc.TargetClosest(false); - flies = false; - npc.velocity.Y = npc.velocity.Y + 5f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 5f; - } - if ((double)npc.position.Y > Main.rockLayer * 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 = 7f; - num189 = 0.11f; - if (!Main.player[npc.target].wet) - { - num188 = 11f; - num189 = 0.14f; - } - if (notOcean) - { - num188 = 15f; - num189 = 0.17f; - } - } - 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 && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - { - return 0.01f; - } - return 0f; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.None; - } - - 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); - } - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +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.AbyssNPCs +{ + [AutoloadBossHead] + public class AquaticScourgeHead : ModNPC + { + public bool detectsPlayer = false; + public bool flies = true; + public const int minLength = 30; + public const int maxLength = 31; + public float speed = 5f; //10 + public float turnSpeed = 0.08f; //0.15 + bool TailSpawned = false; + public 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 ? 8600000 : 7900000; + } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 15, 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 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + } + 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 ? 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 (npc.localAI[1] >= (npc.GetGlobalNPC(mod).enraged ? 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) + { + despawning = true; + npc.TargetClosest(false); + flies = false; + npc.velocity.Y = npc.velocity.Y + 5f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 5f; + } + if ((double)npc.position.Y > Main.rockLayer * 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 = 7f; + num189 = 0.11f; + if (!Main.player[npc.target].wet) + { + num188 = 11f; + num189 = 0.14f; + } + if (notOcean) + { + num188 = 15f; + num189 = 0.17f; + } + } + 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 && !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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index 7269eb81c1..d6edbb204c 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.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; - -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 ? 81000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 95000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 7800000 : 7200000; - } - 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; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - } - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, 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.Projectiles; + +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 ? 8600000 : 7900000; + } + 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; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + } + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/AquaticSeekerBody.cs b/NPCs/AbyssNPCs/AquaticSeekerBody.cs index 70b5761aba..927cb8cffd 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerBody.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerBody.cs @@ -1,297 +1,297 @@ -using System; -using System.Collections.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 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; - } - - 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); - } - } - } - } +using System; +using System.Collections.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 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; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs index a8e148d4b3..53253a5a24 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerHead.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -1,431 +1,431 @@ -using System; -using System.Collections.Generic; -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.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, 5, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - 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 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) - { - return 0.2f; - } - 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); - } - } - } - - 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); - player.AddBuff(BuffID.Venom, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 60); - } - } - } +using System; +using System.Collections.Generic; +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.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, 5, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + 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 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) + { + return 0.2f; + } + 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); + } + } + } + + 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); + player.AddBuff(BuffID.Venom, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 60); + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticSeekerTail.cs b/NPCs/AbyssNPCs/AquaticSeekerTail.cs index caa4297927..eb41500fe8 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerTail.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerTail.cs @@ -1,297 +1,297 @@ -using System; -using System.Collections.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 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; - } - - 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); - } - } - } - } +using System; +using System.Collections.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 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; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs index fa9c33315d..1147fa3129 100644 --- a/NPCs/AbyssNPCs/AquaticUrchin.cs +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -1,363 +1,363 @@ -using System; -using System.Collections.Generic; -using 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 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, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - } - - 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, 180, 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); - } - } - } - } +using System; +using System.Collections.Generic; +using 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 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, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + } + + 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, 180, 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Bloatfish.cs b/NPCs/AbyssNPCs/Bloatfish.cs index 644890b94b..3e093f5b77 100644 --- a/NPCs/AbyssNPCs/Bloatfish.cs +++ b/NPCs/AbyssNPCs/Bloatfish.cs @@ -1,224 +1,224 @@ -using System; -using System.Collections.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 Bloatfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloatfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = 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, 0, 1); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.9f; - } - - 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 0.05f; - } - 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(1000) == 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; - } - } - } +using System; +using System.Collections.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 Bloatfish : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloatfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = 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, 0, 1); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.9f; + } + + 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 0.05f; + } + 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(1000) == 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 diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index 7356c8e43d..acfc6a9db0 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.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; - -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.aiStyle = -1; - npc.damage = 110; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 7000; - npc.knockBackResist = 0f; - aiType = -1; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - 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)) - { - 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(1000) == 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); - } - } - } - } +using System; +using System.Collections.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 BobbitWormHead : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bobbit Worm"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 110; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; + npc.lifeMax = 7000; + npc.knockBackResist = 0f; + aiType = -1; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 1, 0, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + 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)) + { + 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(1000) == 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.cs b/NPCs/AbyssNPCs/BobbitWormSegment.cs index 66eeecfc99..1693f4002a 100644 --- a/NPCs/AbyssNPCs/BobbitWormSegment.cs +++ b/NPCs/AbyssNPCs/BobbitWormSegment.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.AbyssNPCs -{ - public class BobbitWormSegment : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bobbit Worm"); - } - - public override void SetDefaults() - { - 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 && !NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) - { - return 0.1f; - } - return 0f; - } - - public override bool CheckActive() - { - return false; - } - } +using System; +using System.Collections.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.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 && !NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) + { + return 0.1f; + } + return 0f; + } + + public override bool CheckActive() + { + return false; + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/BoxJellyfish.cs b/NPCs/AbyssNPCs/BoxJellyfish.cs index a6dba1ff76..758071ee18 100644 --- a/NPCs/AbyssNPCs/BoxJellyfish.cs +++ b/NPCs/AbyssNPCs/BoxJellyfish.cs @@ -1,214 +1,214 @@ -using System; -using System.Collections.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, 5, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - } - - 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; - 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 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return 0.2f; - } - return SpawnCondition.OceanMonster.Chance * 0.1f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 240, 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); - } - } - } - } +using System; +using System.Collections.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, 5, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + } + + 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; + 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 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return 0.2f; + } + return SpawnCondition.OceanMonster.Chance * 0.1f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 240, 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 diff --git a/NPCs/AbyssNPCs/Catfish.cs b/NPCs/AbyssNPCs/Catfish.cs index eed9529df3..891813644f 100644 --- a/NPCs/AbyssNPCs/Catfish.cs +++ b/NPCs/AbyssNPCs/Catfish.cs @@ -1,263 +1,263 @@ -using System; -using System.Collections.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, 12, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath40; - npc.knockBackResist = 0.8f; - } - - 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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, 12, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath40; + npc.knockBackResist = 0.8f; + } + + 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) + { + 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 diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index 43d8b9d177..12b2226657 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -1,571 +1,571 @@ -using System; -using System.Collections.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 ColossalSquid : ModNPC - { - public 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 = 110; - npc.width = 180; - npc.height = 180; - npc.defense = 50; - npc.lifeMax = 181500; - 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, 0, 25, 0); - npc.HitSound = SoundID.NPCHit20; - npc.DeathSound = SoundID.NPCDeath23; - npc.rarity = 2; - } - - public override void AI() - { - 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 && - (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 (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] >= 120f) - { - 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.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 = 65; - if (Main.expertMode) - { - damage = 50; - } - 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 0.2f; - } - 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(100) == 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); - } - } - } - } +using System; +using System.Collections.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 ColossalSquid : ModNPC + { + public 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 = 110; + npc.width = 180; + npc.height = 180; + npc.defense = 50; + npc.lifeMax = 181500; + 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, 0, 25, 0); + npc.HitSound = SoundID.NPCHit20; + npc.DeathSound = SoundID.NPCDeath23; + npc.rarity = 2; + } + + public override void AI() + { + 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 && + (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 (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] >= 120f) + { + 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.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 = 65; + if (Main.expertMode) + { + damage = 50; + } + 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 0.2f; + } + 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(100) == 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs index 3ff805ba64..ef9ff0cf10 100644 --- a/NPCs/AbyssNPCs/Cuttlefish.cs +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -1,349 +1,349 @@ -using System; -using System.Collections.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 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, 9, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath28; - npc.knockBackResist = 0.3f; - } - - 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) - { - 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, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 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")); - } - 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(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("Lumenite")); - } - } - } - - 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); - } - } - } - } +using System; +using System.Collections.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 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, 9, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath28; + npc.knockBackResist = 0.3f; + } + + 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) + { + 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, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 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")); + } + 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(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("Lumenite")); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmBody.cs b/NPCs/AbyssNPCs/EidolonWyrmBody.cs index 164205eade..7f99567cea 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBody.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBody.cs @@ -1,302 +1,302 @@ -using System; -using System.Collections.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 = 0; //70 - npc.width = 32; //36 - npc.height = 32; - npc.defense = 0; - npc.lifeMax = 200000; - 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() - { - 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 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); - } - } - } - - 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); - } - } +using System; +using System.Collections.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 = 0; //70 + npc.width = 32; //36 + npc.height = 32; + npc.defense = 0; + npc.lifeMax = 200000; + 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() + { + 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 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs index be42913678..5a3791f597 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs @@ -1,302 +1,302 @@ -using System; -using System.Collections.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 = 0; //70 - npc.width = 32; //36 - npc.height = 32; - npc.defense = 0; - npc.lifeMax = 200000; - 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() - { - 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 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); - } - } - } - - 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); - } - } +using System; +using System.Collections.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 = 0; //70 + npc.width = 32; //36 + npc.height = 32; + npc.defense = 0; + npc.lifeMax = 200000; + 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() + { + 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 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs index 387ffdbb91..6c4cedcdb3 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs @@ -1,319 +1,319 @@ -using System; -using System.Collections.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 = 0; //70 - npc.width = 64; //36 - npc.height = 64; - 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() - { - 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); - } - } - } - - 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); - } - } +using System; +using System.Collections.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 = 0; //70 + npc.width = 64; //36 + npc.height = 64; + 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() + { + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs index 1641d3cf54..35715d26fa 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs @@ -1,319 +1,319 @@ -using System; -using System.Collections.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 = 0; //70 - npc.width = 64; //36 - npc.height = 64; - 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() - { - 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); - } - } - } - - 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); - } - } +using System; +using System.Collections.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 = 0; //70 + npc.width = 64; //36 + npc.height = 64; + 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() + { + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index 7883a565e4..9d44f63da9 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -1,608 +1,608 @@ -using System; -using System.Collections.Generic; -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.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 = 0; - npc.width = 126; //36 - npc.height = 56; //20 - npc.defense = 300; - npc.lifeMax = 200000; - 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; - npc.rarity = 2; - } - - 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 ? 260 : 130; - } - 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 = 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; - } - } - } - } - } - } - /*Vector2 value = npc.Center + (npc.rotation - 1.57079637f).ToRotationVector2() * 8f; //8 - Vector2 value2 = npc.rotation.ToRotationVector2() * 60f; //16 - Dust expr_1AAB = Main.dust[Dust.NewDust(value + value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; - expr_1AAB.noGravity = true; - expr_1AAB.noLight = true; - expr_1AAB.position -= new Vector2(4f); - expr_1AAB.fadeIn = 1f; - expr_1AAB.velocity = Vector2.Zero; - Dust expr_1B33 = Main.dust[Dust.NewDust(value - value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; - expr_1B33.noGravity = true; - expr_1B33.noLight = true; - expr_1B33.position -= new Vector2(4f); - expr_1B33.fadeIn = 1f; - expr_1B33.velocity = Vector2.Zero;*/ - 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("EidolonWyrmTail"))) - { - 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 0.05f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) - { - return 0.1f; - } - 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(100) == 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(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("Lumenite"), 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, 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); - } - } - } - - 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); - player.AddBuff(mod.BuffType("Horror"), 600, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 600); - } - } +using System; +using System.Collections.Generic; +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.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 = 0; + npc.width = 126; //36 + npc.height = 56; //20 + npc.defense = 300; + npc.lifeMax = 200000; + 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; + npc.rarity = 2; + } + + 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 ? 260 : 130; + } + 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 = 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; + } + } + } + } + } + } + /*Vector2 value = npc.Center + (npc.rotation - 1.57079637f).ToRotationVector2() * 8f; //8 + Vector2 value2 = npc.rotation.ToRotationVector2() * 60f; //16 + Dust expr_1AAB = Main.dust[Dust.NewDust(value + value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; + expr_1AAB.noGravity = true; + expr_1AAB.noLight = true; + expr_1AAB.position -= new Vector2(4f); + expr_1AAB.fadeIn = 1f; + expr_1AAB.velocity = Vector2.Zero; + Dust expr_1B33 = Main.dust[Dust.NewDust(value - value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; + expr_1B33.noGravity = true; + expr_1B33.noLight = true; + expr_1B33.position -= new Vector2(4f); + expr_1B33.fadeIn = 1f; + expr_1B33.velocity = Vector2.Zero;*/ + 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("EidolonWyrmTail"))) + { + 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 0.05f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + { + return 0.1f; + } + 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(100) == 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(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("Lumenite"), 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, 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); + } + } + } + + 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); + player.AddBuff(mod.BuffType("Horror"), 600, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 600); + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index f19704bad6..a2457f9441 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -1,603 +1,603 @@ -using System; -using System.Collections.Generic; -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.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 = 0; - npc.width = 252; //36 - npc.height = 112; //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(25, 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 AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 1500 : 1100; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.Next(900) == 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), (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; - } - } - } - } - } - } - /*Vector2 value = npc.Center + (npc.rotation - 1.57079637f).ToRotationVector2() * 8f; //8 - Vector2 value2 = npc.rotation.ToRotationVector2() * 120f; //16 - Dust expr_1AAB = Main.dust[Dust.NewDust(value + value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 2f + Main.rand.NextFloat() * 3f)]; - expr_1AAB.noGravity = true; - expr_1AAB.noLight = true; - expr_1AAB.position -= new Vector2(4f); - expr_1AAB.fadeIn = 1f; - expr_1AAB.velocity = Vector2.Zero; - Dust expr_1B33 = Main.dust[Dust.NewDust(value - value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 2f + Main.rand.NextFloat() * 3f)]; - expr_1B33.noGravity = true; - expr_1B33.noLight = true; - expr_1B33.position -= new Vector2(4f); - expr_1B33.fadeIn = 1f; - expr_1B33.velocity = Vector2.Zero;*/ - 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) > 4200f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) - { - 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 - 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? 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 0.001f; - } - 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 0.002f; - } - 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 (Main.rand.Next(10) == 0 && 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); - } - } - } - - 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); - player.AddBuff(mod.BuffType("Horror"), 1200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); - } - } +using System; +using System.Collections.Generic; +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.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 = 0; + npc.width = 252; //36 + npc.height = 112; //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(25, 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 AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 1500 : 1100; + } + 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; + } + } + } + } + } + } + /*Vector2 value = npc.Center + (npc.rotation - 1.57079637f).ToRotationVector2() * 8f; //8 + Vector2 value2 = npc.rotation.ToRotationVector2() * 120f; //16 + Dust expr_1AAB = Main.dust[Dust.NewDust(value + value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 2f + Main.rand.NextFloat() * 3f)]; + expr_1AAB.noGravity = true; + expr_1AAB.noLight = true; + expr_1AAB.position -= new Vector2(4f); + expr_1AAB.fadeIn = 1f; + expr_1AAB.velocity = Vector2.Zero; + Dust expr_1B33 = Main.dust[Dust.NewDust(value - value2, 0, 0, 20, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 2f + Main.rand.NextFloat() * 3f)]; + expr_1B33.noGravity = true; + expr_1B33.noLight = true; + expr_1B33.position -= new Vector2(4f); + expr_1B33.fadeIn = 1f; + expr_1B33.velocity = Vector2.Zero;*/ + 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) > 4200f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) + { + 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 - 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? 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 0.001f; + } + 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 0.002f; + } + 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 (Main.rand.Next(10) == 0 && 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); + } + } + } + + 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); + player.AddBuff(mod.BuffType("Horror"), 1200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmTail.cs b/NPCs/AbyssNPCs/EidolonWyrmTail.cs index c6471db0e0..6fd1097423 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTail.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTail.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; - -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 = 0; //70 - npc.width = 38; //28 - npc.height = 40; //28 - npc.defense = 0; - npc.lifeMax = 200000; - 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() - { - 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 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, 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.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 = 0; //70 + npc.width = 38; //28 + npc.height = 40; //28 + npc.defense = 0; + npc.lifeMax = 200000; + 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() + { + 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 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs index 11301d83ce..a6aaeecd78 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.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; - -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 = 0; //70 - npc.width = 76; //28 - npc.height = 80; //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() - { - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, 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.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 = 0; //70 + npc.width = 76; //28 + npc.height = 80; //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() + { + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/Flounder.cs b/NPCs/AbyssNPCs/Flounder.cs index 3deaffe9f7..ab66ffe995 100644 --- a/NPCs/AbyssNPCs/Flounder.cs +++ b/NPCs/AbyssNPCs/Flounder.cs @@ -1,304 +1,304 @@ -using System; -using System.Collections.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, 5, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath53; - npc.knockBackResist = 0.35f; - } - - 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) - { - 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, 60, 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); - } - } - } - } +using System; +using System.Collections.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, 5, 0); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath53; + npc.knockBackResist = 0.35f; + } + + 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) + { + 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, 60, 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 diff --git a/NPCs/AbyssNPCs/Frogfish.cs b/NPCs/AbyssNPCs/Frogfish.cs index adf8bf64fc..7f0418b6f8 100644 --- a/NPCs/AbyssNPCs/Frogfish.cs +++ b/NPCs/AbyssNPCs/Frogfish.cs @@ -1,272 +1,272 @@ -using System; -using System.Collections.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, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; - } - - 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.5f; + } + + 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) + { + 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 diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs index cfbf7a419f..da657f77a9 100644 --- a/NPCs/AbyssNPCs/GiantSquid.cs +++ b/NPCs/AbyssNPCs/GiantSquid.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; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class GiantSquid : ModNPC - { - public 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 = 50; - npc.width = 50; - npc.height = 220; - npc.defense = 25; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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 && - (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 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - player.AddBuff(BuffID.Darkness, 300, 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(1000) == 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, 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("Lumenite"), Main.rand.Next(1, 3)); - } - 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); - } - } - } - } +using System; +using System.Collections.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 GiantSquid : ModNPC + { + public 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 = 50; + npc.width = 50; + npc.height = 220; + npc.defense = 25; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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 && + (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 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + player.AddBuff(BuffID.Darkness, 300, 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(1000) == 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, 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("Lumenite"), Main.rand.Next(1, 3)); + } + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 5e48fd2a77..fb9668a820 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.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, 10, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath54; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - - 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, 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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, 10, 0); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath54; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } + + 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, 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) + { + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelBody.cs b/NPCs/AbyssNPCs/GulperEelBody.cs index c28ace7d37..3b58c3883d 100644 --- a/NPCs/AbyssNPCs/GulperEelBody.cs +++ b/NPCs/AbyssNPCs/GulperEelBody.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; - -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 = 70; //70 - npc.width = 56; //36 - npc.height = 36; - npc.defense = 80; - npc.lifeMax = 35000; - 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; - } - - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, 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.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 = 70; //70 + npc.width = 56; //36 + npc.height = 36; + npc.defense = 80; + npc.lifeMax = 35000; + 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; + } + + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs index 7d619c69d5..0e79a861dc 100644 --- a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs +++ b/NPCs/AbyssNPCs/GulperEelBodyAlt.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; - -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 = 70; //70 - npc.width = 36; //36 - npc.height = 36; - npc.defense = 80; - npc.lifeMax = 35000; - 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; - } - - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, 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.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 = 70; //70 + npc.width = 36; //36 + npc.height = 36; + npc.defense = 80; + npc.lifeMax = 35000; + 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; + } + + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 3185d33426..9289af9866 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -1,496 +1,496 @@ -using System; -using System.Collections.Generic; -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.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 = 120; - npc.width = 66; //36 - npc.height = 86; //20 - npc.defense = 50; - npc.lifeMax = 35000; - 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, 5, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - } - - 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 - 200); //800 - if (!detectsPlayer) - { - 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 (!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 0.05f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) - { - return 0.1f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 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(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)); - } - 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); - } - } - } - - 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"), 300); - 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +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 = 120; + npc.width = 66; //36 + npc.height = 86; //20 + npc.defense = 50; + npc.lifeMax = 35000; + 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, 5, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + } + + 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 - 200); //800 + if (!detectsPlayer) + { + 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 (!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 0.05f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) + { + return 0.1f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 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(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)); + } + 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); + } + } + } + + 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"), 300); + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelTail.cs b/NPCs/AbyssNPCs/GulperEelTail.cs index b55a0e045f..69e08e8507 100644 --- a/NPCs/AbyssNPCs/GulperEelTail.cs +++ b/NPCs/AbyssNPCs/GulperEelTail.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; - -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 = 50; //70 - npc.width = 54; //28 - npc.height = 76; //28 - npc.defense = 100; - npc.lifeMax = 35000; - 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; - } - - 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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, 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.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 = 50; //70 + npc.width = 54; //28 + npc.height = 76; //28 + npc.defense = 100; + npc.lifeMax = 35000; + 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; + } + + 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); + } + } + } + + 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 diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs index e04b7987eb..1f23cabfc5 100644 --- a/NPCs/AbyssNPCs/Laserfish.cs +++ b/NPCs/AbyssNPCs/Laserfish.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 Laserfish : ModNPC - { - public 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 = 120; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath26; - npc.knockBackResist = 0.65f; - } - - 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 && - (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] >= 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 = 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 = 32; - if (Main.expertMode) - { - damage = 25; - } - 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 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 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, 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("Lumenite"), 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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 Laserfish : ModNPC + { + public 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 = 120; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 20, 0); + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath26; + npc.knockBackResist = 0.65f; + } + + 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 && + (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] >= 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 = 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 = 32; + if (Main.expertMode) + { + damage = 25; + } + 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 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 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, 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("Lumenite"), 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs index 1c7d03df4f..40a3e8c007 100644 --- a/NPCs/AbyssNPCs/LuminousCorvina.cs +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -1,309 +1,309 @@ -using System; -using System.Collections.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 LuminousCorvina : ModNPC - { - public bool hasBeenHit = false; - public 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 = 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; - npc.knockBackResist = 0.85f; - } - - 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"), 180, 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"), 120, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return 0.1f; - } - 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(1000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss) - { - 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(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("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); - } - } - } - } +using System; +using System.Collections.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 LuminousCorvina : ModNPC + { + public bool hasBeenHit = false; + public 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 = 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; + npc.knockBackResist = 0.85f; + } + + 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"), 180, 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"), 120, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return 0.1f; + } + 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(1000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss) + { + 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(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("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 diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index 85c09a1ff4..658549a03c 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -1,128 +1,128 @@ -using System; -using System.Collections.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, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[189] = true; - } - - 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); - } - } - } - } +using System; +using System.Collections.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, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[189] = true; + } + + 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 diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs index b22b73ce64..62feebb74d 100644 --- a/NPCs/AbyssNPCs/Mauler.cs +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -1,383 +1,383 @@ -using System; -using System.Collections.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 Mauler : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mauler"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 115; - npc.width = 166; - npc.height = 66; - npc.defense = 50; - npc.lifeMax = 144000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - } - - 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 && - (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"), 150); - player.AddBuff(mod.BuffType("Horror"), 150, 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); - } - } - } - } +using System; +using System.Collections.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 Mauler : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mauler"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 115; + npc.width = 166; + npc.height = 66; + npc.defense = 50; + npc.lifeMax = 144000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + } + + 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 && + (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"), 150); + player.AddBuff(mod.BuffType("Horror"), 150, 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/MirageJelly.cs b/NPCs/AbyssNPCs/MirageJelly.cs index 1ac0555ad8..7e07dfc474 100644 --- a/NPCs/AbyssNPCs/MirageJelly.cs +++ b/NPCs/AbyssNPCs/MirageJelly.cs @@ -1,232 +1,232 @@ -using System; -using System.Collections.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 MirageJelly : ModNPC - { - public bool teleporting = false; - public bool rephasing = false; - public 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 = 80; - npc.width = 70; - npc.height = 162; - npc.defense = 10; - npc.lifeMax = 5000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - } - - 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 0.1f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss) - { - 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); - } - } - } - } +using System; +using System.Collections.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 MirageJelly : ModNPC + { + public bool teleporting = false; + public bool rephasing = false; + public 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 = 80; + npc.width = 70; + npc.height = 162; + npc.defense = 10; + npc.lifeMax = 5000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + } + + 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 0.1f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss) + { + 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 diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs index aaf3806c33..3d81c4a510 100644 --- a/NPCs/AbyssNPCs/MorayEel.cs +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -1,274 +1,274 @@ -using System; -using System.Collections.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 - { - public 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 = 35; - npc.width = 136; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 110; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.75f; - } - - 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 && - (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 0.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); - } - } - } - } +using System; +using System.Collections.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 + { + public 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 = 35; + npc.width = 136; + npc.height = 40; + npc.defense = 8; + npc.lifeMax = 110; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.75f; + } + + 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 && + (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 0.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 diff --git a/NPCs/AbyssNPCs/OarfishBody.cs b/NPCs/AbyssNPCs/OarfishBody.cs index caa6c4555c..c2ea9654cd 100644 --- a/NPCs/AbyssNPCs/OarfishBody.cs +++ b/NPCs/AbyssNPCs/OarfishBody.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.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; - } - - 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); - } - } - } - } +using System; +using System.Collections.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; + } + + 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 diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index c481cafedc..4a7f997089 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -1,450 +1,450 @@ -using System; -using System.Collections.Generic; -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.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, 20, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - 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 0.05f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) - { - return 0.1f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 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, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 150); - player.AddBuff(mod.BuffType("Horror"), 120, 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +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, 20, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + 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 0.05f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + { + return 0.1f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 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, 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 150); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/OarfishTail.cs b/NPCs/AbyssNPCs/OarfishTail.cs index dde2fa37a3..a59e8f4363 100644 --- a/NPCs/AbyssNPCs/OarfishTail.cs +++ b/NPCs/AbyssNPCs/OarfishTail.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.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; - } - - 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); - } - } - } - } +using System; +using System.Collections.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; + } + + 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 diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index ea50d39575..57dc21e7f5 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -1,679 +1,679 @@ -using System; -using System.Collections.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 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.damage = 125; - npc.width = 280; - npc.height = 150; - npc.defense = 70; - npc.lifeMax = 150000; - 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, 30, 0, 0); - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - } - - public override void AI() - { - 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 && - (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 (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] >= 90f) - { - 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.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"), 300); - 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 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && - !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) - { - 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("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(100) == 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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 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.damage = 125; + npc.width = 280; + npc.height = 150; + npc.defense = 70; + npc.lifeMax = 150000; + 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, 30, 0, 0); + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + } + + public override void AI() + { + 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 && + (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 (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] >= 90f) + { + 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.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"), 300); + 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 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && + !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + { + 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("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(100) == 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) + { + 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 diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs index 52fbba09c2..d35777041e 100644 --- a/NPCs/AbyssNPCs/SeaUrchin.cs +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -1,351 +1,351 @@ -using System; -using System.Collections.Generic; -using 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, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - } - - 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, 180, 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); - } - } - } - } +using System; +using System.Collections.Generic; +using 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, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + } + + 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, 180, 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 diff --git a/NPCs/AbyssNPCs/ToxicMinnow.cs b/NPCs/AbyssNPCs/ToxicMinnow.cs index 9235aacdc5..35aaa14804 100644 --- a/NPCs/AbyssNPCs/ToxicMinnow.cs +++ b/NPCs/AbyssNPCs/ToxicMinnow.cs @@ -1,266 +1,266 @@ -using System; -using System.Collections.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 ToxicMinnow : ModNPC - { - 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, 0, 1); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.15f; - } - - 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 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 = 20; - 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 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return 0.15f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return 0.1f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss) - { - 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); - } - } - } - } +using System; +using System.Collections.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 ToxicMinnow : ModNPC + { + 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, 0, 1); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.15f; + } + + 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 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 = 20; + 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 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return 0.15f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return 0.1f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss) + { + 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 diff --git a/NPCs/AbyssNPCs/Trasher.cs b/NPCs/AbyssNPCs/Trasher.cs index 5376ba9b66..4dab53b3b7 100644 --- a/NPCs/AbyssNPCs/Trasher.cs +++ b/NPCs/AbyssNPCs/Trasher.cs @@ -1,366 +1,366 @@ -using System; -using System.Collections.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 - { - public 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, 30, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - npc.knockBackResist = 0f; - } - - 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 && - (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, 240, true); - player.AddBuff(BuffID.Venom, 240, 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(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); - } - } - } - } +using System; +using System.Collections.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 + { + public 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, 30, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + npc.knockBackResist = 0f; + } + + 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 && + (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, 240, true); + player.AddBuff(BuffID.Venom, 240, 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(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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs index cf7b74d870..c7654cc497 100644 --- a/NPCs/AbyssNPCs/Viperfish.cs +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -1,303 +1,303 @@ -using System; -using System.Collections.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 Viperfish : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viperfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 30; - npc.width = 72; - npc.height = 30; - npc.defense = 15; - npc.lifeMax = 80; - 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; - } - - 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 && - (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, 180, true); - 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 0.1f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000) == 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(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("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); - } - } - } - } +using System; +using System.Collections.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 Viperfish : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viperfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 30; + npc.width = 72; + npc.height = 30; + npc.defense = 15; + npc.lifeMax = 80; + 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; + } + + 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 && + (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, 180, true); + 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 0.1f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000) == 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(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("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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index a6c96beb88..089f740347 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -1,815 +1,815 @@ -using System; -using System.Collections.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.Astrageldon -{ - [AutoloadBossHead] - public class Astrageldon : ModNPC - { - private float bossLife; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 15f; - npc.damage = 70; - npc.width = 400; - npc.height = 280; - npc.defense = 120; - npc.lifeMax = CalamityWorld.revenge ? 61075 : 51000; - if (CalamityWorld.death) - { - npc.lifeMax = 90875; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 20, 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.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"); - npc.DeathSound = SoundID.NPCDeath14; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); - bossBag = mod.ItemType("AstrageldonBag"); - if (NPC.downedMoonlord && CalamityWorld.revenge) - { - npc.lifeMax = 400000; - npc.value = Item.buyPrice(3, 0, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1050000 : 940000; - } - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - int damageBuff = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); - int shootBuff = (int)(2f * (1f - (float)npc.life / (float)npc.lifeMax)); - float shootTimer = 1f + ((float)shootBuff); - bool dayTime = Main.dayTime; - Player player = Main.player[npc.target]; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (!player.active || player.dead || dayTime) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.noTileCollide = true; - npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - } - if (npc.ai[0] != 1f) //emit light when not recharging - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); - } - if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || npc.GetGlobalNPC(mod).enraged) //fire fast, latent homing, projectiles while walking. lasers in a circle pattern while teleporting - { - if (Main.netMode != 1) - { - npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); - if (npc.localAI[0] >= 180f) //6 seconds 3 seconds 2 seconds - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - int laserDamage = expertMode ? 35 : 45; //180 120 - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); - if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) - { - laserDamage *= 3; - } - if (npc.ai[0] >= 5f || npc.GetGlobalNPC(mod).enraged) //teleporting - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 7f), - (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 7f), - (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) //falling and walking - { - float num179 = 18.5f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num185 = mod.ProjectileType("AstralLaser"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 5; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - if (npc.ai[0] == 0f) //start up - { - npc.damage = 0; - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 60f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) //use idle frames and regain fuel, become vulnerable - { - npc.damage = 0; - npc.defense = 0; - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - npc.ai[1] += 1f; - if (npc.ai[1] >= ((npc.life < npc.lifeMax / 4 || npc.GetGlobalNPC(mod).enraged) ? 90f : 150f)) - { - npc.defense = 120; - npc.noGravity = true; - npc.noTileCollide = true; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) //walk around and fire astral flames and lasers - { - npc.damage = npc.defDamage + damageBuff; - float num823 = 4.5f; - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num823 = 5.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num823 = 7f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 200f) - { - flag51 = true; - } - if (flag51) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - } - else - { - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - if (npc.direction > 0) - { - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - } - if (npc.direction < 0) - { - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } - } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) - { - flag52 = true; - } - if (flag52) - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y > -0.2) - { - npc.velocity.Y = npc.velocity.Y - 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = npc.velocity.Y + 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) - { - npc.noGravity = false; - npc.noTileCollide = false; - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } - else if (npc.ai[0] == 3f) //leap upwards - { - npc.damage = npc.defDamage + damageBuff; - npc.noTileCollide = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 60f) //120 - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)(4 * npc.direction); //4 - npc.velocity.Y = -14.5f; //12.1 - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 4f) //stomp - { - npc.damage = npc.defDamage + damageBuff; - 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, (Main.rand.Next(2) == 0 ? 55 : 173), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num624].velocity *= 0.2f; - } - } - } - else - { - npc.TargetClosest(true); - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) - { - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y + 0.6f; //0.2 - } - else - { - if (npc.direction < 0) - { - npc.velocity.X = npc.velocity.X - 0.2f; - } - else if (npc.direction > 0) - { - npc.velocity.X = npc.velocity.X + 0.2f; - } - float num626 = 8f; //4 - if (revenge) - { - num626 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num626 += 2f; - } - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.velocity.X < -num626) - { - npc.velocity.X = -num626; - } - if (npc.velocity.X > num626) - { - npc.velocity.X = num626; - } - } - } - } - else if (npc.ai[0] == 5f) //start teleport and summon minions, jump a bit - { - npc.velocity.X *= 0.95f; - npc.velocity.Y *= 0.95f; - npc.chaseable = true; - npc.dontTakeDamage = false; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] += 5f; - } - if (npc.localAI[1] >= 60f) - { - npc.damage = npc.defDamage + damageBuff; - } - 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 - 50, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); - } - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)Main.player[npc.target].Center.X / 16; - num1251 = (int)Main.player[npc.target].Center.Y / 16; - num1250 += Main.rand.Next(-30, 31); - num1251 += Main.rand.Next(-30, 31); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - break; - } - if (num1249 > 100) - { - goto Block; - } - } - npc.ai[0] = 6f; - npc.ai[3] = (float)num1250; - npc.localAI[2] = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[0] == 6f) //mid-teleport - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.alpha += 10; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.ai[3] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.localAI[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 7f; - npc.netUpdate = true; - } - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, (Main.rand.Next(2) == 0 ? 173 : 55), 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 - 50, 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, (Main.rand.Next(2) == 0 ? 173 : 55), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - num = num245; - } - } - } - - public override void FindFrame(int frameHeight) - { - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - else //stomping - { - if (npc.localAI[3] == 0f) - { - npc.localAI[3] = 1f; - npc.frameCounter = 0.0; - npc.frame.Y = 0; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else if (npc.ai[0] >= 5f) - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - if (npc.velocity.Y == 0f) //idle before teleport - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else //in-air - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D NPCTexture = Main.npcTexture[npc.type]; - Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - 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"); - } - } - Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); - int frameCount = Main.npcFrameCount[npc.type]; - Microsoft.Xna.Framework.Rectangle frame = npc.frame; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; - Main.spriteBatch.Draw(NPCTexture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(lightColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); - 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 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - } - - public override void NPCLoot() - { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; 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 (NPC.downedMoonlord) - { - int amount = Main.rand.Next(25, 41) / 2; - if (Main.expertMode) - { - amount = (int)((float)amount * 1.5f); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - 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, 55, 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, 55, 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"), 150, 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.Projectiles; + +namespace CalamityMod.NPCs.Astrageldon +{ + [AutoloadBossHead] + public class Astrageldon : ModNPC + { + private float bossLife; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 15f; + npc.damage = 70; + npc.width = 400; + npc.height = 280; + npc.defense = 120; + npc.lifeMax = CalamityWorld.revenge ? 65075 : 51000; + if (CalamityWorld.death) + { + npc.lifeMax = 100875; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 20, 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.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"); + npc.DeathSound = SoundID.NPCDeath14; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); + bossBag = mod.ItemType("AstrageldonBag"); + if (NPC.downedMoonlord && CalamityWorld.revenge) + { + npc.lifeMax = 400000; + npc.value = Item.buyPrice(3, 0, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1150000 : 1000000; + } + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + int damageBuff = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); + int shootBuff = (int)(2f * (1f - (float)npc.life / (float)npc.lifeMax)); + float shootTimer = 1f + ((float)shootBuff); + bool dayTime = Main.dayTime; + Player player = Main.player[npc.target]; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (!player.active || player.dead || dayTime) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.noTileCollide = true; + npc.velocity = new Vector2(0f, 10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + } + if (npc.ai[0] != 1f) //emit light when not recharging + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); + } + if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || npc.GetGlobalNPC(mod).enraged) //fire fast, latent homing, projectiles while walking. lasers in a circle pattern while teleporting + { + if (Main.netMode != 1) + { + npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); + if (npc.localAI[0] >= 180f) //6 seconds 3 seconds 2 seconds + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + int laserDamage = expertMode ? 35 : 45; //180 120 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); + if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) + { + laserDamage *= 3; + } + if (npc.ai[0] >= 5f || npc.GetGlobalNPC(mod).enraged) //teleporting + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 7f), + (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 7f), + (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) //falling and walking + { + float num179 = 18.5f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num185 = mod.ProjectileType("AstralLaser"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 5; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-60, 61); + num182 += (float)Main.rand.Next(-60, 61); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + if (npc.ai[0] == 0f) //start up + { + npc.damage = 0; + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 60f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) //use idle frames and regain fuel, become vulnerable + { + npc.damage = 0; + npc.defense = 0; + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + npc.ai[1] += 1f; + if (npc.ai[1] >= ((npc.life < npc.lifeMax / 4 || npc.GetGlobalNPC(mod).enraged) ? 90f : 150f)) + { + npc.defense = 120; + npc.noGravity = true; + npc.noTileCollide = true; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) //walk around and fire astral flames and lasers + { + npc.damage = npc.defDamage + damageBuff; + float num823 = 4.5f; + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num823 = 5.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num823 = 7f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 200f) + { + flag51 = true; + } + if (flag51) + { + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + } + else + { + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + if (npc.direction > 0) + { + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + } + if (npc.direction < 0) + { + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } + } + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + bool flag52 = false; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + { + flag52 = true; + } + if (flag52) + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y > -0.2) + { + npc.velocity.Y = npc.velocity.Y - 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = npc.velocity.Y + 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 360f) + { + npc.noGravity = false; + npc.noTileCollide = false; + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } + else if (npc.ai[0] == 3f) //leap upwards + { + npc.damage = npc.defDamage + damageBuff; + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 60f) //120 + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)(4 * npc.direction); //4 + npc.velocity.Y = -14.5f; //12.1 + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + else if (npc.ai[0] == 4f) //stomp + { + npc.damage = npc.defDamage + damageBuff; + if (npc.velocity.Y == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); + npc.ai[2] += 1f; + if (npc.ai[2] >= 2f) + { + npc.ai[0] = ((npc.life < npc.lifeMax / 2 || revenge) ? 5f : 1f); + npc.ai[2] = 0f; + } + else + { + npc.ai[0] = 3f; + } + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + { + for (int num623 = 0; num623 < 4; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num624].velocity *= 0.2f; + } + } + } + else + { + npc.TargetClosest(true); + if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + { + npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y = npc.velocity.Y + 0.6f; //0.2 + } + else + { + if (npc.direction < 0) + { + npc.velocity.X = npc.velocity.X - 0.2f; + } + else if (npc.direction > 0) + { + npc.velocity.X = npc.velocity.X + 0.2f; + } + float num626 = 8f; //4 + if (revenge) + { + num626 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num626 += 2f; + } + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.velocity.X < -num626) + { + npc.velocity.X = -num626; + } + if (npc.velocity.X > num626) + { + npc.velocity.X = num626; + } + } + } + } + else if (npc.ai[0] == 5f) //start teleport and summon minions, jump a bit + { + npc.velocity.X *= 0.95f; + npc.velocity.Y *= 0.95f; + npc.chaseable = true; + npc.dontTakeDamage = false; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] += 5f; + } + if (npc.localAI[1] >= 60f) + { + npc.damage = npc.defDamage + damageBuff; + } + 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 - 50, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)Main.player[npc.target].Center.X / 16; + num1251 = (int)Main.player[npc.target].Center.Y / 16; + num1250 += Main.rand.Next(-30, 31); + num1251 += Main.rand.Next(-30, 31); + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + break; + } + if (num1249 > 100) + { + goto Block; + } + } + npc.ai[0] = 6f; + npc.ai[3] = (float)num1250; + npc.localAI[2] = (float)num1251; + npc.netUpdate = true; + Block:; + } + } + } + else if (npc.ai[0] == 6f) //mid-teleport + { + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.alpha += 10; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.ai[3] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.localAI[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 7f; + npc.netUpdate = true; + } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } + else if (npc.ai[0] == 7f) //end teleport + { + npc.alpha -= 10; + if (npc.alpha <= 0) + { + bool spawnFlag = revenge; + if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) + { + spawnFlag = false; + } + if (spawnFlag && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 50, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } + } + + public override void FindFrame(int frameHeight) + { + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + { + if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + else //stomping + { + if (npc.localAI[3] == 0f) + { + npc.localAI[3] = 1f; + npc.frameCounter = 0.0; + npc.frame.Y = 0; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else if (npc.ai[0] >= 5f) + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + if (npc.velocity.Y == 0f) //idle before teleport + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else //in-air + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } + + public override bool 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)); + Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); + int frameCount = Main.npcFrameCount[npc.type]; + Microsoft.Xna.Framework.Rectangle frame = npc.frame; + float scale = npc.scale; + float rotation = npc.rotation; + float offsetY = npc.gfxOffY; + Main.spriteBatch.Draw(NPCTexture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(lightColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); + 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 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + } + + public override void NPCLoot() + { + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; 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 (NPC.downedMoonlord) + { + int amount = Main.rand.Next(25, 41) / 2; + if (Main.expertMode) + { + amount = (int)((float)amount * 1.5f); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + 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"), 150, true); + } + } } \ No newline at end of file diff --git a/NPCs/Astrageldon/AstrageldonSlime.cs b/NPCs/Astrageldon/AstrageldonSlime.cs index b0ac58f0c3..c55e101ed4 100644 --- a/NPCs/Astrageldon/AstrageldonSlime.cs +++ b/NPCs/Astrageldon/AstrageldonSlime.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; - -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 ? 10 : 25; - if (CalamityWorld.death) - { - npc.lifeMax = 5; - } - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.alpha > 0) - { - npc.alpha -= 5; - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, (Main.rand.Next(2) == 0 ? 173 : 55), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - num = num245; - } - } - npc.TargetClosest(true); - if (npc.life <= 3 || Main.dayTime) - { - npc.dontTakeDamage = true; - Vector2 vector = Main.player[npc.target].Center - npc.Center; - Point point15 = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); - if (vector.Length() < 60f || flag121) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - float num1372 = 22f; - 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, (Main.rand.Next(2) == 0 ? 173 : 55), 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - if (npc.localAI[0] >= 260f) - { - npc.localAI[0] -= 60f; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, (Main.rand.Next(2) == 0 ? 173 : 55), 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 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 < 5; 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 < 20; 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 ? 150 : 100; - 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, (Main.rand.Next(2) == 0 ? 173 : 55), 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - 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, (Main.rand.Next(2) == 0 ? 173 : 55), 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, (Main.rand.Next(2) == 0 ? 173 : 55), 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return 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.Projectiles; + +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.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.alpha > 0) + { + npc.alpha -= 5; + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + num = num245; + } + } + npc.TargetClosest(true); + if (npc.life <= 1000 || Main.dayTime) + { + npc.dontTakeDamage = true; + Vector2 vector = Main.player[npc.target].Center - npc.Center; + Point point15 = npc.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point15); + bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); + if (vector.Length() < 60f || flag121) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + float num1372 = 22f; + 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, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + if (npc.localAI[0] >= 260f) + { + npc.localAI[0] -= 60f; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 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 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 < 5; 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 < 20; 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 ? 150 : 100; + 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), 2f); + Main.dust[num622].velocity *= 3f; + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + } } \ No newline at end of file diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index c21a13acda..67423c25ce 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Aries"); Main.npcFrameCount[npc.type] = 8; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AriesGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AriesGlow"); } public override void SetDefaults() @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.lifeMax = 450; npc.knockBackResist = 0.5f; npc.value = 380f; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); } @@ -64,6 +63,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, mod.DustType("AstralOrange"), 1f, 4, 24); } @@ -81,5 +82,17 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index cff9cab2ee..7de2490a80 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -1,293 +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.AstralBiomeNPCs -{ - public class AstralProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Probe"); - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 20; - npc.lifeMax = 70; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.85f; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - 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 = 18; - if (Main.expertMode) - { - num8 = 14; - } - 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.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.75f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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.Projectiles; + +namespace CalamityMod.NPCs.AstralBiomeNPCs +{ + public class AstralProbe : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Probe"); + } + + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 20; + npc.lifeMax = 70; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.85f; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.DeathSound = SoundID.NPCDeath14; + } + + 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 = 18; + if (Main.expertMode) + { + num8 = 14; + } + 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) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + + 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.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index 525a9ba6e8..e2b927c556 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Main.npcFrameCount[npc.type] = 5; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaGroundGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaGroundGlow"); base.SetStaticDefaults(); } @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 90; npc.defense = 30; npc.lifeMax = 750; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.knockBackResist = 0.28f; npc.value = 900f; @@ -99,6 +98,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); //if dead do gores @@ -125,5 +126,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs index 3107b1f0f8..e6291c19da 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Main.npcFrameCount[npc.type] = 4; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaWallGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaWallGlow"); base.SetStaticDefaults(); } @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 90; npc.defense = 30; npc.lifeMax = 750; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.knockBackResist = 0f; npc.noGravity = true; @@ -86,6 +85,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); //if dead do gores @@ -103,5 +104,14 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Vector2 origin = new Vector2(40f, 40f); 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index c7ec8a3fc7..39c8de6cfc 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -89,12 +89,12 @@ 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) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AtlasGlow"); + 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() @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs swingYeet = false; - if (Main.rand.Next(1) == 0) //Launch the player very fast very rarely + if (Main.rand.Next(1000) == 0) //Launch the player very fast very rarely { horMult = 12f; verMult = 2.3f; @@ -393,7 +393,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { //play sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt" + Main.rand.Next(3)), npc.Center); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0" + Main.rand.Next(3)), npc.Center); CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 30); @@ -576,5 +576,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index 6120b9bb88..75b566f69f 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -20,9 +20,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Big Sightseer"); Main.npcFrameCount[npc.type] = 4; - - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/BigSightseerGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/BigSightseerGlow"); } public override void SetDefaults() @@ -32,7 +31,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 85; npc.defense = 30; npc.lifeMax = 640; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.noGravity = true; npc.knockBackResist = 0.7f; @@ -101,6 +99,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); //if dead do gores @@ -128,6 +128,15 @@ 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 class AstralSeekerSpit : ModNPC diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index 4b73369a6a..c40d354056 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Fusion Feeder"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/FusionFeederGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/FusionFeederGlow"); Main.npcFrameCount[npc.type] = 4; } @@ -30,199 +30,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.width = 120; npc.height = 24; npc.damage = 64; - npc.aiStyle = -1; + npc.aiStyle = 103; npc.lifeMax = 600; npc.defense = 22; npc.value = 900f; npc.knockBackResist = 0.7f; npc.behindTiles = true; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); animationType = NPCID.SandShark; } - - public override void AI() - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - Point pt = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(pt); - bool flag121 = tileSafely.nactive() && (TileID.Sets.Conversion.Sand[(int)tileSafely.type] || TileID.Sets.Conversion.Sandstone[(int)tileSafely.type] || TileID.Sets.Conversion.HardenedSand[(int)tileSafely.type]); - flag121 |= npc.wet; - bool flag122 = false; - npc.TargetClosest(false); - Vector2 vector224 = npc.targetRect.Center.ToVector2(); - if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector224) > 150f) - { - flag122 = true; - } - if (npc.localAI[0] == -1f && !flag121) - { - npc.localAI[0] = 20f; - } - if (npc.localAI[0] > 0f) - { - npc.localAI[0] -= 1f; - } - if (flag121) - { - if (npc.soundDelay == 0) - { - float num1485 = npc.Distance(vector224) / 40f; - if (num1485 < 10f) - { - num1485 = 10f; - } - if (num1485 > 20f) - { - num1485 = 20f; - } - npc.soundDelay = (int)num1485; - } - float arg_46CA6_0 = npc.ai[1]; - bool flag123 = false; - pt = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(pt.X, pt.Y - 2); - if (tileSafely.nactive() && (TileID.Sets.Conversion.Sand[(int)tileSafely.type] || TileID.Sets.Conversion.Sandstone[(int)tileSafely.type] || TileID.Sets.Conversion.HardenedSand[(int)tileSafely.type])) - { - 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; - if (npc.velocity.X > 5f) - { - npc.velocity.X = 5f; - } - if (npc.velocity.X < -5f) - { - npc.velocity.X = -5f; - } - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } - Vector2 vec6 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; - pt = vec6.ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(pt); - bool flag124 = tileSafely.nactive() && (TileID.Sets.Conversion.Sand[(int)tileSafely.type] || TileID.Sets.Conversion.Sandstone[(int)tileSafely.type] || TileID.Sets.Conversion.HardenedSand[(int)tileSafely.type]); - if (!flag124 && npc.wet) - { - flag124 = (tileSafely.liquid > 0); - } - if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && npc.Distance(vector224) < 400f && (npc.ai[2] >= 30f || npc.ai[2] < 0f)) - { - if (npc.localAI[0] == 0f) - { - Main.PlaySound(14, npc.Center, 542); - npc.localAI[0] = -1f; - } - npc.ai[2] = -30f; - Vector2 vector225 = npc.DirectionTo(vector224 + new Vector2(0f, -80f)); - npc.velocity = vector225 * 12f; - } - } - else - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.velocity.Y * -1f; - npc.directionY = Math.Sign(npc.velocity.Y); - npc.ai[0] = (float)npc.directionY; - } - float num1486 = 6f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1486 || npc.velocity.X > num1486) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (flag123) - { - npc.ai[0] = -1f; - } - else - { - npc.ai[0] = 1f; - } - float num1487 = 0.06f; - float num1488 = 0.01f; - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - num1488; - if (npc.velocity.Y < -num1487) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + num1488; - if (npc.velocity.Y > num1487) - { - 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 num1489 = 1f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1489 || npc.velocity.X > num1489) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - } - 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 (npc.rotation < -0.2f) - { - npc.rotation = -0.2f; - } - if (npc.rotation > 0.2f) - { - npc.rotation = 0.2f; - return; - } - } - + public override void FindFrame(int frameHeight) { //DO DUST @@ -235,6 +53,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 25); //if dead do gores @@ -270,5 +90,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index d782c76953..d09e6c3de9 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Hadarian"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HadarianGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HadarianGlow"); Main.npcFrameCount[npc.type] = 7; } @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 78; npc.defense = 18; npc.lifeMax = 490; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.knockBackResist = 0.65f; npc.value = 450f; @@ -140,6 +139,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + 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 @@ -161,5 +162,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index 0258d2e819..b8eafb6e99 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Hive"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); Main.npcFrameCount[npc.type] = 6; } @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 90; npc.defense = 25; npc.lifeMax = 700; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.knockBackResist = 0f; npc.value = 550f; @@ -77,6 +76,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + 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 @@ -111,5 +112,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Hiveling.cs b/NPCs/AstralBiomeNPCs/Hiveling.cs index b9795cd8dd..7883f37559 100644 --- a/NPCs/AstralBiomeNPCs/Hiveling.cs +++ b/NPCs/AstralBiomeNPCs/Hiveling.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Hiveling"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); Main.npcFrameCount[npc.type] = 4; } @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 50; npc.defense = 8; npc.lifeMax = 220; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.knockBackResist = 0.4f; npc.noGravity = true; @@ -92,6 +91,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + 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 diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index 6e79841c39..7b476aff51 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Mantis"); Main.npcFrameCount[npc.type] = 14; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/MantisGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/MantisGlow"); } public override void SetDefaults() @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.lifeMax = 510; npc.knockBackResist = 0.1f; npc.value = 450f; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); } @@ -186,6 +185,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, mod.DustType("AstralOrange"), 1f, 4, 24); } @@ -203,5 +204,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index 67727b380a..150ce09441 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -28,8 +28,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs DisplayName.SetDefault("Nova"); Main.npcFrameCount[npc.type] = 8; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/NovaGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/NovaGlow"); } public override void SetDefaults() @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 75; npc.defense = 25; npc.lifeMax = 350; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.noGravity = true; npc.knockBackResist = 0.4f; @@ -204,6 +203,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 40); //if dead do gores @@ -234,5 +235,14 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index 8da39f4319..54cd49b70e 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -21,8 +21,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs DisplayName.SetDefault("Small Sightseer"); Main.npcFrameCount[npc.type] = 4; - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/SmallSightseerGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/SmallSightseerGlow"); } public override void SetDefaults() @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.damage = 58; npc.defense = 26; npc.lifeMax = 460; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.noGravity = true; npc.knockBackResist = 0.48f; @@ -68,6 +67,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); //if dead do gores @@ -95,5 +96,17 @@ 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")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index f6a493cae9..eff64220cb 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -19,8 +19,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Culex"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/StellarCulexGlow"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/StellarCulexGlow"); Main.npcFrameCount[npc.type] = 4; } @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.55f; npc.lifeMax = 320; npc.value = 700f; - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyDeath"); npc.buffImmune[31] = false; @@ -55,6 +54,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit" + Main.rand.Next(3)), npc.Center); + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); //if dead do gores @@ -81,5 +82,17 @@ 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")); + } + } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 7f18a48394..d5868ebd00 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.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; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusBody : ModNPC - { - public int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 70; //70 - npc.npcSlots = 5f; - npc.width = 38; //324 - npc.height = 44; //216 - npc.defense = 45; - npc.lifeMax = CalamityWorld.revenge ? 10800 : 8000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 16400; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 700000 : 550000; - } - 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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - 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); - int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense - defenseDown; - 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) - { - shootTime += 2; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) - { - shootTime += 2; - } - if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.9) - { - shootTime += 1; - } - if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.7) - { - shootTime += 1; - } - if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.4) - { - shootTime += 1; - } - 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 ? 11f : 9f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 16f; - } - 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(-25, 26) * 0.05f; - num943 += (float)Main.rand.Next(-25, 26) * 0.05f; - int num945 = expertMode ? 31 : 37; - 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) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); - return false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((double)npc.life <= (double)npc.lifeMax * 0.33) - { - damage = (int)((double)damage * 0.33f); - if (projectile.minion) - { - return; - } - } - else - { - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 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, 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) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.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.AstrumDeus +{ + public class AstrumDeusBody : ModNPC + { + public int spawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 70; //70 + npc.npcSlots = 5f; + npc.width = 38; //324 + npc.height = 44; //216 + npc.defense = 45; + npc.lifeMax = CalamityWorld.revenge ? 12000 : 8000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 19400; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 740000 : 610000; + } + 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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + 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); + int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense - defenseDown; + 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) + { + shootTime += 2; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) + { + shootTime += 2; + } + if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.9) + { + shootTime += 1; + } + if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.7) + { + shootTime += 1; + } + if ((double)Main.player[npc.target].statLife < (double)Main.player[npc.target].statLifeMax2 * 0.4) + { + shootTime += 1; + } + 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 ? 11f : 9f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 16f; + } + 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(-25, 26) * 0.05f; + num943 += (float)Main.rand.Next(-25, 26) * 0.05f; + int num945 = expertMode ? 31 : 37; + 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) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); + return false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((double)npc.life <= (double)npc.lifeMax * 0.33) + { + damage = (int)((double)damage * 0.33f); + if (projectile.minion) + { + return; + } + } + else + { + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/AstrumDeus/AstrumDeusBodyAlt.png b/NPCs/AstrumDeus/AstrumDeusBodyAlt.png index ad6d358894..fac26158a6 100644 Binary files a/NPCs/AstrumDeus/AstrumDeusBodyAlt.png and b/NPCs/AstrumDeus/AstrumDeusBodyAlt.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral.png b/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral.png index ad6d358894..fac26158a6 100644 Binary files a/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral.png and b/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index 5c55f3b978..bd17d69283 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -1,265 +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; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusBodySpectral : ModNPC - { - public int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 80; //70 - npc.npcSlots = 5f; - npc.width = 38; //324 - npc.height = 44; //216 - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 33750 : 25000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 51250; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 1700000; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - 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) - { - shootTime += CalamityWorld.death ? 4 : 2; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) - { - 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 : 12f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 16f; - } - 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 = expertMode ? 31 : 37; - 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; - } - } - } - } - - // exactly like minion worms: every other segment uses alternate texture - // localAI[3] is set to 1 for every other segment when they are spawned by the head - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAltSpectral"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); - return false; - } - - public override Color? GetAlpha(Color drawColor) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - return new Color(250, 150, Main.DiscoB, npc.alpha); - } - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - return false; - } - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((double)npc.life <= (double)npc.lifeMax * 0.33) - { - damage = (int)((double)damage * 0.33f); - if (projectile.minion) - { - return; - } - } - else - { - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 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, 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) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.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.AstrumDeus +{ + public class AstrumDeusBodySpectral : ModNPC + { + public int spawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 80; //70 + npc.npcSlots = 5f; + npc.width = 38; //324 + npc.height = 44; //216 + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 35850 : 25000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 53750; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2500000 : 1900000; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + 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) + { + shootTime += CalamityWorld.death ? 4 : 2; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) + { + 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 : 12f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 16f; + } + 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 = expertMode ? 31 : 37; + 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"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, + (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")) ? lightColor : drawColor)); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) + { + return false; + } + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((double)npc.life <= (double)npc.lifeMax * 0.33) + { + damage = (int)((double)damage * 0.33f); + if (projectile.minion) + { + return; + } + } + else + { + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 89e9fd45df..696c9c0ead 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,616 +1,616 @@ -using System; -using System.Collections.Generic; -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; - -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 = 85; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 56; //216 - npc.defense = 30; - npc.lifeMax = CalamityWorld.revenge ? 10800 : 8000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 16400; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 700000 : 550000; - } - 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.value = Item.buyPrice(0, 0, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense - defenseDown; - 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 ? 2f : 1.8f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedMult = (npc.GetGlobalNPC(mod).enraged ? 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 num954 = (npc.GetGlobalNPC(mod).enraged ? 200 : 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; - } - float maxSpeed = 20f; - if (Main.dayTime || Main.player[npc.target].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; - maxSpeed = 40f; - } - 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 = 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; - return; - } - } - } - - 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 5; - } - 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, 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 PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.Generic; +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; + +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 = 85; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 56; //216 + npc.defense = 30; + npc.lifeMax = CalamityWorld.revenge ? 12000 : 8000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 19400; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 740000 : 610000; + } + 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.value = Item.buyPrice(0, 0, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense - defenseDown; + 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 ? 2f : 1.8f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speedMult = (npc.GetGlobalNPC(mod).enraged ? 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 num954 = (npc.GetGlobalNPC(mod).enraged ? 150 : 300); + 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; + } + float maxSpeed = 20f; + if (Main.dayTime || Main.player[npc.target].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; + maxSpeed = 40f; + } + 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 = 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; + return; + } + } + } + + 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 5; + } + 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 73747aa07f..bebb61f183 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -1,465 +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 Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod; - -namespace CalamityMod.NPCs.AstrumDeus -{ - [AutoloadBossHead] - public class AstrumDeusHeadSpectral : ModNPC - { - 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; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 110; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 56; //216 - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 33750 : 25000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 51250; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 1700000; - } - 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.boss = true; - npc.value = Item.buyPrice(0, 30, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - bossBag = mod.ItemType("AstrumDeusBag"); - } - - public override void AI() - { - npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - 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 ? 15f : 12f); - turnSpeedLimit = (npc.GetGlobalNPC(mod).enraged ? 0.2f : 0.16f); - } - float speedBoost = speedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); - float turnSpeedBoost = turnSpeedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); - 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); - } - - // exactly like minion worms: every other segment uses alternate texture - 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; - } - npc.localAI[1] = 0f; - bool canFly = flies; - if (Main.player[npc.target].dead || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - npc.TargetClosest(false); - canFly = false; - npc.velocity.Y = npc.velocity.Y + 10f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 10f; - } - 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 + 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 Color? GetAlpha(Color drawColor) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - return new Color(250, 150, Main.DiscoB, npc.alpha); - } - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 5; - } - 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, 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 BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.None; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.Generic; +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; + +namespace CalamityMod.NPCs.AstrumDeus +{ + [AutoloadBossHead] + public class AstrumDeusHeadSpectral : ModNPC + { + 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; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 110; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 56; //216 + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 35850 : 25000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 53750; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2500000 : 1900000; + } + 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.boss = true; + npc.value = Item.buyPrice(0, 30, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + bossBag = mod.ItemType("AstrumDeusBag"); + } + + public override void AI() + { + npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + 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 ? 15f : 12f); + turnSpeedLimit = (npc.GetGlobalNPC(mod).enraged ? 0.2f : 0.16f); + } + float speedBoost = speedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); + float turnSpeedBoost = turnSpeedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); + 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; + } + npc.localAI[1] = 0f; + bool canFly = flies; + if (Main.player[npc.target].dead || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + npc.TargetClosest(false); + canFly = false; + npc.velocity.Y = npc.velocity.Y + 10f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 10f; + } + 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 + 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 Color? GetAlpha(Color drawColor) + { + if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) + { + return new Color(250, 150, Main.DiscoB, npc.alpha); + } + return null; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) + { + 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 5; + } + 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.cs b/NPCs/AstrumDeus/AstrumDeusProbe.cs index 4e787f6005..3f3ef517d9 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe.cs @@ -1,146 +1,146 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusProbe : 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 = 30; - 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 ? 35 : 45; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 0.5f, direction.Y * 0.5f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - if (NPC.CountNPCS(mod.NPCType("AstrumDeusHead")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = mod.NPCType("AstrumDeusHead"); - 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, 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 void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusProbe : 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 = 30; + 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 ? 35 : 45; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 0.5f, direction.Y * 0.5f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + if (NPC.CountNPCS(mod.NPCType("AstrumDeusHead")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = mod.NPCType("AstrumDeusHead"); + 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 void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + 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 diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.cs b/NPCs/AstrumDeus/AstrumDeusProbe2.cs index 352c0d2731..6767be0680 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe2.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe2.cs @@ -1,146 +1,146 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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 = 30; - 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 ? 35 : 45; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 2f, direction.Y * 2f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - if (NPC.CountNPCS(mod.NPCType("AstrumDeusHead")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = mod.NPCType("AstrumDeusHead"); - 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, 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 void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 = 30; + 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 ? 35 : 45; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 2f, direction.Y * 2f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + if (NPC.CountNPCS(mod.NPCType("AstrumDeusHead")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = mod.NPCType("AstrumDeusHead"); + 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 void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + 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 diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index e89a67f3e7..df42655280 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -1,293 +1,293 @@ -using System; -using System.Collections.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.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 = 8f; - npc.damage = 30; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 30; - npc.lifeMax = 2000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 120000; - } - npc.knockBackResist = 0.95f; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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 ? 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 = 40; - if (Main.expertMode) - { - num8 = 26; - } - 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.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; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 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; + +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 = 8f; + npc.damage = 30; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 30; + npc.lifeMax = 2000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 120000; + } + npc.knockBackResist = 0.95f; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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 ? 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 = 40; + if (Main.expertMode) + { + num8 = 26; + } + 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.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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); + } + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } } \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 26fc80a7a5..65f654e729 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,167 +1,167 @@ -using System; -using System.Collections.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.AstrumDeus -{ - public class AstrumDeusTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 50; - npc.npcSlots = 5f; - npc.width = 52; //324 - npc.height = 68; //216 - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 10800 : 8000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 16400; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 700000 : 550000; - } - 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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense - defenseDown; - 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 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 5; - } - 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, 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) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.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.AstrumDeus +{ + public class AstrumDeusTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 50; + npc.npcSlots = 5f; + npc.width = 52; //324 + npc.height = 68; //216 + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 12000 : 8000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 19400; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 740000 : 610000; + } + 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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + int defenseDown = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense - defenseDown; + 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 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 5; + } + 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index d95a02c9b4..c75b208198 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -1,186 +1,186 @@ -using System; -using System.Collections.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.AstrumDeus -{ - public class AstrumDeusTailSpectral : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 55; - npc.npcSlots = 5f; - npc.width = 52; //324 - npc.height = 68; //216 - npc.defense = 80; - npc.lifeMax = CalamityWorld.revenge ? 33750 : 25000; //250000 - if (CalamityWorld.death) - { - npc.lifeMax = 51250; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 1700000; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - 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 Color? GetAlpha(Color drawColor) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - return new Color(250, 150, Main.DiscoB, npc.alpha); - } - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) - { - 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) - { - damage /= 5; - } - 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, 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) - { - if (CalamityWorld.downedStarGod) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } +using System; +using System.Collections.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.AstrumDeus +{ + public class AstrumDeusTailSpectral : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 55; + npc.npcSlots = 5f; + npc.width = 52; //324 + npc.height = 68; //216 + npc.defense = 80; + npc.lifeMax = CalamityWorld.revenge ? 35850 : 25000; //250000 + if (CalamityWorld.death) + { + npc.lifeMax = 53750; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2500000 : 1900000; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.dontTakeDamage = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + npc.chaseable = !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + 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 Color? GetAlpha(Color drawColor) + { + if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) + { + return new Color(250, 150, Main.DiscoB, npc.alpha); + } + return null; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (NPC.AnyNPCs(mod.NPCType("AstrumDeusHead"))) + { + 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 == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + if (projectile.penetrate == -1 && !projectile.minion && !projectile.thrown) + { + damage /= 5; + } + 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) + { + if (CalamityWorld.downedStarGod) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, 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 diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index a430600888..2ae37cffc7 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.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.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 = false; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - if (CalamityWorld.downedProvidence) - { - npc.lifeMax = 40000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 150000; - } - } - - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); - bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.2; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) - { - boostDR = true; - npc.chaseable = false; - } - else - { - boostDR = false; - npc.chaseable = true; - } - npc.noTileCollide = true; - float num1446 = goIntoShell ? 1f : 6f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.Next(4) == 0) - { - npc.ai[0] = (float)num1447; - } - } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 32; - if (Main.expertMode) - { - damage = 24; - } - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - if (npc.localAI[0] >= 260f) - { - npc.localAI[0] -= 60f; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } - - public override 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); - } - } - } - } +using System; +using System.Collections.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.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 = false; + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + if (CalamityWorld.downedProvidence) + { + npc.lifeMax = 40000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 150000; + } + } + + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.2; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) + { + boostDR = true; + npc.chaseable = false; + } + else + { + boostDR = false; + npc.chaseable = true; + } + npc.noTileCollide = true; + float num1446 = goIntoShell ? 1f : 6f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.Next(4) == 0) + { + npc.ai[0] = (float)num1447; + } + } + npc.TargetClosest(true); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 32; + if (Main.expertMode) + { + damage = 24; + } + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + if (npc.localAI[0] >= 260f) + { + npc.localAI[0] -= 60f; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) + { + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } + + public override 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 diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs index 19d9af66e5..2752b25536 100644 --- a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -1,685 +1,685 @@ -using System; -using System.Collections.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.BrimstoneWaifu -{ - [AutoloadBossHead] - public class BrimstoneElemental : ModNPC - { - private int dustTimer = 60; - - 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, 10, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); - bossBag = mod.ItemType("BrimstoneWaifuBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 210; - npc.defense = 120; - npc.lifeMax = 300000; - npc.value = Item.buyPrice(1, 0, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4000000 : 3500000; - } - } - - 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) - { - 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); - if (totalDistance < speed) - { - npc.velocity.X = xDistance; - npc.velocity.Y = yDistance; - } - else - { - totalDistance = speed / totalDistance; - npc.velocity.X = xDistance * totalDistance; - npc.velocity.Y = yDistance * totalDistance; - } - } - if (Main.netMode != 1) - { - dustTimer--; - if (dustTimer <= 0 && npc.alpha <= 0) - { - int damage = expertMode ? 20 : 29; - Vector2 position = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)position.X, (int)position.Y, 0f, 0f, mod.ProjectileType("BrimDust"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); //changed - Main.projectile[projectile].timeLeft = 90; - dustTimer = 60; - } - } - if (npc.ai[0] == 0f) - { - npc.defense = 20; - npc.chaseable = true; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.justHit) - { - npc.localAI[1] += 1f; - } - if (brimTeleport) - { - npc.localAI[1] += 1f; - } - if (!calamity) - { - npc.localAI[1] += 2f; - } - 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; - return; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.defense = 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; - return; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= (brimTeleport ? 5 : 4); - if (npc.alpha <= 0) - { - npc.damage = expertMode ? 96 : 60; - if (revenge) - { - int damageBoost = (int)(40f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.damage + damageBoost; - } - npc.dontTakeDamage = false; - npc.defense = 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; - return; - } - } - else if (npc.ai[0] == 3f) - { - npc.defense = 20; - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float xVelocity = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles - float yVelocity = 0.12f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles - float yVelocity2 = 0.04f; - 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); - Vector2 shootFromVectorY = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float playerDistanceX = player.position.X + (float)(player.width / 2) - shootFromVectorY.X; - float playerDistanceY = player.position.Y + (float)(player.height / 2) - 300f - shootFromVectorY.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - npc.ai[1] += 1f; - bool shootProjectile = false; - if (npc.GetGlobalNPC(mod).enraged) - { - 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 = 7f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged) - { - 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 (!Collision.CanHit(new Vector2(shootFromVectorX.X, shootFromVectorX.Y - 30f), 1, 1, player.position, player.width, player.height)) - { - xVelocity = 14f; //changed from 14 not a prob - yVelocity = 0.15f; //changed from 0.1 not a prob - yVelocity2 = 0.05f; - shootFromVectorY = shootFromVectorX; - playerDistanceX = player.position.X + (float)(player.width / 2) - shootFromVectorY.X; - playerDistanceY = player.position.Y + (float)(player.height / 2) - shootFromVectorY.Y; - totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = xVelocity / totalPlayerDistance; - if (npc.velocity.X < playerDistanceX) - { - npc.velocity.X = npc.velocity.X + yVelocity; - if (npc.velocity.X < 0f && playerDistanceX > 0f) - { - npc.velocity.X = npc.velocity.X + yVelocity; - } - } - else if (npc.velocity.X > playerDistanceX) - { - npc.velocity.X = npc.velocity.X - yVelocity; - if (npc.velocity.X > 0f && playerDistanceX < 0f) - { - npc.velocity.X = npc.velocity.X - yVelocity; - } - } - if (npc.velocity.Y < playerDistanceY) - { - npc.velocity.Y = npc.velocity.Y + yVelocity2; - if (npc.velocity.Y < 0f && playerDistanceY > 0f) - { - npc.velocity.Y = npc.velocity.Y + yVelocity2; - } - } - else if (npc.velocity.Y > playerDistanceY) - { - npc.velocity.Y = npc.velocity.Y - yVelocity2; - if (npc.velocity.Y > 0f && playerDistanceY < 0f) - { - npc.velocity.Y = npc.velocity.Y - yVelocity2; - } - } - } - else if (totalPlayerDistance > 200f) //100 - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - totalPlayerDistance = xVelocity / totalPlayerDistance; - if (npc.velocity.X < playerDistanceX) - { - npc.velocity.X = npc.velocity.X + yVelocity; - if (npc.velocity.X < 0f && playerDistanceX > 0f) - { - npc.velocity.X = npc.velocity.X + yVelocity * 2f; - } - } - else if (npc.velocity.X > playerDistanceX) - { - npc.velocity.X = npc.velocity.X - yVelocity; - if (npc.velocity.X > 0f && playerDistanceX < 0f) - { - npc.velocity.X = npc.velocity.X - yVelocity * 2f; - } - } - if (npc.velocity.Y < playerDistanceY) - { - npc.velocity.Y = npc.velocity.Y + yVelocity2; - if (npc.velocity.Y < 0f && playerDistanceY > 0f) - { - npc.velocity.Y = npc.velocity.Y + yVelocity2 * 2f; - } - } - else if (npc.velocity.Y > playerDistanceY) - { - npc.velocity.Y = npc.velocity.Y - yVelocity2; - if (npc.velocity.Y > 0f && playerDistanceY < 0f) - { - npc.velocity.Y = npc.velocity.Y - yVelocity2 * 2f; - } - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - 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) - { - 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; - return; - } - } - } - - 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 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 (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); - } - 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 < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - 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(2, 4)); - int choice = Main.rand.Next(3); - if (choice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); - } - else if (choice == 1) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); - } - } - } - - 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); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore5"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore6"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore7"), 1f); - } - } - } +using System; +using System.Collections.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.BrimstoneWaifu +{ + [AutoloadBossHead] + public class BrimstoneElemental : ModNPC + { + private int dustTimer = 60; + + 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, 10, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); + bossBag = mod.ItemType("BrimstoneWaifuBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 210; + npc.defense = 120; + npc.lifeMax = 300000; + npc.value = Item.buyPrice(1, 0, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4000000 : 3500000; + } + } + + 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) + { + 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); + if (totalDistance < speed) + { + npc.velocity.X = xDistance; + npc.velocity.Y = yDistance; + } + else + { + totalDistance = speed / totalDistance; + npc.velocity.X = xDistance * totalDistance; + npc.velocity.Y = yDistance * totalDistance; + } + } + if (Main.netMode != 1) + { + dustTimer--; + if (dustTimer <= 0 && npc.alpha <= 0) + { + int damage = expertMode ? 20 : 29; + Vector2 position = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile((int)position.X, (int)position.Y, 0f, 0f, mod.ProjectileType("BrimDust"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); //changed + Main.projectile[projectile].timeLeft = 90; + dustTimer = 60; + } + } + if (npc.ai[0] == 0f) + { + npc.defense = 20; + npc.chaseable = true; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.justHit) + { + npc.localAI[1] += 1f; + } + if (brimTeleport) + { + npc.localAI[1] += 1f; + } + if (!calamity) + { + npc.localAI[1] += 2f; + } + 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; + return; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.defense = 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; + return; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= (brimTeleport ? 5 : 4); + if (npc.alpha <= 0) + { + npc.damage = expertMode ? 96 : 60; + if (revenge) + { + int damageBoost = (int)(40f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.damage + damageBoost; + } + npc.dontTakeDamage = false; + npc.defense = 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; + return; + } + } + else if (npc.ai[0] == 3f) + { + npc.defense = 20; + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + float xVelocity = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles + float yVelocity = 0.12f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles + float yVelocity2 = 0.04f; + 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); + Vector2 shootFromVectorY = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float playerDistanceX = player.position.X + (float)(player.width / 2) - shootFromVectorY.X; + float playerDistanceY = player.position.Y + (float)(player.height / 2) - 300f - shootFromVectorY.Y; + float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); + npc.ai[1] += 1f; + bool shootProjectile = false; + if (npc.GetGlobalNPC(mod).enraged) + { + 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 = 7f; //changed from 10 + if (npc.GetGlobalNPC(mod).enraged) + { + 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 (!Collision.CanHit(new Vector2(shootFromVectorX.X, shootFromVectorX.Y - 30f), 1, 1, player.position, player.width, player.height)) + { + xVelocity = 14f; //changed from 14 not a prob + yVelocity = 0.15f; //changed from 0.1 not a prob + yVelocity2 = 0.05f; + shootFromVectorY = shootFromVectorX; + playerDistanceX = player.position.X + (float)(player.width / 2) - shootFromVectorY.X; + playerDistanceY = player.position.Y + (float)(player.height / 2) - shootFromVectorY.Y; + totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); + totalPlayerDistance = xVelocity / totalPlayerDistance; + if (npc.velocity.X < playerDistanceX) + { + npc.velocity.X = npc.velocity.X + yVelocity; + if (npc.velocity.X < 0f && playerDistanceX > 0f) + { + npc.velocity.X = npc.velocity.X + yVelocity; + } + } + else if (npc.velocity.X > playerDistanceX) + { + npc.velocity.X = npc.velocity.X - yVelocity; + if (npc.velocity.X > 0f && playerDistanceX < 0f) + { + npc.velocity.X = npc.velocity.X - yVelocity; + } + } + if (npc.velocity.Y < playerDistanceY) + { + npc.velocity.Y = npc.velocity.Y + yVelocity2; + if (npc.velocity.Y < 0f && playerDistanceY > 0f) + { + npc.velocity.Y = npc.velocity.Y + yVelocity2; + } + } + else if (npc.velocity.Y > playerDistanceY) + { + npc.velocity.Y = npc.velocity.Y - yVelocity2; + if (npc.velocity.Y > 0f && playerDistanceY < 0f) + { + npc.velocity.Y = npc.velocity.Y - yVelocity2; + } + } + } + else if (totalPlayerDistance > 200f) //100 + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + totalPlayerDistance = xVelocity / totalPlayerDistance; + if (npc.velocity.X < playerDistanceX) + { + npc.velocity.X = npc.velocity.X + yVelocity; + if (npc.velocity.X < 0f && playerDistanceX > 0f) + { + npc.velocity.X = npc.velocity.X + yVelocity * 2f; + } + } + else if (npc.velocity.X > playerDistanceX) + { + npc.velocity.X = npc.velocity.X - yVelocity; + if (npc.velocity.X > 0f && playerDistanceX < 0f) + { + npc.velocity.X = npc.velocity.X - yVelocity * 2f; + } + } + if (npc.velocity.Y < playerDistanceY) + { + npc.velocity.Y = npc.velocity.Y + yVelocity2; + if (npc.velocity.Y < 0f && playerDistanceY > 0f) + { + npc.velocity.Y = npc.velocity.Y + yVelocity2 * 2f; + } + } + else if (npc.velocity.Y > playerDistanceY) + { + npc.velocity.Y = npc.velocity.Y - yVelocity2; + if (npc.velocity.Y > 0f && playerDistanceY < 0f) + { + npc.velocity.Y = npc.velocity.Y - yVelocity2 * 2f; + } + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + 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) + { + 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; + return; + } + } + } + + 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 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 (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); + } + 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 < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + 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(2, 4)); + int choice = Main.rand.Next(3); + if (choice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); + } + else if (choice == 1) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); + } + } + } + + 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); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore5"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore6"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore7"), 1f); + } + } + } } \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck.cs b/NPCs/Bumblefuck/Bumblefuck.cs index 872838c5e3..5dc69f7442 100644 --- a/NPCs/Bumblefuck/Bumblefuck.cs +++ b/NPCs/Bumblefuck/Bumblefuck.cs @@ -1,666 +1,666 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Bumblefuck -{ - [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 = 250; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; - if (CalamityWorld.death) - { - npc.lifeMax = 625000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1310000 : 1140000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); - npc.lavaImmune = true; - npc.noGravity = true; - npc.value = Item.buyPrice(1, 0, 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 ? 10 : 5; - if (CalamityWorld.death) - { - num1305 = 20; - } - npc.noTileCollide = false; - npc.noGravity = true; - npc.damage = npc.defDamage; - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - if (npc.target < 0 || player.dead || !player.active) - { - npc.TargetClosest(true); - if (player.dead) - { - npc.ai[0] = -1f; - } - } - else - { - Vector2 vector205 = player.Center - npc.Center; - if (npc.ai[0] > 1f && vector205.Length() > 3600f) - { - npc.ai[0] = 1f; - } - } - if (npc.ai[0] == -1f) - { - Vector2 value50 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 9f + value50) / 10f; //9 - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < player.Center.X - 2f) - { - npc.direction = 1; - } - if (npc.Center.X > player.Center.X + 2f) - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 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 ? 65 : 80; //260 160 - int num1307 = Main.rand.Next(6); - 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 (num1307 >= 2 && 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.75); - 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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 = mod.ItemType("SupremeHealingPotion"); - } - - 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 < 10; 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("EffulgentFeather"), Main.rand.Next(6, 12)); - int choice = Main.rand.Next(3); - if (choice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RougeSlash")); - } - else if (choice == 1) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GildedProboscis")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GoldenEagle")); - } - } - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Bumblefuck +{ + [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 = 250; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; + if (CalamityWorld.death) + { + npc.lifeMax = 625000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1310000 : 1140000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); + npc.lavaImmune = true; + npc.noGravity = true; + npc.value = Item.buyPrice(1, 0, 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 ? 10 : 5; + if (CalamityWorld.death) + { + num1305 = 20; + } + npc.noTileCollide = false; + npc.noGravity = true; + npc.damage = npc.defDamage; + if (Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + if (npc.target < 0 || player.dead || !player.active) + { + npc.TargetClosest(true); + if (player.dead) + { + npc.ai[0] = -1f; + } + } + else + { + Vector2 vector205 = player.Center - npc.Center; + if (npc.ai[0] > 1f && vector205.Length() > 3600f) + { + npc.ai[0] = 1f; + } + } + if (npc.ai[0] == -1f) + { + Vector2 value50 = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 9f + value50) / 10f; //9 + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (npc.Center.X < player.Center.X - 2f) + { + npc.direction = 1; + } + if (npc.Center.X > player.Center.X + 2f) + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 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 ? 65 : 80; //260 160 + int num1307 = Main.rand.Next(6); + 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 (num1307 >= 2 && 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.75); + 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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 = mod.ItemType("SupremeHealingPotion"); + } + + 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 < 10; 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("EffulgentFeather"), Main.rand.Next(6, 12)); + int choice = Main.rand.Next(3); + if (choice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RougeSlash")); + } + else if (choice == 1) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GildedProboscis")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GoldenEagle")); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck2.cs b/NPCs/Bumblefuck/Bumblefuck2.cs index 75ce286f8a..42075c61f1 100644 --- a/NPCs/Bumblefuck/Bumblefuck2.cs +++ b/NPCs/Bumblefuck/Bumblefuck2.cs @@ -1,343 +1,343 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Bumblefuck -{ - public class 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 = 200; - npc.width = 80; //324 - npc.height = 80; //216 - npc.scale = 0.66f; - npc.defense = 40; - npc.lifeMax = 50000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - 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.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); - } - } - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Bumblefuck +{ + public class 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 = 200; + npc.width = 80; //324 + npc.height = 80; //216 + npc.scale = 0.66f; + npc.defense = 40; + npc.lifeMax = 50000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + 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.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 diff --git a/NPCs/Bumblefuck/Bumblefuck3.cs b/NPCs/Bumblefuck/Bumblefuck3.cs index 00d6dfa9d0..f994985411 100644 --- a/NPCs/Bumblefuck/Bumblefuck3.cs +++ b/NPCs/Bumblefuck/Bumblefuck3.cs @@ -1,454 +1,454 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Bumblefuck -{ - public class Bumblefuck3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 200; - npc.width = 80; //324 - npc.height = 80; //216 - npc.scale = 0.85f; - npc.defense = 40; - npc.lifeMax = 120000; - 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.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - } - - public override void AI() - { - if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge; - Vector2 vector = npc.Center; - npc.noTileCollide = false; - npc.noGravity = true; - npc.damage = npc.defDamage; - float generalSpeedValue = 19f; - float generalSpeedValue2 = 25f; - float generalSpeedValue3 = 9f; - float generalSpeedValue4 = 17f; - float generalSpeedValue5 = 8f; - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - if (npc.target < 0 || player.dead || !player.active) - { - npc.TargetClosest(true); - if (player.dead) - { - npc.ai[0] = -1f; - } - } - else - { - Vector2 vector205 = player.Center - npc.Center; - if (npc.ai[0] > 1f && vector205.Length() > 3600f) - { - npc.ai[0] = 1f; - } - } - if (npc.ai[0] == -1f) - { - Vector2 value50 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * generalSpeedValue + value50) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < player.Center.X - 2f) - { - npc.direction = 1; - } - if (npc.Center.X > player.Center.X + 2f) - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > generalSpeedValue2) - { - npc.velocity.X = generalSpeedValue2; - } - if (npc.velocity.X < -generalSpeedValue2) - { - npc.velocity.X = -generalSpeedValue2; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > generalSpeedValue2) - { - npc.velocity.Y = generalSpeedValue2; - } - if (npc.velocity.Y < -generalSpeedValue2) - { - npc.velocity.Y = -generalSpeedValue2; - } - } - Vector2 value51 = player.Center - npc.Center; - value51.Y -= 200f; - if (value51.Length() > 1600f) //800 - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value51.Length() > 80f) - { - float scaleFactor15 = generalSpeedValue3; //6 - float num1306 = 30f; - value51.Normalize(); - value51 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; - } - else if (npc.velocity.Length() > generalSpeedValue4) //8 - { - npc.velocity *= 0.95f; - } - else if (npc.velocity.Length() < generalSpeedValue5) //4 - { - npc.velocity *= 1.05f; - } - npc.ai[1] += 1f; - if (npc.justHit) - { - npc.ai[1] += (float)Main.rand.Next(10, 30); - } - if (npc.ai[1] >= 180f && Main.netMode != 1) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - while (npc.ai[0] == 0f) - { - int num1307 = Main.rand.Next(3); - if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.ai[0] = 2f; - } - else if (num1307 >= 1) - { - npc.ai[0] = 3f; - } - } - return; - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; - Vector2 value52 = player.Center - npc.Center; - if (value52.Length() < 500f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) //500 - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - float scaleFactor16 = generalSpeedValue3 + value52.Length() / 100f; //7 - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - return; - } - if (npc.ai[0] == 2f) - { - npc.damage = (int)((double)npc.defDamage * 0.85); - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (player.Center.X - 10f < npc.Center.X) - { - npc.direction = -1; - } - else if (player.Center.X + 10f > npc.Center.X) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > generalSpeedValue2) //4 - { - npc.velocity.X = generalSpeedValue2; //4 - } - if (npc.velocity.X < -generalSpeedValue2) //4 - { - npc.velocity.X = -generalSpeedValue2; //4 - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > generalSpeedValue2) //4 - { - npc.velocity.Y = generalSpeedValue2; //4 - } - if (npc.velocity.Y < -generalSpeedValue2) //4 - { - npc.velocity.Y = -generalSpeedValue2; //4 - } - } - Vector2 value53 = player.Center - npc.Center; - value53.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - { - npc.ai[2] += 0.0166666675f; - } - float scaleFactor17 = generalSpeedValue3 + npc.ai[2] + value53.Length() / 120f; //4 - float num1309 = 20f; - value53.Normalize(); - value53 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; - npc.ai[1] += 1f; - if (npc.ai[1] > 240f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - else - { - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - Vector2 value54 = player.Center - npc.Center; - value54.Y -= 12f; - if (npc.Center.X > player.Center.X) - { - value54.X += 400f; - } - else - { - value54.X -= 400f; - } - if (Math.Abs(npc.Center.X - player.Center.X) > 350f && Math.Abs(npc.Center.Y - player.Center.Y) < 20f) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = generalSpeedValue4 + npc.ai[1]; //8 - float num1310 = 4f; - value54.Normalize(); - value54 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; - return; - } - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - Vector2 vector206 = player.Center - npc.Center; - vector206.Y -= 12f; - float scaleFactor19 = generalSpeedValue2; //16 - float num1311 = 8f; - vector206.Normalize(); - vector206 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector206; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - return; - } - } - else - { - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.5); - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (generalSpeedValue4 + npc.ai[2]) * npc.ai[1]; //16 - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + 260f) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - 260f)) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - player.Center.X) > 1200f) //800 - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - return; - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Bumblefuck +{ + public class Bumblefuck3 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 200; + npc.width = 80; //324 + npc.height = 80; //216 + npc.scale = 0.85f; + npc.defense = 40; + npc.lifeMax = 120000; + 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.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath46; + } + + public override void AI() + { + if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) + { + npc.active = false; + npc.netUpdate = true; + return; + } + Player player = Main.player[npc.target]; + bool revenge = CalamityWorld.revenge; + Vector2 vector = npc.Center; + npc.noTileCollide = false; + npc.noGravity = true; + npc.damage = npc.defDamage; + float generalSpeedValue = 19f; + float generalSpeedValue2 = 25f; + float generalSpeedValue3 = 9f; + float generalSpeedValue4 = 17f; + float generalSpeedValue5 = 8f; + if (Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + if (npc.target < 0 || player.dead || !player.active) + { + npc.TargetClosest(true); + if (player.dead) + { + npc.ai[0] = -1f; + } + } + else + { + Vector2 vector205 = player.Center - npc.Center; + if (npc.ai[0] > 1f && vector205.Length() > 3600f) + { + npc.ai[0] = 1f; + } + } + if (npc.ai[0] == -1f) + { + Vector2 value50 = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * generalSpeedValue + value50) / 10f; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (npc.Center.X < player.Center.X - 2f) + { + npc.direction = 1; + } + if (npc.Center.X > player.Center.X + 2f) + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > generalSpeedValue2) + { + npc.velocity.X = generalSpeedValue2; + } + if (npc.velocity.X < -generalSpeedValue2) + { + npc.velocity.X = -generalSpeedValue2; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > generalSpeedValue2) + { + npc.velocity.Y = generalSpeedValue2; + } + if (npc.velocity.Y < -generalSpeedValue2) + { + npc.velocity.Y = -generalSpeedValue2; + } + } + Vector2 value51 = player.Center - npc.Center; + value51.Y -= 200f; + if (value51.Length() > 1600f) //800 + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value51.Length() > 80f) + { + float scaleFactor15 = generalSpeedValue3; //6 + float num1306 = 30f; + value51.Normalize(); + value51 *= scaleFactor15; + npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; + } + else if (npc.velocity.Length() > generalSpeedValue4) //8 + { + npc.velocity *= 0.95f; + } + else if (npc.velocity.Length() < generalSpeedValue5) //4 + { + npc.velocity *= 1.05f; + } + npc.ai[1] += 1f; + if (npc.justHit) + { + npc.ai[1] += (float)Main.rand.Next(10, 30); + } + if (npc.ai[1] >= 180f && Main.netMode != 1) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + while (npc.ai[0] == 0f) + { + int num1307 = Main.rand.Next(3); + if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + { + npc.ai[0] = 2f; + } + else if (num1307 >= 1) + { + npc.ai[0] = 3f; + } + } + return; + } + } + else + { + if (npc.ai[0] == 1f) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + if (npc.target < 0 || !player.active || player.dead) + { + npc.TargetClosest(true); + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; + Vector2 value52 = player.Center - npc.Center; + if (value52.Length() < 500f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) //500 + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + float scaleFactor16 = generalSpeedValue3 + value52.Length() / 100f; //7 + float num1308 = 25f; + value52.Normalize(); + value52 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + return; + } + if (npc.ai[0] == 2f) + { + npc.damage = (int)((double)npc.defDamage * 0.85); + if (npc.target < 0 || !player.active || player.dead) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (player.Center.X - 10f < npc.Center.X) + { + npc.direction = -1; + } + else if (player.Center.X + 10f > npc.Center.X) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > generalSpeedValue2) //4 + { + npc.velocity.X = generalSpeedValue2; //4 + } + if (npc.velocity.X < -generalSpeedValue2) //4 + { + npc.velocity.X = -generalSpeedValue2; //4 + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > generalSpeedValue2) //4 + { + npc.velocity.Y = generalSpeedValue2; //4 + } + if (npc.velocity.Y < -generalSpeedValue2) //4 + { + npc.velocity.Y = -generalSpeedValue2; //4 + } + } + Vector2 value53 = player.Center - npc.Center; + value53.Y -= 20f; + npc.ai[2] += 0.0222222228f; + if (Main.expertMode) + { + npc.ai[2] += 0.0166666675f; + } + float scaleFactor17 = generalSpeedValue3 + npc.ai[2] + value53.Length() / 120f; //4 + float num1309 = 20f; + value53.Normalize(); + value53 *= scaleFactor17; + npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; + npc.ai[1] += 1f; + if (npc.ai[1] > 240f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + } + else + { + if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + Vector2 value54 = player.Center - npc.Center; + value54.Y -= 12f; + if (npc.Center.X > player.Center.X) + { + value54.X += 400f; + } + else + { + value54.X -= 400f; + } + if (Math.Abs(npc.Center.X - player.Center.X) > 350f && Math.Abs(npc.Center.Y - player.Center.Y) < 20f) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + } + npc.ai[1] += 0.0333333351f; + float scaleFactor18 = generalSpeedValue4 + npc.ai[1]; //8 + float num1310 = 4f; + value54.Normalize(); + value54 *= scaleFactor18; + npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; + return; + } + if (npc.ai[0] == 3.1f) + { + npc.noTileCollide = true; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + Vector2 vector206 = player.Center - npc.Center; + vector206.Y -= 12f; + float scaleFactor19 = generalSpeedValue2; //16 + float num1311 = 8f; + vector206.Normalize(); + vector206 *= scaleFactor19; + npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.velocity = vector206; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.ai[0] = 3.2f; + npc.ai[1] = 0f; + npc.ai[1] = (float)npc.direction; + return; + } + } + else + { + if (npc.ai[0] == 3.2f) + { + npc.damage = (int)((double)npc.defDamage * 1.5); + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + npc.ai[2] += 0.0333333351f; + npc.velocity.X = (generalSpeedValue4 + npc.ai[2]) * npc.ai[1]; //16 + if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + 260f) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - 260f)) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (Math.Abs(npc.Center.X - player.Center.X) > 1200f) //800 + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; + return; + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (double)(npc.velocity.Length() / 4f); + npc.frameCounter += 1.0; + if (npc.ai[0] < 4f) + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 4) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y / frameHeight > 9) + { + npc.frame.Y = frameHeight * 5; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/CalScreenShaderData.cs b/NPCs/Calamitas/CalScreenShaderData.cs index 1ef421e0d0..42a1eb8c9c 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(); - } - } +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 diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/Calamitas/CalSky.cs index 96ecbad42b..dea19b389d 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; - } - } +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 diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 7b9845ca27..4444566c4b 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -1,431 +1,431 @@ -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; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class Calamitas : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 14f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 15; - animationType = 125; - npc.value = 0f; - npc.lifeMax = CalamityWorld.revenge ? 13500 : 10000; - if (CalamityWorld.death) - { - npc.lifeMax = 20500; - } - 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.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 = 80000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2200000 : 1800000; - } - } - - public override void AI() - { - 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 ? 10f : 8.5f; - float num824 = expertMode ? 0.2f : 0.175f; - 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] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 2f; - } - 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); - return; - } - } - } - 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.3f : 0.225f; - 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] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1.5f; - } - if (Main.expertMode || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1.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; - return; - } - } - } - - 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 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 bool CheckDead() - { - if (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); - 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.CalamitasBossText"; - string key2 = "Mods.CalamityMod.CalamitasBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor); - } - 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 OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 200, true); - } - } +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; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class Calamitas : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 14f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 15; + animationType = 125; + npc.value = 0f; + npc.lifeMax = CalamityWorld.revenge ? 15000 : 10000; + if (CalamityWorld.death) + { + npc.lifeMax = 22500; + } + 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.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 = 80000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2400000 : 2000000; + } + } + + public override void AI() + { + 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 ? 10f : 8.5f; + float num824 = expertMode ? 0.2f : 0.175f; + 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] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 2f; + } + 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); + return; + } + } + } + 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.3f : 0.225f; + 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] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1.5f; + } + if (Main.expertMode || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1.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; + return; + } + } + } + + 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 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 bool CheckDead() + { + if (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); + 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.CalamitasBossText"; + string key2 = "Mods.CalamityMod.CalamitasBossText2"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor); + } + 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 OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 200, true); + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 6d40d55290..1bab19994c 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -1,446 +1,446 @@ -using System; -using System.Collections.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.Calamitas -{ - [AutoloadBossHead] - public class CalamitasRun : ModNPC - { - public bool canDespawn = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 10; - animationType = 126; - npc.alpha = 50; - npc.lifeMax = CalamityWorld.revenge ? 4050 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 4500; - } - 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.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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 170; - npc.defense = 80; - npc.lifeMax = 35000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - } - - public override void AI() - { - 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 = 4f; - 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 ? 2f : 1f); - if (npc.ai[2] >= 400f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - 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] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] > 8f) - { - 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); - return; - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - npc.rotation = num842; - float num870 = 15f; - if (expertMode) - { - num870 += 2.5f; - } - if (revenge) - { - num870 += 1f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - 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] >= 50f) - { - 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] >= 80f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 5f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - return; - } - } - } - } - - 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 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 && 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(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); - } - if (Main.expertMode && 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(4) == 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) - { - 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"), 300); - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 180, 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.Projectiles; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class CalamitasRun : ModNPC + { + public bool canDespawn = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 10; + animationType = 126; + npc.alpha = 50; + npc.lifeMax = CalamityWorld.revenge ? 4400 : 3000; + if (CalamityWorld.death) + { + npc.lifeMax = 5000; + } + 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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 170; + npc.defense = 80; + npc.lifeMax = 35000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1700000 : 1400000; + } + } + + public override void AI() + { + 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 = 4f; + 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 ? 2f : 1f); + if (npc.ai[2] >= 400f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + 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] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] > 8f) + { + 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); + return; + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.rotation = num842; + float num870 = 15f; + if (expertMode) + { + num870 += 2.5f; + } + if (revenge) + { + num870 += 1f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + 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] >= 50f) + { + 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] >= 80f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 5f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + return; + } + } + } + } + + 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 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 && 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(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); + } + if (Main.expertMode && 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(4) == 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) + { + 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"), 300); + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 180, true); + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 9806223fdc..236292301e 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -1,454 +1,454 @@ -using System; -using System.Collections.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.Calamitas -{ - [AutoloadBossHead] - public class CalamitasRun2 : ModNPC - { - public bool canDespawn = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 10; - animationType = 126; - npc.alpha = 50; - npc.lifeMax = CalamityWorld.revenge ? 3375 : 2500; - if (CalamityWorld.death) - { - npc.lifeMax = 4000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 95; - npc.lifeMax = 30000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1200000 : 900000; - } - } - - public override void AI() - { - 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.25f; - float num862 = 0.125f; - 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 ? 2f : 1f); - if (npc.ai[2] >= 200f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - 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] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float num867 = 6f; - 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); - return; - } - } - } - } - 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 += 1f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - 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.35f; - } - if (npc.life <= (npc.lifeMax * 0.75f) || CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.1f; - } - if (npc.life <= (npc.lifeMax * 0.5f) || CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.15f; - } - if (npc.life <= (npc.lifeMax * 0.25f) || CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.2f; - } - if (npc.life <= (npc.lifeMax * 0.1f) || CalamityWorld.bossRushActive) - { - npc.ai[2] += 0.5f; - } - if (npc.ai[2] >= 50f) - { - 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] >= 80f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 6f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - return; - } - } - } - } - - 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 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 && 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(4) == 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) - { - 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"), 300); - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 180, 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.Projectiles; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class CalamitasRun2 : ModNPC + { + public bool canDespawn = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 10; + animationType = 126; + npc.alpha = 50; + npc.lifeMax = CalamityWorld.revenge ? 3675 : 2500; + if (CalamityWorld.death) + { + npc.lifeMax = 4400; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 95; + npc.lifeMax = 30000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1400000 : 1100000; + } + } + + public override void AI() + { + 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.25f; + float num862 = 0.125f; + 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 ? 2f : 1f); + if (npc.ai[2] >= 200f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + 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] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] > 50f) + { + npc.localAI[1] = 0f; + float num867 = 6f; + 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); + return; + } + } + } + } + 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 += 1f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + 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.35f; + } + if (npc.life <= (npc.lifeMax * 0.75f) || CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.1f; + } + if (npc.life <= (npc.lifeMax * 0.5f) || CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.15f; + } + if (npc.life <= (npc.lifeMax * 0.25f) || CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.2f; + } + if (npc.life <= (npc.lifeMax * 0.1f) || CalamityWorld.bossRushActive) + { + npc.ai[2] += 0.5f; + } + if (npc.ai[2] >= 50f) + { + 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] >= 80f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 6f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + return; + } + } + } + } + + 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 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 && 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(4) == 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) + { + 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"), 300); + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 180, true); + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index dabfeaa9f6..72d39704fd 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -1,588 +1,588 @@ -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; - -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] = 3; - } - - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; - npc.defense = 25; - animationType = 125; - npc.lifeMax = CalamityWorld.revenge ? 33750 : 27500; - if (CalamityWorld.death) - { - npc.lifeMax = 56250; - } - npc.aiStyle = -1; //new - aiType = -1; //new - 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("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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - bossBag = mod.ItemType("CalamitasBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 160; - npc.defense = 150; - npc.lifeMax = 120000; - npc.value = Item.buyPrice(1, 15, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 6000000 : 5200000; - } - } - - public override void AI() - { - 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.45); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - if (!expertMode) - { - int num661 = Main.rand.Next(8, 13); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("LifeSeeker"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - } - else - { - if (revenge) - { - int num661 = Main.rand.Next(5, 9); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("LifeSeeker"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - } - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - if (CalamityWorld.death) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - string key = "Mods.CalamityMod.CalamitasBossText4"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - return; - } - } - } - bool flag100 = false; - int num568 = 0; - if (expertMode) - { - if (NPC.AnyNPCs(mod.NPCType("CalamitasRun")) || NPC.AnyNPCs(mod.NPCType("CalamitasRun2"))) - { - flag100 = true; - num568 += 255; - } - npc.defense += num568 * 50; - if (!flag100) - { - npc.defense = 30; - } - } - 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 ? 12f : 10.5f; - float num824 = expertMode ? 0.25f : 0.225f; - 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 (revenge) - { - npc.localAI[1] += 0.5f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - 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 ? 14f : 12.5f; - if (npc.GetGlobalNPC(mod).enraged) - { - 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); - return; - } - } - } - else - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = expertMode ? 13f : 11f; - float num833 = expertMode ? 0.35f : 0.3f; - 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 (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - npc.localAI[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (expertMode) - { - npc.localAI[1] += 1.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; - return; - } - } - } - - 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 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 < 10; 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(3, 6)); - 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 = "A Calamitas Doppelganger"; - 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) - { - 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"), 300, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } +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; + +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] = 3; + } + + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 14f; + npc.width = 120; + npc.height = 120; + npc.defense = 25; + animationType = 125; + npc.lifeMax = CalamityWorld.revenge ? 36750 : 27500; + if (CalamityWorld.death) + { + npc.lifeMax = 60250; + } + npc.aiStyle = -1; //new + aiType = -1; //new + 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("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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + bossBag = mod.ItemType("CalamitasBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 160; + npc.defense = 150; + npc.lifeMax = 120000; + npc.value = Item.buyPrice(1, 15, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 6200000 : 5500000; + } + } + + public override void AI() + { + 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.45); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + if (!expertMode) + { + int num661 = Main.rand.Next(8, 13); + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("LifeSeeker"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + } + } + else + { + if (revenge) + { + int num661 = Main.rand.Next(5, 9); + for (int num662 = 0; num662 < num661; num662++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num663 = mod.NPCType("LifeSeeker"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num664].SetDefaults(num663, -1f); + Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + } + } + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + } + string key = "Mods.CalamityMod.CalamitasBossText4"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + return; + } + } + } + bool flag100 = false; + int num568 = 0; + if (expertMode) + { + if (NPC.AnyNPCs(mod.NPCType("CalamitasRun")) || NPC.AnyNPCs(mod.NPCType("CalamitasRun2"))) + { + flag100 = true; + num568 += 255; + } + npc.defense += num568 * 50; + if (!flag100) + { + npc.defense = 30; + } + } + 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 ? 12f : 10.5f; + float num824 = expertMode ? 0.25f : 0.225f; + 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 (revenge) + { + npc.localAI[1] += 0.5f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + 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 ? 14f : 12.5f; + if (npc.GetGlobalNPC(mod).enraged) + { + 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); + return; + } + } + } + else + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = expertMode ? 13f : 11f; + float num833 = expertMode ? 0.35f : 0.3f; + 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 (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + npc.localAI[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (expertMode) + { + npc.localAI[1] += 1.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; + return; + } + } + } + + 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 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 < 10; 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(3, 6)); + 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 = "A Calamitas Doppelganger"; + 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) + { + 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"), 300, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index 554bf17b92..56da35c19a 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.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.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -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.npcSlots = 1f; - 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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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) - { - if (Main.expertMode) - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 80, true); - } - else - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 60, 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); - } - } - } - } +using System; +using System.Collections.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.Calamitas +{ + public class LifeSeeker : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Life Seeker"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + 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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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) + { + if (Main.expertMode) + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 80, true); + } + else + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 60, 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 53a9c55f43..b7e30e083a 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -1,153 +1,153 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Calamitas -{ - public class SoulSeeker : ModNPC - { - public int timer = 0; - public 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.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.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) - { - 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 (NPC.CountNPCS(mod.NPCType("CalamitasRun3")) < 1) - { - 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) - { - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Calamitas +{ + public class SoulSeeker : ModNPC + { + public int timer = 0; + public 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.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.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) + { + 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 (NPC.CountNPCS(mod.NPCType("CalamitasRun3")) < 1) + { + 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) + { + 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 diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs index a139af9df2..d4ac3cff1e 100644 --- a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs +++ b/NPCs/CalamityBiomeNPCs/CultistAssassin.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; - -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.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, 2, 0, 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, 10, 0, 0); - } - } - - 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"), 300, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 3)); - } - } - } +using System; +using System.Collections.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.CalamityBiomeNPCs +{ + public class CultistAssassin : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cultist Assassin"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + 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, 2, 0, 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, 10, 0, 0); + } + } + + 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"), 300, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 3)); + } + } + } } \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index bd2e973723..bf1eaa44bd 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -1,372 +1,372 @@ -using System; -using System.Collections.Generic; -using 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.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, 50, 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, 3, 0, 0); - } - } - - 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"), 300, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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); - } - } - } - } +using System; +using System.Collections.Generic; +using 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.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, 50, 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, 3, 0, 0); + } + } + + 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"), 300, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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 diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.cs b/NPCs/CalamityBiomeNPCs/Scryllar.cs index 78e4ab0b96..16279af1e2 100644 --- a/NPCs/CalamityBiomeNPCs/Scryllar.cs +++ b/NPCs/CalamityBiomeNPCs/Scryllar.cs @@ -1,290 +1,290 @@ -using System; -using System.Collections.Generic; -using 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.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, 50, 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, 3, 0, 0); - } - } - - 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"), 300, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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); - } - } - } - } +using System; +using System.Collections.Generic; +using 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.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, 50, 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, 3, 0, 0); + } + } + + 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"), 300, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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 diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs index 927717d277..2447bf6538 100644 --- a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs +++ b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs @@ -1,290 +1,290 @@ -using System; -using System.Collections.Generic; -using 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.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, 50, 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, 3, 0, 0); - } - } - - 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"), 300, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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); - } - } - } - } +using System; +using System.Collections.Generic; +using 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.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, 50, 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, 3, 0, 0); + } + } + + 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"), 300, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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 diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs index d09b357872..3c97cab738 100644 --- a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.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; - -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, 50, 0); - npc.noGravity = true; - npc.noTileCollide = 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, 3, 0, 0); - } - } - - 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"), 300, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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 = 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; - } - } - } - } +using System; +using System.Collections.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.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, 50, 0); + npc.noGravity = true; + npc.noTileCollide = 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, 3, 0, 0); + } + } + + 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"), 300, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), 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, 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 = 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 diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d0986c5e05..440191742a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1,12441 +1,12419 @@ -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; - -namespace CalamityMod.NPCs -{ - public class CalamityGlobalNPC : GlobalNPC - { - #region InstancePerEntity - public override bool InstancePerEntity - { - get - { - return true; - } - } - #endregion - - #region InstanceVars - public static int DraedonMayhem = 0; - - public static int DoGSecondStageCountdown = 0; - - public float protection = 0f; - - public float defProtection = 0f; - - public bool weaknessCold = false; - - public bool weaknessFire = false; - - public bool weaknessPoison = false; - - public bool weaknessStab = false; - - public bool weaknessSlash = false; - - public bool weaknessMagic = false; - - public bool weaknessDark = false; - - public bool weaknessWater = false; - - public bool weaknessHoly = false; - - public bool weaknessUnholy = 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 static int maxAIMod = 4; - - public float[] newAI = new float[maxAIMod]; - - public int CultProjectiles = 2; - - public const float CultAngleSpread = 170; - - public int CultCountdown = 0; - - public static int holyBoss = -1; - - public static int doughnutBoss = -1; - - public static int voidBoss = -1; - - public static int energyFlame = -1; - - public static int hiveMind = -1; - - public static int hiveMind2 = -1; - - public static int scavenger = -1; - - public static int bobbitWormBottom = -1; - - public static int DoGHead = -1; - - public static int ghostBoss = -1; - - public static int ghostBoss2 = -1; - - public static int laserEye = -1; - - public static int fireEye = -1; - - public static int lordeBoss = -1; - - public static int brimstoneElemental = -1; - - public static double golemDamageBonus = 1.0; - - public int bloodMoonKillCount = 0; - #endregion - - #region ResetEffects - public override void ResetEffects(NPC npc) - { - 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; - } - #endregion - - #region LifeRegen - public override void UpdateLifeRegen(NPC npc, ref int damage) - { - bool hardMode = Main.hardMode; - int npcDefense = npc.defense; - if (Main.raining && NPC.downedMoonlord && npc.damage > 0 && !npc.boss && !CalamityWorld.bossRushActive && - !npc.friendly && !npc.dontTakeDamage && (double)(npc.position.Y / 16f) < Main.worldSurface) - { - npc.AddBuff(mod.BuffType("Irradiated"), 2); - } - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmSteps = y / 4; - int abyssChasmY = (y - abyssChasmSteps) + 100; - 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 (npc.venom) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - int num7 = 0; - int num8 = 5; - 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) - { - num7 = 1; - } - npc.lifeRegen -= num7 * 50; - if (damage < num7 * 50 / num8) - { - damage = num7 * 50 / num8; - } - } - 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; - } - } - } - #endregion - - #region SetDefaults - public override void SetDefaults(NPC npc) - { - for (int m = 0; m < maxAIMod; m++) - { - this.newAI[m] = 0f; - } - /*if (CalamityWorld.revenge) - { - List coldWeaknessList = new List(73) - { - NPCID.MeteorHead, - NPCID.FireImp, - NPCID.ManEater, - NPCID.JungleBat, - NPCID.Snatcher, - NPCID.Piranha, - NPCID.LavaSlime, - NPCID.Hellbat, - NPCID.Vulture, - NPCID.Demon, - NPCID.EyeofCthulhu, - NPCID.Hornet, - NPCID.VoodooDemon, - NPCID.Antlion, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.LavaBat, - NPCID.GiantFlyingFox, - NPCID.GiantTortoise, - NPCID.RedDevil, - NPCID.Arapaima, - NPCID.AngryTrapper, - NPCID.MossHornet, - NPCID.Derpling, - NPCID.Nymph, - NPCID.Lihzahrd, - NPCID.LihzahrdCrawler, - NPCID.Moth, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.QueenBee, - NPCID.FlyingFish, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy, - NPCID.JungleCreeper, - NPCID.JungleCreeperWall, - NPCID.FungoFish, - NPCID.AnomuraFungus, - NPCID.MushiLadybug, - NPCID.FungiBulb, - NPCID.GiantFungiBulb, - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSword, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Splinterling, - NPCID.SolarCrawltipedeTail, - NPCID.SolarDrakomire, - NPCID.SolarDrakomireRider, - NPCID.SolarSroller, - NPCID.SolarCorite, - NPCID.SolarSolenian, - NPCID.WalkingAntlion, - NPCID.FlyingAntlion, - NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.TombCrawlerHead, - NPCID.TombCrawlerBody, - NPCID.TombCrawlerTail, - NPCID.DesertGhoul, - NPCID.SandElemental, - NPCID.SandShark, - NPCID.Tumbleweed - }; - bool shouldAffect = coldWeaknessList.Contains(npc.type); - if (shouldAffect) - { - this.weaknessCold = true; - } - }*/ - 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; - } - } - } - } - List enemyImmunityList = new List(39) - { - NPCID.QueenBee, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCID.SkeletronPrime, - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCID.PrimeLaser, - NPCID.Plantera, - NPCID.Pumpking, - NPCID.IceQueen, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - NPCID.DukeFishron, - NPCID.CultistBoss, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye - }; - if (enemyImmunityList.Contains(npc.type) || CalamityWorld.bossRushActive) - { - 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) - { - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - if (Main.hardMode && !CalamityWorld.spawnedHardBoss && !npc.boss && !npc.friendly && !npc.dontTakeDamage && !npc.buffImmune[mod.BuffType("CrushDepth")]) - { - List hardModeNerfExceptionList = new List(14) - { - 135, - 136, - 115, - 116, - 114, - 267, - 13, - 14, - 15, - 36, - mod.NPCType("SlimeSpawnCorrupt"), - mod.NPCType("SlimeSpawnCorrupt2"), - mod.NPCType("SlimeSpawnCrimson"), - mod.NPCType("SlimeSpawnCrimson2") - }; - if (!hardModeNerfExceptionList.Contains(npc.type)) - { - double multiplier = Main.expertMode ? 0.6 : 0.8; - npc.lifeMax = (int)((double)npc.lifeMax * multiplier); - npc.damage = (int)((double)npc.damage * multiplier); - } - } - if (CalamityWorld.defiled) - { - npc.value = (float)((int)((double)npc.value * 2)); - } - if (CalamityWorld.bossRushActive) - { - switch (npc.type) - { - case NPCID.QueenBee: //Tier 1 - npc.lifeMax = 400000; - 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 = 720000; - break; - case NPCID.PrimeCannon: - npc.lifeMax = 280000; - break; - case NPCID.PrimeVice: - npc.lifeMax = 360000; - break; - case NPCID.PrimeSaw: - npc.lifeMax = 400000; - break; - case NPCID.PrimeLaser: - npc.lifeMax = 240000; - break; - case NPCID.Golem: - npc.lifeMax = 720000; - break; - case NPCID.GolemHead: - npc.lifeMax = 360000; - break; - case NPCID.GolemFistLeft: - npc.lifeMax = 280000; - break; - case NPCID.GolemFistRight: - npc.lifeMax = 280000; - 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 = 3400000; - break; - case NPCID.TheDestroyerBody: - npc.lifeMax = 3400000; - break; - case NPCID.TheDestroyerTail: - npc.lifeMax = 3400000; - break; - case NPCID.Probe: - npc.lifeMax = 70000; - break; - case NPCID.Spazmatism: - npc.lifeMax = 1080000; - break; - case NPCID.Retinazer: - npc.lifeMax = 848000; - break; - case NPCID.WallofFlesh: - npc.lifeMax = 2600000; - break; - case NPCID.WallofFleshEye: - npc.lifeMax = 2600000; - break; - case NPCID.SkeletronHead: - npc.lifeMax = 1500000; - break; - case NPCID.SkeletronHand: - npc.lifeMax = 800000; - break; - case NPCID.CultistBoss: //Tier 3 - npc.lifeMax = 1800000; - break; - case NPCID.CultistDragonHead: - npc.lifeMax = 500000; - break; - case NPCID.CultistDragonBody1: - npc.lifeMax = 500000; - break; - case NPCID.CultistDragonBody2: - npc.lifeMax = 500000; - break; - case NPCID.CultistDragonBody3: - npc.lifeMax = 500000; - break; - case NPCID.CultistDragonBody4: - npc.lifeMax = 500000; - break; - case NPCID.CultistDragonTail: - npc.lifeMax = 500000; - break; - case NPCID.AncientCultistSquidhead: - npc.lifeMax = 300000; - break; - case NPCID.Plantera: - npc.lifeMax = 4200000; - break; - case NPCID.PlanterasTentacle: - npc.lifeMax = 150000; - break; - case NPCID.DukeFishron: //Tier 4 - npc.lifeMax = 4400000; - break; - case NPCID.MoonLordCore: - npc.lifeMax = 2500000; - break; - case NPCID.MoonLordHand: - npc.lifeMax = 875000; - break; - case NPCID.MoonLordHead: - npc.lifeMax = 1250000; - break; - case NPCID.MoonLordFreeEye: - npc.lifeMax = 1250; - 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 (DraedonMayhem == 1) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - npc.scale *= 1.25f; - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - npc.scale *= 1.2f; - } - npc.npcSlots = 10f; - } - if (npc.type == NPCID.Probe) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - npc.scale *= 1.25f; - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - npc.scale *= 1.2f; - } - } - 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) - { - if (npc.type == NPCID.PrimeLaser) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.8); - } - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - } - } - 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; - } - 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 * 5)); - if (npc.type == NPCID.MoonLordFreeEye) - { - npc.lifeMax = (int)((double)npc.lifeMax * 150.0); - } - if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - npc.scale = 1.25f; - } - if (npc.type == NPCID.MoonLordCore) //final boss in hardmode, gets a big boost in stats - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.4); //140% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); //90% boost - } - npc.npcSlots = 12f; - } - if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.75); //75% boost - } - npc.npcSlots = 12f; - } - 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); - } - } - if (npc.type == NPCID.DukeFishron) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 3.525); //252.5% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.85); //85% boost - } - npc.npcSlots = 20f; - } - if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) - { - npc.lifeMax = (int)((double)npc.lifeMax * 30.0); - } - if (npc.type == NPCID.Golem) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 8.0); //700% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 3.0); //200% boost - } - npc.npcSlots = 64f; - } - if (npc.type == NPCID.Plantera) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.681); //168.1% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.65); //65% boost - } - npc.npcSlots = 32f; - } - if (npc.type == NPCID.PlanterasTentacle) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - npc.damage = (int)((double)npc.damage * 1.25); - } - if (DraedonMayhem == 0) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); //50% boost - npc.scale *= 1.2f; - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.15); //15% boost - } - npc.npcSlots = 10f; - } - if (npc.type == NPCID.Probe) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - npc.damage = (int)((double)npc.damage * 1.5); - npc.scale *= 1.2f; - } - } - 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) - { - if (npc.type == NPCID.PrimeLaser) - { - npc.lifeMax = (int)((double)npc.lifeMax * 0.1); - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.05); //105% boost - } - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost - } - } - if (npc.type == NPCID.Retinazer) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); //60% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.35); //35% boost - } - npc.npcSlots = 10f; - } - if (npc.type == NPCID.Spazmatism) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.7); //70% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.45); //45% boost - } - npc.npcSlots = 10f; - } - } - if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) //final boss prehm, gets a big boost in stats - { - if (npc.type == NPCID.WallofFlesh) - { - npc.npcSlots = 20f; - } - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.2); //120% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.65); //65% boost - } - } - if (npc.type == NPCID.TheHungryII) - { - if (CalamityWorld.death) - { - npc.noTileCollide = true; - npc.lifeMax = (int)((double)npc.lifeMax * 4.5); - npc.damage = (int)((double)npc.damage * 2.5); - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - npc.damage = (int)((double)npc.damage * 1.35); - } - } - if (npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 4.5); - npc.damage = (int)((double)npc.damage * 2.5); - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 3.1); - npc.damage = (int)((double)npc.damage * 1.25); - } - } - if (npc.type == NPCID.SkeletronHead) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); //30% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.15); //15% boost - } - npc.npcSlots = 12f; - } - if (npc.type == NPCID.SkeletronHand) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); //30% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.2); //20% boost - } - } - if (npc.type == NPCID.QueenBee) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.55); //55% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.05); //5% boost - } - npc.npcSlots = 14f; - } - if (npc.type == NPCID.BrainofCthulhu) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); //90% boost - npc.damage = (int)((double)npc.damage * 1.25); - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost - } - npc.npcSlots = 12f; - } - if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.type == NPCID.EaterofWorldsHead) - { - npc.npcSlots = 10f; - npc.damage = (int)((double)npc.damage * 1.85); - if (CalamityWorld.death) - { - npc.reflectingProjectiles = true; - } - } - else - { - npc.damage = (int)((double)npc.damage * 1.5); - } - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); //30% boost - } - } - if (npc.type == NPCID.EyeofCthulhu) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.3); //130% boost - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); //25% boost - } - npc.npcSlots = 10f; - } - if (npc.type == NPCID.KingSlime) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.85); //85% boost - } - } - 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")) - { - this.protection = 0.1f; - } - else if (npc.type == mod.NPCType("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") || npc.type == mod.NPCType("Cryon") || - npc.type == mod.NPCType("Cryogen")) - { - this.protection = 0.15f; - } - else if (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")) - { - this.protection = 0.2f; - } - else if (npc.type == mod.NPCType("AstrumDeusBody") || npc.type == mod.NPCType("SoulSeeker") || npc.type == mod.NPCType("DesertScourgeTail") || - npc.type == mod.NPCType("Horse") || npc.type == mod.NPCType("ProfanedEnergyBody") || npc.type == mod.NPCType("ScavengerClawLeft") || - npc.type == mod.NPCType("ScavengerClawRight") || npc.type == mod.NPCType("ScavengerHead") || npc.type == mod.NPCType("MantisShrimp") || - npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("Astrageldon")) - { - this.protection = 0.25f; - } - 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")) - { - this.protection = 0.3f; - } - else if (npc.type == mod.NPCType("AstrumDeusProbe3")) - { - this.protection = 0.35f; - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath") || npc.type == mod.NPCType("PlaguebringerShade") || - 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")) - { - this.protection = 0.4f; - } - else if (npc.type == mod.NPCType("ProvSpawnOffense")) - { - this.protection = 0.45f; - } - 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")) - { - this.protection = 0.5f; - } - else if (npc.type == mod.NPCType("CryogenIce") || npc.type == mod.NPCType("ProfanedGuardianBoss") || npc.type == mod.NPCType("ProvSpawnDefense") || - npc.type == mod.NPCType("ScavengerBody")) - { - this.protection = 0.6f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerTail")) - { - this.protection = 0.7f; - } - else if (npc.type == mod.NPCType("SirenIce")) - { - this.protection = 0.75f; - } - 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: - this.protection = 0.1f; 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: - this.protection = 0.15f; break; - case NPCID.ElfCopter: - case NPCID.GraniteGolem: - case NPCID.ArmoredSkeleton: - case NPCID.PirateShipCannon: - case NPCID.DD2OgreT3: - case NPCID.Golem: - this.protection = 0.2f; 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: - this.protection = 0.25f; break; - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - case NPCID.SkeletronPrime: - case NPCID.Probe: - case NPCID.PossessedArmor: - this.protection = 0.3f; break; - case NPCID.Mimic: - case NPCID.PresentMimic: - case 473: - case 474: - case 475: - case 476: - this.protection = 0.35f; break; - case NPCID.GiantTortoise: - case NPCID.IceTortoise: - case NPCID.SantaNK1: - case NPCID.MartianWalker: - this.protection = 0.4f; break; - case NPCID.TheDestroyerTail: - this.protection = 0.6f; break; - case NPCID.DeadlySphere: - this.protection = 0.65f; break; - case NPCID.Paladin: - this.protection = 0.7f; break; - case NPCID.WallofFlesh: - case NPCID.MothronEgg: - this.protection = 0.75f; break; - case NPCID.DungeonGuardian: - this.protection = 0.9999f; break; - } - } - } - if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || - npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge")) - { - this.protection = 0.999999f; - } - if (this.protection > 0f) - { - if (CalamityWorld.defiled) - { - this.protection += (1f - this.protection) * 0.5f; - } - this.defProtection = this.protection; - } - if (Main.raining && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.15); - npc.damage = (int)((double)npc.damage * 1.25); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) - { - npc.lifeMax = (int)((double)npc.lifeMax * 3.5); - npc.damage = (int)((double)npc.damage * 2.0); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - if (Main.pumpkinMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - npc.lifeMax = (int)((double)npc.lifeMax * 7.5); - npc.damage = (int)((double)npc.damage * 2.0); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - else if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - npc.lifeMax = (int)((double)npc.lifeMax * 6.0); - npc.damage = (int)((double)npc.damage * 2.0); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - else if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - npc.lifeMax = (int)((double)npc.lifeMax * 32.5); - npc.damage = (int)((double)npc.damage * 2.0); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - if (NPC.downedMoonlord) - { - List dungeonEnemyBuffList = new List(24) - { - 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 - }; - bool shouldAffect = dungeonEnemyBuffList.Contains(npc.type); - if (shouldAffect) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - npc.damage = (int)((double)npc.damage * 2.5); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - } - } - #endregion - - #region ScaleExpertMultiplayerStats - public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) - { - if (Main.netMode != 0) - { - if (numPlayers > 1) - { - List bossScaleList = new List(19) - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCID.PrimeLaser, - NPCID.PlanterasTentacle, - NPCID.Pumpking, - NPCID.IceQueen, - NPCID.Mothron, - NPCID.GolemHead - }; - bool shouldScale = bossScaleList.Contains(npc.type); - if (((npc.boss || shouldScale) && npc.type < NPCID.Count) || (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) - { - bossLifeScale = 1f; //set expert scale to 1 instead of 2 - float playerCount = (float)numPlayers; - if (playerCount > 20f) //max player count - { - playerCount = 20f; - } - float scalar = 0.4f + ((2f * playerCount) / 20f); //lower scaling because fuck u - int setToLifeMax = npc.lifeMax; - npc.lifeMax = (int)(npc.lifeMax * scalar * bossLifeScale); - if (npc.lifeMax < setToLifeMax) - { - npc.lifeMax = setToLifeMax; - } - } - } - } - } - #endregion - - #region CanBeHitBy - public override bool? CanBeHitByItem(NPC npc, Player player, Item item) - { - if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - return !AnyBossNPCS(); - } - return null; - } - - public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) - { - if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - return !AnyBossNPCS(); - } - 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; - } - if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - cooldownSlot = 1; - } - if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - cooldownSlot = 1; - } - 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) - { - List beeEnemyList = new List(16) - { - NPCID.GiantMossHornet, - NPCID.BigMossHornet, - NPCID.LittleMossHornet, - NPCID.TinyMossHornet, - NPCID.MossHornet, - NPCID.VortexHornetQueen, - NPCID.VortexHornet, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.QueenBee, - mod.NPCType("PlaguebringerGoliath"), - mod.NPCType("PlaguebringerShade"), - mod.NPCType("PlagueBeeLargeG"), - mod.NPCType("PlagueBeeG"), - mod.NPCType("PlagueBeeLarge"), - mod.NPCType("PlagueBee") - }; - bool shouldAffect = beeEnemyList.Contains(npc.type); - if (shouldAffect) - { - 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 (enraged) - { - damage *= 3.0; - } - if (this.protection > 0f) - { - int trueDefense = defense; - if (pFlames) - { - trueDefense -= 4; - } - if (wDeath) - { - trueDefense -= 50; - } - if (gsInferno) - { - trueDefense -= 20; - } - if (aFlames) - { - trueDefense -= 10; - } - if (gState) - { - trueDefense /= 2; - } - if (aCrunch) - { - trueDefense /= 3; - } - if (trueDefense < 0) - { - trueDefense = 0; - } - double newDamage = (damage + (int)((double)trueDefense * 0.25)); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense - if (marked) - { - this.protection *= 0.5f; - } - if (npc.ichor) - { - this.protection *= 0.75f; - } - else if (npc.onFire2) - { - this.protection *= 0.8f; - } - if (npc.betsysCurse) - { - this.protection *= 0.66f; - } - if (this.protection < 0f) - { - this.protection = 0f; - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - this.protection) * newDamage)); //DR calc 195 * 0.4 = 78 damage 0.6 DR - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - this.protection = this.defProtection; - } - 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 (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - npc.chaseable = !AnyBossNPCS(); - } - #region BossRush - if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) - { - switch (CalamityPlayer.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 ? 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 ? 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 ? 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 ? 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; - 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); - } - this.newAI[0] += 1f; - if (this.newAI[0] >= 60f) - { - this.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.dontTakeDamage = false; - 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 ? 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 ? 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) - { - this.newAI[0] += (enraged ? 6f : 3f); - } - if (this.newAI[0] >= 180f) - { - this.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 ? 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 ? 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 ? 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) - { - this.newAI[0] += 1f; - if (this.newAI[0] >= 480f) - { - this.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 ? 0.9f : 0.8f); - scaleFactor = (enraged ? 15f : 13f); - num2 = (enraged ? 22 : 25); - } - else if (flag3 & flag5) - { - num3 = (enraged ? 0.8f : 0.7f); - scaleFactor = (enraged ? 13f : 11f); - num2 = (enraged ? 30 : 35); - } - else if (flag5 && !flag3 && !flag4) - { - num2 = 25; - } - int num4 = 24; - float num5 = 18f; - if (flag4) - { - num4 = (enraged ? 18 : 20); - num5 = (enraged ? 30f : 28f); - } - else if (flag5 & flag3) - { - num4 = (enraged ? 21 : 23); - num5 = (enraged ? 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) - { - #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 ? 10f : 7f); - float num12 = (enraged ? 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 ? 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)(28f * Main.expertDamage); //56 - } - if (npc.ai[1] == 0f & flag2) - { - npc.ai[1] = 5f; - } - if (npc.ai[1] == 0f) - { - float num37 = (enraged ? 8f : 5.5f); - float num38 = (enraged ? 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 ? 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 ? 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 ? 12f : 8f); - float num64 = (enraged ? 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 (npc.buffImmune[mod.BuffType("Enraged")]) - { - npc.buffImmune[mod.BuffType("Enraged")] = false; - } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - if (!npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && npc.type != mod.NPCType("SupremeCalamitas")) - { - npc.active = false; - npc.netUpdate = true; - } - } - 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; - } - } - #region RevengeanceAIChanges - if (CalamityWorld.revenge || 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.CountNPCS(NPCID.MoonLordFreeEye) > 3) - { - npc.dontTakeDamage = true; - } - } - else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - bool flag90 = npc.ai[2] == 0f; - float num1133 = (float)(-(float)flag90.ToDirectionInt()); - if (npc.ai[0] == -2f) - { - if (npc.type == NPCID.MoonLordHead && NPC.CountNPCS(mod.NPCType("Eidolist")) < 1) - { - if (NPC.CountNPCS(NPCID.MoonLordFreeEye) <= 3 || enraged) - { - if (this.newAI[1] < 600f) - { - this.newAI[1] += 1f; - } - if (this.newAI[1] >= 600f) - { - this.newAI[1] = 0f; - npc.netUpdate = true; - if (Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Eidolist"), 0, 0f, 0f, 0f, 0f, 255); - } - } - } - } - if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.75) - { - if (this.newAI[2] < 90f) - { - this.newAI[2] += 1f; - } - if ((int)this.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 (this.newAI[2] < 150f) - { - this.newAI[2] += 1f; - } - if ((int)this.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 (npc.type == NPCID.MoonLordHead) - { - if (Main.netMode != 1) - { - this.newAI[0] += 1f; - if (this.newAI[0] >= (enraged ? 300f : 480f)) - { - this.newAI[0] = 0f; - npc.TargetClosest(true); - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); - for (int num194 = 0; num194 < 40; num194++) - { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 30; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - else - { - if (Main.netMode != 1) - { - this.newAI[0] += 1f; - if (this.newAI[0] >= (enraged ? 300f : 480f)) - { - this.newAI[0] = 0f; - npc.TargetClosest(true); - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); - for (int num194 = 0; num194 < 40; num194++) - { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 30; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - } - } - #endregion - #region LunaticCultist - else if (npc.type == NPCID.CultistBoss) - { - bool goNuts = (double)npc.life <= (double)npc.lifeMax * 0.5 || enraged; - if (goNuts) - { - if (NPC.CountNPCS(mod.NPCType("Eidolist")) < 2) - { - if (this.newAI[0] < 120f) - { - this.newAI[0] += 1f; - } - if (this.newAI[0] >= 120f) - { - this.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); - } - if (NPC.CountNPCS(mod.NPCType("Eidolist")) > 1) - { - this.newAI[0] = -780f; - } - } - } - } - if (!goNuts) - { - 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.5 : 0.33); - 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 * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 1.4f : 1.3f) * num); - npc.defense = 38; - this.newAI[0] += 1f; - if (this.newAI[0] >= 480f) - { - this.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.5f * num); - npc.defense = (int)((float)npc.defDefense * 1.1f); - } - else - { - npc.damage = (int)((float)npc.defDamage * 1.2f * num); - npc.defense = (int)((float)npc.defDefense * 1.2f); - } - 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.02f; //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 && NPC.CountNPCS(NPCID.Golem) > 0 && !CalamityWorld.bossRushActive) - { - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) - { - golemDamageBonus = 1.3; - } - else if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) - { - golemDamageBonus = 1.25; - } - 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 - } - 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) - { - if ((double)npc.life < (double)npc.lifeMax * 0.15) - { - golemDamageBonus = 1.2; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.33) - { - golemDamageBonus = 1.15; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - golemDamageBonus = 1.1; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.8) - { - golemDamageBonus = 1.05; - } - else - { - golemDamageBonus = 1.0; - } - if (npc.ai[0] == 1f) - { - 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 - } - 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 - } - } - } - else if (npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight) - { - npc.life = 4000; - npc.damage = 120; - npc.dontTakeDamage = true; - } - #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.006f; - npc.velocity.Y *= 1.006f; - } - else if (npc.life < npc.lifeMax / 4) - { - npc.velocity.X *= 1.003f; - npc.velocity.Y *= 1.003f; - } - else if (npc.life < npc.lifeMax / 2) - { - npc.velocity.X *= 1.0015f; - npc.velocity.Y *= 1.0015f; - } - if (npc.life > npc.lifeMax / 2) - { - npc.defense = 42; - npc.damage = (int)(60f * Main.damageMultiplier); //120 - if (!jungle && !CalamityWorld.bossRushActive) - { - npc.defense *= 2; - npc.damage *= 2; - } - if (Main.netMode != 1) - { - npc.localAI[1] += (enraged ? 4f : 2f); - } - } - else - { - npc.defense = 22; - npc.damage = (int)(100f * Main.damageMultiplier); //200 - if (!jungle && !CalamityWorld.bossRushActive) - { - npc.defense *= 4; - npc.damage *= 2; - } - this.newAI[0] += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - this.newAI[0] += 0.5f; - } - if (this.newAI[0] >= (enraged ? 150f : 270f)) - { - this.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) - { - this.newAI[1] += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - this.newAI[1] += 0.5f; - } - if (this.newAI[1] >= (enraged ? 180f : 240f)) - { - this.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 = 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] += 2f; - } - } - if (npc.type == NPCID.PlanterasTentacle) - { - bool jungle = Main.player[npc.target].ZoneJungle; - this.newAI[0] += 1f; - if (CalamityWorld.death || !jungle) - { - this.newAI[0] += 1f; - } - if (this.newAI[0] >= 480f) - { - this.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) - { - if (Main.netMode != 1) - { - if (npc.ai[1] != 1f || (!CalamityWorld.death && (double)npc.life > (double)npc.lifeMax * 0.25) || CalamityWorld.bossRushActive) - { - 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 ? 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) - { - this.newAI[0] += 1f; - if (npc.ai[1] == 1f || CalamityWorld.bossRushActive) - { - this.newAI[0] += 3f; - } - if (this.newAI[0] >= (enraged ? 180f : 240f)) //4 seconds or 1 second - { - this.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 ? 9 : 5; - if ((double)npc.life <= (double)npc.lifeMax * 0.7) - { - speed++; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3) - { - speed++; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1) - { - speed++; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speed++; - } - if (enraged) - { - speed += 3; - } - float speed2 = (float)speed; - float speedBuff = 3.8f + (3.8f * (1f - (float)npc.life / (float)npc.lifeMax)); - float speedBuff2 = 13f + (13f * (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; - } - 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 ? 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) - { - laserEye = npc.whoAmI; - bool spazAlive = false; - if (NPC.CountNPCS(NPCID.Spazmatism) > 0) - { - spazAlive = true; - } - if (npc.ai[0] == 0f) - { - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult) - { - 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.damage = (int)((double)npc.defDamage * 1.2); - 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); - } - this.newAI[0] += (spazAlive ? 1f : 2f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - this.newAI[0] += 1f; - } - if (this.newAI[0] >= (enraged ? 180f : 240f)) - { - this.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) - { - fireEye = npc.whoAmI; - bool retAlive = false; - if (NPC.CountNPCS(NPCID.Retinazer) > 0) - { - retAlive = true; - } - if (npc.ai[0] == 0f) - { - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult) - { - 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.damage = (int)((double)npc.defDamage * 1.2); - npc.defense = npc.defDefense + 30; - if (npc.ai[1] == 0f) - { - if (!Main.player[npc.target].dead) - { - this.newAI[0] += 1f; - } - if (this.newAI[0] >= (enraged ? 20f : 30f)) - { - this.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 ? 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); - npc.velocity.X *= (retAlive ? 1.003f : 1.004f); - npc.velocity.Y *= (retAlive ? 1.003f : 1.004f); - if (enraged) - { - npc.velocity.X *= 1.002f; - npc.velocity.Y *= 1.002f; - } - } - else - { - npc.ai[2] += (retAlive ? 0.35f : 0.5f); - npc.velocity.X *= (retAlive ? 1.005f : 1.007f); - npc.velocity.Y *= (retAlive ? 1.005f : 1.007f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.velocity.X *= (retAlive ? 1.001f : 1.002f); - npc.velocity.Y *= (retAlive ? 1.001f : 1.002f); - } - if (enraged) - { - npc.velocity.X *= 1.002f; - npc.velocity.Y *= 1.002f; - } - } - } - } - #endregion - #region TheDestroyer - else if (npc.type == NPCID.TheDestroyerBody) - { - int defenseUp = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + defenseUp; - npc.localAI[0] = 0f; - int shootTime = (enraged ? 4 : 2); - if ((double)Main.player[npc.target].statLife > (double)Main.player[npc.target].statLifeMax2 * 0.5 || CalamityWorld.bossRushActive) - { - shootTime += 2; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - shootTime += 1; - } - if (Main.netMode != 1) - { - this.newAI[0] += (float)Main.rand.Next(shootTime); - if (this.newAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - this.newAI[0] = 0f; - npc.TargetClosest(true); - bool shootNoTileCollideLaser = false; - if (Main.rand.Next(3) == 0 || CalamityWorld.bossRushActive) - { - shootNoTileCollideLaser = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) || - shootNoTileCollideLaser) - { - 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 < 8f) - { - speed = 8f; - } - if (speed > 12f) - { - speed = 12f; - } - 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.5f : 0.33f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - speed += CalamityWorld.death ? 0.5f : 0.33f; - } - 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 = 26; - int num10 = 100; - int value = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 4; - if (Main.rand.Next(value) == 0 || enraged) - { - num10 = 257; - num9 = 23; - } - 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); - Main.projectile[num11].timeLeft = 300; - if (shootNoTileCollideLaser) - { - Main.projectile[num11].tileCollide = false; - } - npc.netUpdate = true; - } - } - } - } - #endregion - #region WallofFlesh - else if (npc.type == NPCID.WallofFlesh) - { - if (enraged) - { - npc.velocity.X *= 2f; - } - else if (CalamityWorld.bossRushActive) - { - npc.velocity.X *= 1.5f; - } - else if (CalamityWorld.death) - { - npc.velocity.X *= 1.18f; - } - else - { - npc.velocity.X *= 1.12f; - } - } - else if (npc.type == NPCID.WallofFleshEye && 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 ? 7 : 4); - npc.localAI[1] = 0f; - npc.localAI[3] += (enraged ? 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 (this.newAI[0] == 0f) - { - if (npc.localAI[3] > 600f) - { - this.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; - this.newAI[0] += 1f; - if (this.newAI[0] >= (float)num352) - { - this.newAI[0] = 0f; - } - if (flag30) - { - float num353 = (enraged ? 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 ? 1.5f : 0.5f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.ai[3] += 1f; - } - } - } - } - else if (npc.type == NPCID.SkeletronHead) - { - if (npc.ai[1] == 1f) - { - if (Main.netMode != 1) - { - npc.localAI[1] += (enraged ? 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) { num176 += 3f; } - npc.damage = (int)((double)npc.defDamage * 1.2); - 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; - } - } - #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); - int damageBoost = (int)(40f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.defDamage + damageBoost; - if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - } - else if (npc.ai[0] == 3f) - { - this.newAI[0] += 1f; - bool flag39 = false; - if (CalamityWorld.death) - { - if (this.newAI[0] % 10f == 9f) - { - flag39 = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - if (this.newAI[0] % 20f == 19f) - { - flag39 = true; - } - } - else if (npc.life < npc.lifeMax / 3) - { - if (this.newAI[0] % 35f == 34f) - { - flag39 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - if (this.newAI[0] % 50f == 49f) - { - flag39 = true; - } - } - else if (this.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) - { - this.newAI[0] += 1f; - if (this.newAI[0] >= 120f) - { - this.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 - { - this.newAI[0] += 1f; - if (this.newAI[0] >= 180f) - { - this.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) - { - this.newAI[0] += 1f; - if (CalamityWorld.death) - { - this.newAI[0] += 2f; - } - } - if (this.newAI[0] >= 180f) - { - this.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 - } - #endregion - } - #endregion - - #region PostAI - public override void PostAI(NPC npc) - { - 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 (CalamityWorld.revenge) - { - 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 == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerTail || npc.type == NPCID.SkeletronPrime || - npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser || - npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.Plantera) - { - if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) - { - damage /= 2; - } - } - else if (npc.type == NPCID.Golem || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.MoonLordFreeEye || - npc.type == NPCID.MoonLordCore || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordHand) - { - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 4; - } - } - if (CalamityWorld.revenge) - { - if (projectile.type == ProjectileID.BallOHurt || - projectile.type == ProjectileID.TheMeatball || - projectile.type == ProjectileID.BlueMoon || - projectile.type == ProjectileID.Sunfury || - projectile.type == ProjectileID.TheDaoofPow || - projectile.type == ProjectileID.FlowerPow || - projectile.type == ProjectileID.FlowerPowPetal || - projectile.type == ProjectileID.Anchor || - projectile.type == ProjectileID.BoxingGlove || - projectile.type == ProjectileID.GolemFist) - { - damage = (int)((double)damage * 2); - } - if (projectile.type == ProjectileID.ChainGuillotine) - { - damage = (int)((double)damage * 1.2); - } - if (npc.type == NPCID.TheDestroyerBody || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt") || - npc.type == mod.NPCType("AquaticScourgeHead") || npc.type == mod.NPCType("AquaticScourgeTail")) - { - if (projectile.type == 239 || projectile.type == 245 || projectile.type == mod.ProjectileType("Shaderain") || projectile.aiStyle == 4 || - projectile.type == 522) - { - damage = (int)((double)damage * 0.65); - } - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).eGauntlet) - { - if (projectile.melee && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && - npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && - npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && - npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) - { - if (!AnyBossNPCS()) - damage = npc.lifeMax * 5; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).eTalisman) - { - if (projectile.magic && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && - npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && - npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && - npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) - { - if (!AnyBossNPCS()) - damage = npc.lifeMax * 5; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).nanotech) - { - if (projectile.thrown && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && - npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && - npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && - npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) - { - if (!AnyBossNPCS()) - damage = npc.lifeMax * 5; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver) - { - if (projectile.ranged && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && - npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && - npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && - npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) - { - if (!AnyBossNPCS()) - damage = npc.lifeMax * 5; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).statisBeltOfCurses) - { - List projectileMinionList = new List(20) - { - 195, - 423, - 433, - 614, - 408, - 389, - 376, - 374, - 664, - 666, - 668, - 680, - 694, - 695, - 696, - 378, - 379, - 309, - 642, - 644 - }; - bool shouldAffect = projectileMinionList.Contains(projectile.type); - if ((projectile.minion || shouldAffect) && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && - Main.rand.Next(15) == 0 && npc.type != 477 && npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && - npc.type != 344 && npc.type != 346 && npc.type != 345 && npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && - npc.type != mod.NPCType("EidolonWyrmHead") && npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) - { - if (!AnyBossNPCS()) - damage = npc.lifeMax * 5; - } - } - } - #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 PreNPCLoot - public override bool PreNPCLoot(NPC npc) - { - #region BossRush - if (CalamityWorld.bossRushActive) - { - if (npc.type == mod.NPCType("ProfanedGuardianBoss")) - { - CalamityPlayer.bossRushStage = 7; - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.boss) - { - CalamityPlayer.bossRushStage = 8; - } - } - else if (npc.type == mod.NPCType("Astrageldon")) - { - CalamityPlayer.bossRushStage = 9; - } - else if (npc.type == mod.NPCType("Bumblefuck")) - { - CalamityPlayer.bossRushStage = 12; - } - else if (npc.type == mod.NPCType("HiveMindP2")) - { - CalamityPlayer.bossRushStage = 14; - } - else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) - { - CalamityPlayer.bossRushStage = 16; - } - else if (npc.type == mod.NPCType("AquaticScourgeHead")) - { - CalamityPlayer.bossRushStage = 17; - } - else if (npc.type == mod.NPCType("DesertScourgeHead")) - { - CalamityPlayer.bossRushStage = 18; - } - else if (npc.type == mod.NPCType("CrabulonIdle")) - { - CalamityPlayer.bossRushStage = 20; - } - else if (npc.type == mod.NPCType("CeaselessVoid")) - { - CalamityPlayer.bossRushStage = 22; - } - else if (npc.type == mod.NPCType("PerforatorHive")) - { - CalamityPlayer.bossRushStage = 23; - } - else if (npc.type == mod.NPCType("Cryogen")) - { - CalamityPlayer.bossRushStage = 24; - } - else if (npc.type == mod.NPCType("BrimstoneElemental")) - { - CalamityPlayer.bossRushStage = 25; - } - else if (npc.type == mod.NPCType("CosmicWraith")) - { - CalamityPlayer.bossRushStage = 26; - string key = "Mods.CalamityMod.BossRushTierThreeEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == mod.NPCType("ScavengerBody")) - { - CalamityPlayer.bossRushStage = 27; - } - else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) - { - CalamityPlayer.bossRushStage = 30; - } - else if (npc.type == mod.NPCType("Polterghast")) - { - CalamityPlayer.bossRushStage = 31; - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) - { - CalamityPlayer.bossRushStage = 32; - } - else if (npc.type == mod.NPCType("CalamitasRun3")) - { - CalamityPlayer.bossRushStage = 33; - string key = "Mods.CalamityMod.BossRushTierFourEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) - { - int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossType)) - { - CalamityPlayer.bossRushStage = 34; - } - } - else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) - { - if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) - && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityPlayer.bossRushStage = 35; - } - else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityPlayer.bossRushStage = 35; - } - else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) - { - CalamityPlayer.bossRushStage = 35; - } - } - else if (npc.type == mod.NPCType("Providence")) - { - CalamityPlayer.bossRushStage = 36; - } - else if (npc.type == mod.NPCType("SupremeCalamitas")) - { - CalamityPlayer.bossRushStage = 37; - } - else if (npc.type == mod.NPCType("Yharon")) - { - CalamityPlayer.bossRushStage = 38; - } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - CalamityPlayer.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(CalamityPlayer.bossRushStage); - netMessage.Send(); - } - string key = "Mods.CalamityMod.BossRushTierFiveEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - return false; - } - switch (npc.type) - { - case NPCID.QueenBee: - CalamityPlayer.bossRushStage = 1; - break; - case NPCID.BrainofCthulhu: - CalamityPlayer.bossRushStage = 2; - break; - case NPCID.KingSlime: - CalamityPlayer.bossRushStage = 3; - break; - case NPCID.EyeofCthulhu: - CalamityPlayer.bossRushStage = 4; - break; - case NPCID.SkeletronPrime: - CalamityPlayer.bossRushStage = 5; - break; - case NPCID.Golem: - CalamityPlayer.bossRushStage = 6; - break; - case NPCID.TheDestroyer: - CalamityPlayer.bossRushStage = 10; - string key = "Mods.CalamityMod.BossRushTierOneEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - break; - case NPCID.Spazmatism: - CalamityPlayer.bossRushStage = 11; - break; - case NPCID.Retinazer: - CalamityPlayer.bossRushStage = 11; - break; - case NPCID.WallofFlesh: - CalamityPlayer.bossRushStage = 13; - break; - case NPCID.SkeletronHead: - CalamityPlayer.bossRushStage = 15; - break; - case NPCID.CultistBoss: - CalamityPlayer.bossRushStage = 19; - string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; - Color messageColor2 = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - break; - case NPCID.Plantera: - CalamityPlayer.bossRushStage = 21; - break; - case NPCID.DukeFishron: - CalamityPlayer.bossRushStage = 28; - break; - case NPCID.MoonLordCore: - CalamityPlayer.bossRushStage = 29; - break; - default: - break; - } - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityPlayer.bossRushStage); - netMessage.Send(); - } - return false; - } - #endregion - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmSteps = y / 4; - int abyssChasmY = (y - abyssChasmSteps) + 100; - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); - bool abyssPosX = false; - bool abyssPosY = ((double)(npc.position.Y / 16f) <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if ((double)(npc.position.X / 16f) < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if ((double)(npc.position.X / 16f) > abyssChasmX - 80) - { - abyssPosX = true; - } - } - bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && - ((((double)(npc.position.Y / 16f) > (Main.rockLayer - (double)Main.maxTilesY * 0.05)) && - abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && - !npc.buffImmune[mod.BuffType("CrushDepth")]); - if (hurtByAbyss) - { - return false; - } - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.Probe) - { - return false; - } - } - if (!NPC.downedMechBossAny && (npc.type == NPCID.Spazmatism || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge20")); - } - if (!NPC.downedBoss1 && npc.type == NPCID.EyeofCthulhu) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge3")); - } - else if (!NPC.downedQueenBee && npc.type == NPCID.QueenBee) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge16")); - } - else if (!NPC.downedMechBoss1 && npc.type == NPCID.TheDestroyer) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge21")); - } - else if (!NPC.downedMechBoss2 && npc.type == NPCID.Spazmatism) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge22")); - } - else if (!NPC.downedMechBoss3 && npc.type == NPCID.SkeletronPrime) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge23")); - } - else if (!NPC.downedPlantBoss && npc.type == NPCID.Plantera) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge25")); - } - else if (!NPC.downedFishron && npc.type == NPCID.DukeFishron) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge2")); - } - else if (npc.type == NPCID.CultistBoss) - { - if (!NPC.downedAncientCultist) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge4")); - } - if (Main.bloodMoon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge34")); - } - } - return true; - } - #endregion - - #region NPCLoot - public override void NPCLoot(NPC npc) - { - if (DraedonMayhem != 0) - { - if (!AnyBossNPCS()) - { - DraedonMayhem = 0; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - #region DefiledLoot - if (CalamityWorld.defiled) - { - if (npc.type == NPCID.AnglerFish || npc.type == NPCID.Werewolf) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AdhesiveBandage); - } - if (npc.type == NPCID.Werewolf) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonCharm); - } - } - } - else if (npc.type == NPCID.DesertBeast) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AncientHorn); - } - } - else if (npc.type == NPCID.ArmoredSkeleton) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BeamSword); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ArmorPolish); - } - } - else if (npc.type == NPCID.Clown) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bananarang); - } - } - else if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || npc.type == NPCID.ToxicSludge) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bezoar); - } - if (npc.type == NPCID.MossHornet) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TatteredBeeWing); - } - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Binoculars); - } - } - else if (npc.type == NPCID.DemonEye || npc.type == NPCID.WanderingEye) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackLens); - } - } - else if (npc.type == NPCID.CorruptSlime || npc.type == NPCID.DarkMummy) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Blindfold); - } - } - else if (npc.type >= 269 && npc.type <= 280) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Keybrand); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneFeather); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagnetSphere); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WispinaBottle); - } - } - else if (npc.type == NPCID.UndeadMiner) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BonePickaxe); - } - } - else if (npc.type == NPCID.Skeleton) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); - } - } - else if (npc.type == NPCID.ScutlixRider) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrainScrambler); - } - } - else if (npc.type == NPCID.Vampire) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrokenBatWing); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonStone); - } - } - else if (npc.type == NPCID.CaveBat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ChainKnife); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DepthMeter); - } - } - else if (npc.type == NPCID.DarkCaster || npc.type == NPCID.AngryBones) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ClothierVoodooDoll); - } - } - else if (npc.type == NPCID.PirateCaptain) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CoinGun); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DiscountCard); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Cutlass); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LuckyCoin); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PirateStaff); - } - } - else if (npc.type == NPCID.Reaper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DeathSickle); - } - } - else if (npc.type == NPCID.Demon) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemonScythe); - } - } - else if (npc.type == NPCID.DesertDjinn) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnLamp); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnsCurse); - } - } - else if (npc.type == NPCID.Shark) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - } - else if (npc.type == NPCID.Pixie || npc.type == NPCID.Wraith || npc.type == NPCID.Mummy) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FastClock); - } - } - else if (npc.type == NPCID.RedDevil) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FireFeather); - } - } - else if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman || npc.type == NPCID.ArmoredViking || npc.type == NPCID.IceTortoise) - { - if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostStaff); - } - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.IceSickle); - } - if (npc.type == NPCID.IceTortoise) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenTurtleShell); - } - } - } - else if (npc.type == NPCID.Harpy && Main.hardMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GiantHarpyFeather); - } - } - else if (npc.type == mod.NPCType("SunBat")) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HelFire); - } - } - else if (npc.type == mod.NPCType("Cryon")) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amarok); - } - } - else if (npc.type == NPCID.QueenBee) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HoneyedGoggles); - } - } - else if (npc.type == NPCID.Piranha) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Hook); - } - } - else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.InfernoFork); - } - } - else if (npc.type == NPCID.PinkJellyfish) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JellyfishNecklace); - } - } - else if (npc.type == NPCID.Paladin) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Kraken); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PaladinsHammer); - } - } - else if (npc.type == NPCID.SkeletonArcher) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagicQuiver); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Marrow); - } - } - else if (npc.type == NPCID.Lavabat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagmaStone); - } - } - else if (npc.type == NPCID.WalkingAntlion) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AntlionClaw); - } - } - else if (npc.type == NPCID.DarkMummy || npc.type == NPCID.GreenJellyfish) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Megaphone); - } - } - else if (npc.type == NPCID.CursedSkull) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (npc.type == NPCID.FireImp) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ObsidianRose); - } - } - else if (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PoisonStaff); - } - } - else if (npc.type == NPCID.SkeletonSniper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RifleScope); - } - } - else if (npc.type == NPCID.ChaosElemental) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RodofDiscord); - } - } - else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ShadowbeamStaff); - } - } - else if (npc.type == NPCID.SnowFlinx) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SnowballLauncher); - } - } - else if (npc.type == NPCID.RaggedCaster) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SpectreStaff); - } - } - else if (npc.type == NPCID.Plantera) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TheAxe); - } - } - else if (npc.type == NPCID.GiantBat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TrifoldMap); - } - } - else if (npc.type == NPCID.AngryTrapper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Uzi); - } - } - else if (npc.type == NPCID.FloatyGross || npc.type == NPCID.Corruptor) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vitamins); - } - } - else if (NPC.downedMechBossAny && npc.type == NPCID.GiantTortoise) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Yelets); - } - } - } - #endregion - #region ArmageddonLoot - if (CalamityWorld.armageddon) - { - if (npc.type == NPCID.Golem) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.DukeFishron) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.DD2Betsy) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.BrainofCthulhu) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.boss) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - } - else if (npc.type == NPCID.QueenBee) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.SkeletronHead) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.WallofFlesh) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.MoonLordCore) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.KingSlime) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) - { - int num64 = NPCID.Retinazer; - if (npc.type == NPCID.Retinazer) - { - num64 = NPCID.Spazmatism; - } - if (!NPC.AnyNPCs(num64)) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - } - else if (npc.type == NPCID.SkeletronPrime) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.TheDestroyer) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.Plantera) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - } - #endregion - #region AdrenalineReset - if (npc.boss && CalamityWorld.revenge) - { - if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && - npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && - npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && - npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) - { - if (Main.netMode != 2) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; - } - } - } - } - #endregion - #region StressDrops - bool revenge = CalamityWorld.revenge; - bool defiled = CalamityWorld.defiled; - if (revenge && npc.boss) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("StressPills"), 1, true); break; - case 1: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Laudanum"), 1, true); break; - case 2: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HeartofDarkness"), 1, true); break; - } - } - } - #endregion - #region SpawnPolterghast - if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || - npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) - { - CalamityMod.ghostKillCount++; - if (CalamityMod.ghostKillCount >= 30 && Main.netMode != 1) - { - int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); - CalamityMod.ghostKillCount = 0; - } - } - } - #endregion - #region SpawnGSS - if ((NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) - { - CalamityMod.sharkKillCount++; - if (CalamityMod.sharkKillCount >= 20 && Main.netMode != 1) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); - CalamityMod.sharkKillCount = 0; - } - } - } - #endregion - #region WormLootFromNearestSegment - if (npc.type == mod.NPCType("DesertScourgeHead")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DesertScourgeHead") || Main.npc[k].type == mod.NPCType("DesertScourgeBody") || Main.npc[k].type == mod.NPCType("DesertScourgeTail"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LesserHealingPotion, Main.rand.Next(8, 15)); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(7, 15)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaboundStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinade")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSpray")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AquaticDischarge")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeMask")); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - if (!CalamityWorld.downedDesertScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge")); - } - CalamityWorld.downedDesertScourge = true; - } - else if (npc.type == mod.NPCType("AquaticScourgeHead")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && - (Main.npc[k].type == mod.NPCType("AquaticScourgeHead") || - Main.npc[k].type == mod.NPCType("AquaticScourgeBody") || - Main.npc[k].type == mod.NPCType("AquaticScourgeBodyAlt") || - Main.npc[k].type == mod.NPCType("AquaticScourgeTail"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); - if (Main.hardMode) - { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofSight, Main.rand.Next(20, 41)); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepseaStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinautical")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Downpour")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SubmarineShocker")); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - if (!CalamityWorld.downedAquaticScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge27")); - } - CalamityWorld.downedAquaticScourge = true; - } - else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) - { - string key = "Mods.CalamityMod.AstralBossText"; - Color messageColor = Color.Gold; - if (!CalamityWorld.downedStarGod) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge29")); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.downedStarGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("AstrumDeusHeadSpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusBodySpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusTailSpectral"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrumDeusTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(50, 81)); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Starfall")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); - } - if (Main.rand.Next(7) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AstrumDeusMask"), 1, true); - } - } - } - else if (npc.type == mod.NPCType("DevourerofGodsHead")) - { - DoGSecondStageCountdown = 21600; //6 minutes - for (int playerIndex = 0; playerIndex < 255; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - if (hasBuff == mod.BuffType("AdrenalineMode")) - { - player.DelBuff(l); - l = -1; - } - if (hasBuff == mod.BuffType("RageMode")) - { - player.DelBuff(l); - l = -1; - } - } - } - } - } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - string key = "Mods.CalamityMod.DoGBossText"; - Color messageColor = Color.Cyan; - string key2 = "Mods.CalamityMod.DoGBossText2"; - Color messageColor2 = Color.Orange; - if (!CalamityWorld.downedDoG) - { - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - CalamityWorld.downedDoG = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[k].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[k].type == mod.NPCType("DevourerofGodsTailS"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SupremeHealingPotion"), Main.rand.Next(8, 15)); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeathhailStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Excelsus")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheObliterator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eradicator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EradicatorMelee")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Deathwind")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaffoftheMechworm")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmiliteBar"), Main.rand.Next(25, 35)); - } - } - #endregion - #region ArmorSetLoot - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).tarraSet) - { - if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - } - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).bloodflareSet) - { - if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(2) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); - } - } - if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(6) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); - } - #endregion - #region Thingyouwillneverget - if (npc.type == mod.NPCType("Yharon") && Main.rand.Next(100) == 0 && npc.localAI[2] == 1f) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); - } - #endregion - #region Legendaries - if (revenge) - { - if (npc.type == NPCID.Golem) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AegisBlade")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AegisBlade")); - } - } - } - else if (npc.type == NPCID.Plantera) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlossomFlux")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlossomFlux")); - } - } - } - else if (npc.type == NPCID.DukeFishron) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrinyBaron")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrinyBaron")); - } - } - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malachite")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malachite")); - } - } - } - else if (npc.type == NPCID.DD2Betsy) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vesuvius")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vesuvius")); - } - } - } - else if (npc.type == NPCID.TheDestroyer) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SHPC")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SHPC")); - } - } - } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicDischarge")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicDischarge")); - } - } - } - else if (npc.type == mod.NPCType("Siren")) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheCommunity")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheCommunity")); - } - } - } - } - #endregion - #region Rares - if (npc.type == NPCID.PossessedArmor) - { - if (Main.expertMode) - { - if (Main.rand.Next(150) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - } - else if (Main.rand.Next(200) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - } - } - else if (npc.type == NPCID.SeaSnail) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); - } - } - else if (npc.type == NPCID.GiantTortoise) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); - } - } - else if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); - } - } - else if (npc.type == NPCID.AnomuraFungus) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); - } - } - else if (npc.type == NPCID.Crawdad || npc.type == NPCID.Crawdad2) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); - } - } - else if (npc.type == NPCID.GreenJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - } - else if (npc.type == NPCID.PinkJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - } - else if (npc.type == NPCID.BlueJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - else if (npc.type == NPCID.MossHornet) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); - } - } - else if (npc.type == NPCID.DarkCaster) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); - } - } - else if (npc.type == NPCID.BigMimicCorruption || npc.type == NPCID.BigMimicCrimson || npc.type == NPCID.BigMimicHallow || npc.type == NPCID.BigMimicJungle) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); - } - } - else if (npc.type == NPCID.Clinger) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); - } - } - else if (npc.type == NPCID.Shark) - { - if (Main.expertMode) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - } - else - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); - } - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - } - } - } - else if (npc.type == NPCID.PresentMimic) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); - } - } - else if (npc.type == NPCID.IchorSticker) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); - } - } - else if (npc.type == NPCID.Harpy && NPC.downedBoss1) - { - if (Main.expertMode) - { - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - } - else if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - } - } - else if (npc.type == NPCID.Antlion || npc.type == NPCID.WalkingAntlion || npc.type == NPCID.FlyingAntlion) - { - if (Main.expertMode) - { - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); - } - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); - } - } - else - { - if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); - } - if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); - } - } - } - else if (npc.type == NPCID.MartianSaucerCore) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); - } - } - else if (npc.type == NPCID.Demon) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); - } - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (npc.type == NPCID.BoneSerpentHead) - { - if (Main.expertMode) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); - } - } - else if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); - } - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (npc.type == NPCID.Tim) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (npc.type == NPCID.GoblinSorcerer) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (npc.type == NPCID.PirateDeadeye) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); - } - } - else if (npc.type == NPCID.PirateCrossbower) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); - } - } - else if (npc.type == NPCID.GoblinSummoner) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); - } - } - else if (npc.type == NPCID.SandElemental) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottlewithBoobs")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(2, 4)); - } - else - { - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); - } - } - else if (npc.type == NPCID.Skeleton || npc.type == NPCID.ArmoredSkeleton) - { - if (Main.expertMode) - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); - } - } - else if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); - } - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - } - } - else if (npc.type == NPCID.GoblinWarrior) - { - if (Main.expertMode) - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); - } - } - else if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); - } - } - else if (npc.type == NPCID.MartianWalker) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); - } - } - else if (npc.type == NPCID.GiantCursedSkull || npc.type == NPCID.NecromancerArmored || npc.type == NPCID.Necromancer) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); - } - } - #endregion - #region Commons - if (npc.type == NPCID.Vulture) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather"), Main.rand.Next(1, 3)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather")); - } - } - else if (npc.type == NPCID.SkeletonSniper || npc.type == NPCID.TacticalSkeleton || npc.type == NPCID.SkeletonCommando || npc.type == NPCID.Paladin || - npc.type == NPCID.GiantCursedSkull || npc.type == NPCID.BoneLee || npc.type == NPCID.DiabolistWhite || npc.type == NPCID.DiabolistRed || - npc.type == NPCID.NecromancerArmored || npc.type == NPCID.Necromancer || npc.type == NPCID.RaggedCasterOpenCoat || npc.type == NPCID.RaggedCaster || - npc.type == NPCID.HellArmoredBonesSword || npc.type == NPCID.HellArmoredBonesMace || npc.type == NPCID.HellArmoredBonesSpikeShield || - npc.type == NPCID.HellArmoredBones || npc.type == NPCID.BlueArmoredBonesSword || npc.type == NPCID.BlueArmoredBonesNoPants || - npc.type == NPCID.BlueArmoredBonesMace || npc.type == NPCID.BlueArmoredBones || npc.type == NPCID.RustyArmoredBonesSwordNoArmor || - npc.type == NPCID.RustyArmoredBonesSword || npc.type == NPCID.RustyArmoredBonesFlail || npc.type == NPCID.RustyArmoredBonesAxe) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(1, 3)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood")); - } - } - else if (npc.type == NPCID.RedDevil || npc.type == NPCID.SeekerHead || npc.type == NPCID.IchorSticker) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 4)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 3)); - } - } - else if (npc.type == NPCID.WyvernHead || npc.type == NPCID.AngryNimbus) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 4)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); - } - } - else if (npc.type == NPCID.IceTortoise || npc.type == NPCID.IcyMerman) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(1, 4)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(1, 3)); - } - } - else if (npc.type == NPCID.Plantera) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), Main.rand.Next(8, 12)); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), (Main.rand.Next(6, 10))); - } - } - else if (npc.type == NPCID.NebulaBrain || npc.type == NPCID.NebulaSoldier || npc.type == NPCID.NebulaHeadcrab || npc.type == NPCID.NebulaBeast) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(2, 4)); - } - } - else if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(1, 3))); - } - } - else if (npc.type == NPCID.CultistBoss) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(25, 31)); - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(20, 26))); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); - } - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(3, 6)); - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), (Main.rand.Next(2, 5))); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); - } - } - } - else if (npc.type == NPCID.DevourerHead || npc.type == NPCID.SeekerHead) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); - } - } - else if (npc.type == NPCID.FaceMonster || npc.type == NPCID.Herpling) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); - } - } - else if (npc.type == NPCID.ManEater) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); - } - } - else if (npc.type == NPCID.AngryTrapper) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); - } - } - else if (npc.type == NPCID.MotherSlime || npc.type == NPCID.Crimslime || npc.type == NPCID.CorruptSlime) - { - if (Main.expertMode) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); - } - } - else if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); - } - } - else if (npc.type == NPCID.Moth) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); - } - } - else if (npc.type == NPCID.Derpling) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); - } - } - else if (npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.Arapaima) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); - } - } - #endregion - #region Boss Specials - if (npc.boss) - { - CalamityWorld.downedBossAny = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.BrainofCthulhu) - { - if (npc.boss) - { - bool downedEvil = CalamityWorld.downedWhar; - CalamityWorld.downedWhar = true; - if (!downedEvil) - { - if (WorldGen.crimson) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge8")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge11")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge9")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge12")); - } - } - } - } - else if (npc.type == NPCID.SkeletronHead) - { - bool downedSkull = CalamityWorld.downedSkullHead; - CalamityWorld.downedSkullHead = true; - if (!downedSkull) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge17")); - } - } - else if (npc.type == NPCID.WallofFlesh) - { - if (!CalamityWorld.spawnAstralMeteor) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - else if (Main.rand.Next(2) == 0 && !CalamityWorld.spawnAstralMeteor2) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor2 = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - else if (Main.rand.Next(4) == 0 && !CalamityWorld.spawnAstralMeteor3) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor3 = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MLGRune")); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Meowthrower")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimsonKey); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CorruptionKey); - } - bool hardMode = CalamityWorld.downedUgly; - CalamityWorld.downedUgly = true; - string key2 = "Mods.CalamityMod.UglyBossText"; - Color messageColor2 = Color.Crimson; - string key3 = "Mods.CalamityMod.UglyBossText2"; - Color messageColor3 = Color.Cyan; - if (!hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge7")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge18")); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - } - } - else if (npc.type == NPCID.SkeletronPrime || npc.type == mod.NPCType("BrimstoneElemental")) - { - bool downedPrime = CalamityWorld.downedSkeletor; - if (npc.type == NPCID.SkeletronPrime) - { - CalamityWorld.downedSkeletor = true; - } - string key = "Mods.CalamityMod.SteelSkullBossText"; - Color messageColor = Color.Crimson; - if (!downedPrime && !CalamityWorld.downedBrimstoneElemental) - { - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (npc.type == mod.NPCType("BrimstoneElemental")) - { - if (!CalamityWorld.downedBrimstoneElemental) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge6")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge26")); - } - CalamityWorld.downedBrimstoneElemental = true; - } - } - else if (npc.type == NPCID.Plantera || npc.type == mod.NPCType("CalamitasRun3")) - { - bool downedPlant = CalamityWorld.downedPlantThing; - if (npc.type == NPCID.Plantera) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JungleKey); - } - CalamityWorld.downedPlantThing = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - string key = "Mods.CalamityMod.PlantBossText"; - Color messageColor = Color.RoyalBlue; - string key2 = "Mods.CalamityMod.PlantOreText"; - Color messageColor2 = Color.GreenYellow; - if (npc.type == mod.NPCType("CalamitasRun3")) - { - if (!CalamityWorld.downedCalamitas && !downedPlant) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - npc.DropItemInstanced(npc.position, npc.Size, ItemID.BrokenHeroSword, 1, true); - if (!CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge24")); - } - CalamityWorld.downedCalamitas = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.type == NPCID.Plantera) - { - if (!downedPlant) - { - CalamityWorld.spawnOre(mod.TileType("PerennialOre"), 12E-05, .4f, .65f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - if (!downedPlant && !CalamityWorld.downedCalamitas) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - else if (npc.type == NPCID.Golem) - { - bool downedIdiot = CalamityWorld.downedGolemBaby; - CalamityWorld.downedGolemBaby = true; - string key = "Mods.CalamityMod.BabyBossText"; - Color messageColor = Color.Lime; - string key2 = "Mods.CalamityMod.BabyBossText2"; - Color messageColor2 = Color.Yellow; - if (!downedIdiot) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge31")); - npc.DropItemInstanced(npc.position, npc.Size, ItemID.Picksaw, 1, true); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - } - else if (npc.type == NPCID.MoonLordCore) - { - bool downedMoonDude = CalamityWorld.downedMoonDude; - CalamityWorld.downedMoonDude = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; - if (!downedMoonDude) - { - CalamityWorld.spawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - if (Main.expertMode) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("MLGRune2"), 1, true); - } - } - else if (npc.type == NPCID.DD2Betsy) - { - CalamityWorld.downedBetsy = true; - } - else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NightmareFuel"), Main.rand.Next(10, 21)); - } - else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EndothermicEnergy"), Main.rand.Next(20, 41)); - } - else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DarksunFragment"), Main.rand.Next(10, 21)); - CalamityWorld.downedBuffedMothron = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Astrageldon")) - { - if (CalamityWorld.checkAstralMeteor()) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.dropAstralMeteor(); - } - if (!CalamityWorld.downedAstrageldon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge30")); - } - CalamityWorld.downedAstrageldon = true; - } - else if (npc.type == NPCID.KingSlime) - { - if (revenge) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CrownJewel"), 1, true); - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (revenge) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CounterScarf"), 1, true); - } - } - else if (npc.type == mod.NPCType("HiveMindP2")) //boss 2 - { - if (!CalamityWorld.downedHiveMind) - { - if (!CalamityWorld.downedPerforator) - { - string key = "Mods.CalamityMod.SkyOreText"; - Color messageColor = Color.Cyan; - CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .3f, .5f); - 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("Knowledge14")); - } - CalamityWorld.downedHiveMind = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("PerforatorHive")) //boss 3 - { - if (!CalamityWorld.downedPerforator) - { - if (!CalamityWorld.downedHiveMind) - { - string key = "Mods.CalamityMod.SkyOreText"; - Color messageColor = Color.Cyan; - CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .3f, .5f); - 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("Knowledge13")); - } - CalamityWorld.downedPerforator = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) //boss 4 - { - if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) - && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else if (npc.type == mod.NPCType("Cryogen")) //boss 5 - { - if (!CalamityWorld.downedCryogen) - { - string key = "Mods.CalamityMod.IceOreText"; - Color messageColor = Color.LightSkyBlue; - CalamityWorld.spawnOre(mod.TileType("CryonicOre"), 15E-05, .35f, .55f); - 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("Knowledge19")); - } - CalamityWorld.downedCryogen = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) //boss 8 - { - int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossType)) - { - if (!CalamityWorld.downedLeviathan) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge10")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge28")); - } - CalamityWorld.downedLeviathan = true; - } - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) //boss 9 - { - if (!CalamityWorld.downedPlaguebringer) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge32")); - } - CalamityWorld.downedPlaguebringer = true; - } - else if (npc.type == mod.NPCType("ProfanedGuardianBoss")) //boss 10 - { - CalamityWorld.downedGuardians = true; - } - else if (npc.type == mod.NPCType("Providence")) //boss 11 - { - string key2 = "Mods.CalamityMod.ProfanedBossText3"; - Color messageColor2 = Color.Orange; - string key3 = "Mods.CalamityMod.TreeOreText"; - Color messageColor3 = Color.LightGreen; - if (!CalamityWorld.downedProvidence) - { - CalamityWorld.spawnOre(mod.TileType("UelibloomOre"), 15E-05, .3f, .7f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - } - CalamityWorld.downedProvidence = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("CeaselessVoid")) //boss 12 - { - CalamityWorld.downedSentinel1 = true; //21600 - if (DoGSecondStageCountdown > 14460) - { - DoGSecondStageCountdown = 14460; - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) //boss 13 - { - CalamityWorld.downedSentinel2 = true; //21600 - if (DoGSecondStageCountdown > 7260) - { - DoGSecondStageCountdown = 7260; - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("CosmicWraith")) //boss 14 - { - CalamityWorld.downedSentinel3 = true; //21600 - if (DoGSecondStageCountdown > 600) - { - DoGSecondStageCountdown = 600; - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Bumblefuck")) //boss 16 - { - CalamityWorld.downedBumble = true; - if (revenge) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RedLightningContainer"), 1, true); - } - } - else if (npc.type == mod.NPCType("Yharon")) //boss 17 - { - string key = "Mods.CalamityMod.DargonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.AuricOreText"; - Color messageColor2 = Color.Gold; - if (!CalamityWorld.downedYharon && npc.localAI[2] == 1f) - { - CalamityWorld.spawnOre(mod.TileType("AuricOre"), 2E-05, .5f, .8f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - if (npc.localAI[2] == 1f) - { - CalamityWorld.downedYharon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (!CalamityWorld.buffedEclipse && npc.localAI[2] != 2f) - { - CalamityWorld.buffedEclipse = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else if (npc.type == mod.NPCType("SupremeCalamitas")) //boss 18 - { - CalamityWorld.downedSCal = true; - } - else if (npc.type == mod.NPCType("CrabulonIdle")) //boss 19 - { - if (!CalamityWorld.downedCrabulon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge5")); - } - CalamityWorld.downedCrabulon = true; - } - else if (npc.type == mod.NPCType("ScavengerBody")) //boss 20 - { - if (!CalamityWorld.downedScavenger) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge33")); - } - CalamityWorld.downedScavenger = true; - if (revenge) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("InfernalBlood"), 1, true); - } - } - else if (npc.type == mod.NPCType("Polterghast")) //boss 21 - { - string key = "Mods.CalamityMod.GhostBossText"; - Color messageColor = Color.RoyalBlue; - if (!CalamityWorld.downedPolterghast) - { - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.downedPolterghast = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("THELORDE")) //boss 22 - { - CalamityWorld.downedLORDE = true; - } - #endregion - #region DeathDowns - if (CalamityWorld.death) - { - if (npc.type == mod.NPCType("SupremeCalamitas")) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Levi")); - } - } - #endregion - } - #endregion - - #region EditSpawnRate - public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) - { - if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && NPC.downedMoonlord && Main.raining) - { - spawnRate = (int)((double)spawnRate * 0.75); - maxSpawns = (int)((float)maxSpawns * 1.25f); - } - if (player.GetModPlayer(mod).ZoneSulphur) - { - spawnRate = (int)((double)spawnRate * 0.6); - maxSpawns = (int)((float)maxSpawns * 0.8f); - } - else if (player.GetModPlayer(mod).ZoneAbyss) - { - spawnRate = (int)((double)spawnRate * 0.8); - maxSpawns = (int)((float)maxSpawns * 1.2f); - } - else if (player.GetModPlayer(mod).ZoneCalamity) - { - spawnRate = (int)((double)spawnRate * 0.7); - maxSpawns = (int)((float)maxSpawns * 1.15f); - } - else if (player.GetModPlayer(mod).ZoneAstral) - { - spawnRate = (int)((double)spawnRate * 0.5); - maxSpawns = (int)((float)maxSpawns * 1.15f); - } - 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).zerg) - { - spawnRate = (int)((double)spawnRate * 0.01); - maxSpawns = (int)((float)maxSpawns * 5f); - } - if (AnyBossNPCS() || player.GetModPlayer(mod).zen) - { - spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.5 : 50)); - maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.75f : 0.01f)); - } - } - #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).ZoneAstral) - { - pool[0] = 0f; - } - } - #endregion - - #region Drawing - public override void DrawEffects(NPC npc, ref Color drawColor) - { - 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; - } - } - - public override Color? GetAlpha(NPC npc, Color drawColor) - { - if (enraged) - return new Color(200, 50, 50, npc.alpha); - return null; - } - #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.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++; - 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++; - 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++; - } - if (NPC.downedFishron) - { - shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 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 (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 (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.downedCalamitas) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BlightedEyeball")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedAstrageldon) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("AstralChunk")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedStarGod) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Starcore")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.SpectreStaff); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - 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(20, 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].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || 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 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 - } +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; + +namespace CalamityMod.NPCs +{ + public class CalamityGlobalNPC : GlobalNPC + { + #region InstancePerEntity + public override bool InstancePerEntity + { + get + { + return true; + } + } + #endregion + + #region InstanceVars + public static bool DraedonMayhem = false; + + public static int DoGSecondStageCountdown = 0; + + public float protection = 0f; + + public float defProtection = 0f; + + public bool weaknessCold = false; + + public bool weaknessFire = false; + + public bool weaknessPoison = false; + + public bool weaknessStab = false; + + public bool weaknessSlash = false; + + public bool weaknessMagic = false; + + public bool weaknessDark = false; + + public bool weaknessWater = false; + + public bool weaknessHoly = false; + + public bool weaknessUnholy = 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 static int maxAIMod = 4; + + public float[] newAI = new float[maxAIMod]; + + public int CultProjectiles = 2; + + public const float CultAngleSpread = 170; + + public int CultCountdown = 0; + + public static int holyBoss = -1; + + public static int doughnutBoss = -1; + + public static int voidBoss = -1; + + public static int energyFlame = -1; + + public static int hiveMind = -1; + + public static int hiveMind2 = -1; + + public static int scavenger = -1; + + public static int bobbitWormBottom = -1; + + public static int DoGHead = -1; + + public static int SCal = -1; + + public static int ghostBoss = -1; + + public static int ghostBoss2 = -1; + + public static int laserEye = -1; + + public static int fireEye = -1; + + public static int lordeBoss = -1; + + public static int brimstoneElemental = -1; + + public static double golemDamageBonus = 1.0; + + public int bloodMoonKillCount = 0; + #endregion + + #region ResetEffects + public override void ResetEffects(NPC npc) + { + 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; + } + #endregion + + #region LifeRegen + public override void UpdateLifeRegen(NPC npc, ref int damage) + { + bool hardMode = Main.hardMode; + int npcDefense = npc.defense; + if (Main.raining && NPC.downedMoonlord && npc.damage > 0 && !npc.boss && !CalamityWorld.bossRushActive && + !npc.friendly && !npc.dontTakeDamage && (double)(npc.position.Y / 16f) < Main.worldSurface) + { + npc.AddBuff(mod.BuffType("Irradiated"), 2); + } + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmSteps = y / 4; + int abyssChasmY = (y - abyssChasmSteps) + 100; + 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 (npc.venom) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + int num7 = 0; + int num8 = 5; + 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) + { + num7 = 1; + } + npc.lifeRegen -= num7 * 50; + if (damage < num7 * 50 / num8) + { + damage = num7 * 50 / num8; + } + } + 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; + } + } + } + #endregion + + #region SetDefaults + public override void SetDefaults(NPC npc) + { + for (int m = 0; m < maxAIMod; m++) + { + this.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 (CalamityMod.enemyImmunityList.Contains(npc.type) || CalamityWorld.bossRushActive) + { + 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) + { + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } + if (Main.hardMode && !CalamityWorld.spawnedHardBoss && !npc.boss && !npc.friendly && !npc.dontTakeDamage && !npc.buffImmune[mod.BuffType("CrushDepth")]) + { + if (!CalamityMod.hardModeNerfExceptionList.Contains(npc.type) && npc.lifeMax > 5 && npc.damage > 5) + { + double multiplier = Main.expertMode ? 0.6 : 0.8; + npc.lifeMax = (int)((double)npc.lifeMax * multiplier); + npc.damage = (int)((double)npc.damage * multiplier); + } + } + if (CalamityWorld.defiled) + { + npc.value = (float)((int)((double)npc.value * 2)); + } + 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 = 420000; + break; + case NPCID.PrimeSaw: + npc.lifeMax = 450000; + break; + case NPCID.PrimeLaser: + npc.lifeMax = 280000; + break; + case NPCID.Golem: + npc.lifeMax = 780000; + break; + case NPCID.GolemHead: + npc.lifeMax = 400000; + break; + case NPCID.GolemFistLeft: + npc.lifeMax = 320000; + break; + case NPCID.GolemFistRight: + npc.lifeMax = 320000; + 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 = 3800000; + break; + case NPCID.TheDestroyerBody: + npc.lifeMax = 3800000; + break; + case NPCID.TheDestroyerTail: + npc.lifeMax = 3800000; + break; + case NPCID.Probe: + npc.lifeMax = 85000; + break; + case NPCID.Spazmatism: + npc.lifeMax = 1300000; + break; + case NPCID.Retinazer: + npc.lifeMax = 950000; + break; + case NPCID.WallofFlesh: + npc.lifeMax = 3200000; + break; + case NPCID.WallofFleshEye: + npc.lifeMax = 3200000; + break; + case NPCID.SkeletronHead: + npc.lifeMax = 1700000; + break; + case NPCID.SkeletronHand: + npc.lifeMax = 900000; + break; + case NPCID.CultistBoss: //Tier 3 + npc.lifeMax = 1800000; + break; + case NPCID.CultistDragonHead: + npc.lifeMax = 500000; + break; + case NPCID.CultistDragonBody1: + npc.lifeMax = 500000; + break; + case NPCID.CultistDragonBody2: + npc.lifeMax = 500000; + break; + case NPCID.CultistDragonBody3: + npc.lifeMax = 500000; + break; + case NPCID.CultistDragonBody4: + npc.lifeMax = 500000; + break; + case NPCID.CultistDragonTail: + npc.lifeMax = 500000; + break; + case NPCID.AncientCultistSquidhead: + npc.lifeMax = 300000; + break; + case NPCID.Plantera: + npc.lifeMax = 4200000; + break; + case NPCID.PlanterasTentacle: + npc.lifeMax = 150000; + break; + case NPCID.DukeFishron: //Tier 4 + npc.lifeMax = 4400000; + break; + case NPCID.MoonLordCore: + npc.lifeMax = 2500000; + break; + case NPCID.MoonLordHand: + npc.lifeMax = 875000; + break; + case NPCID.MoonLordHead: + npc.lifeMax = 1250000; + break; + case NPCID.MoonLordFreeEye: + npc.lifeMax = 1250; + 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 (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; + } + if (npc.type == NPCID.Probe) + { + 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; + } + } + 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) + { + if (npc.type == NPCID.PrimeLaser) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.9); + } + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + } + } + 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; + } + 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 * 5)); + if (npc.type == NPCID.MoonLordFreeEye) + { + npc.lifeMax = (int)((double)npc.lifeMax * 150.0); + } + if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) + { + npc.scale = 1.25f; + } + if (npc.type == NPCID.MoonLordCore) //final boss in hardmode, gets a big boost in stats + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.4); //140% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); //90% boost + } + npc.npcSlots = 12f; + } + if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.75); //75% boost + } + npc.npcSlots = 12f; + } + 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); + } + } + if (npc.type == NPCID.DukeFishron) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 3.525); //252.5% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.85); //85% boost + } + npc.npcSlots = 20f; + } + if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) + { + npc.lifeMax = (int)((double)npc.lifeMax * 30.0); + } + 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; + } + if (npc.type == NPCID.Plantera) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.681); //168.1% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.65); //65% boost + } + npc.npcSlots = 32f; + } + if (npc.type == NPCID.PlanterasTentacle) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + npc.damage = (int)((double)npc.damage * 1.25); + } + 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; + } + if (npc.type == NPCID.Probe) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.damage = (int)((double)npc.damage * 1.5); + npc.scale *= 1.2f; + } + } + 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) + { + if (npc.type == NPCID.PrimeLaser) + { + npc.lifeMax = (int)((double)npc.lifeMax * 0.15); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.15); + } + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + } + 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; + } + 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.WallofFlesh || npc.type == NPCID.WallofFleshEye) //final boss prehm, gets a big boost in stats + { + if (npc.type == NPCID.WallofFlesh) + { + npc.npcSlots = 20f; + } + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.75); + } + } + if (npc.type == NPCID.TheHungryII) + { + if (CalamityWorld.death) + { + npc.noTileCollide = true; + npc.lifeMax = (int)((double)npc.lifeMax * 4.5); + npc.damage = (int)((double)npc.damage * 2.5); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.5); + npc.damage = (int)((double)npc.damage * 1.35); + } + } + if (npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 4.5); + npc.damage = (int)((double)npc.damage * 2.5); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 3.1); + npc.damage = (int)((double)npc.damage * 1.25); + } + } + 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; + } + 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); + } + } + 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; + } + if (npc.type == NPCID.BrainofCthulhu) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.damage = (int)((double)npc.damage * 1.25); + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + } + npc.npcSlots = 12f; + } + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.type == NPCID.EaterofWorldsHead) + { + npc.npcSlots = 10f; + npc.damage = (int)((double)npc.damage * 1.85); + if (CalamityWorld.death) + { + npc.reflectingProjectiles = true; + } + } + else + { + npc.damage = (int)((double)npc.damage * 1.5); + } + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); //40% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.3); //30% boost + } + } + if (npc.type == NPCID.EyeofCthulhu) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); //130% boost + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); //25% boost + } + npc.npcSlots = 10f; + } + if (npc.type == NPCID.KingSlime) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.85); //85% boost + } + } + 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")) + { + this.protection = 0.05f; + } + else if (npc.type == mod.NPCType("AstrumDeusBody") || npc.type == mod.NPCType("SoulSeeker") || npc.type == mod.NPCType("DesertScourgeTail") || + npc.type == mod.NPCType("Horse") || npc.type == mod.NPCType("ProfanedEnergyBody") || npc.type == mod.NPCType("ScavengerClawLeft") || + npc.type == mod.NPCType("ScavengerClawRight") || npc.type == mod.NPCType("ScavengerHead") || npc.type == mod.NPCType("MantisShrimp") || + npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHead") || + npc.type == mod.NPCType("AquaticScourgeHead") || npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) + { + this.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")) + { + this.protection = 0.15f; + } + else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade")) + { + this.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")) + { + this.protection = 0.25f; + } + else if (npc.type == mod.NPCType("ProvSpawnOffense")) + { + this.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")) + { + this.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")) + { + this.protection = 0.4f; + } + else if (npc.type == mod.NPCType("ArmoredDiggerTail")) + { + this.protection = 0.45f; + } + else if (npc.type == mod.NPCType("SirenIce")) + { + this.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: + this.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: + this.protection = 0.1f; break; + case NPCID.ElfCopter: + case NPCID.GraniteGolem: + case NPCID.ArmoredSkeleton: + case NPCID.PirateShipCannon: + case NPCID.DD2OgreT3: + case NPCID.Golem: + this.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: + this.protection = 0.2f; break; + case NPCID.PrimeSaw: + case NPCID.PrimeVice: + case NPCID.SkeletronPrime: + case NPCID.Probe: + case NPCID.PossessedArmor: + this.protection = 0.25f; break; + case NPCID.Mimic: + case NPCID.PresentMimic: + case 473: + case 474: + case 475: + case 476: + this.protection = 0.3f; break; + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + case NPCID.SantaNK1: + case NPCID.MartianWalker: + case NPCID.TheDestroyerTail: + this.protection = 0.35f; break; + case NPCID.DeadlySphere: + this.protection = 0.4f; break; + case NPCID.Paladin: + this.protection = 0.45f; break; + case NPCID.WallofFlesh: + case NPCID.MothronEgg: + this.protection = 0.5f; break; + case NPCID.DungeonGuardian: + this.protection = 0.9999f; break; + } + } + } + if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || + npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge")) + { + this.protection = 0.999999f; + } + if (this.protection > 0f) + { + if (CalamityWorld.defiled) + { + this.protection += (1f - this.protection) * 0.5f; + } + this.defProtection = this.protection; + } + if (Main.raining && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.15); + npc.damage = (int)((double)npc.damage * 1.25); + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) + { + npc.lifeMax = (int)((double)npc.lifeMax * 3.5); + npc.damage = (int)((double)npc.damage * 2.0); + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + if (Main.pumpkinMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + { + npc.lifeMax = (int)((double)npc.lifeMax * 7.5); + npc.damage = (int)((double)npc.damage * 2.0); + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + else if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + { + npc.lifeMax = (int)((double)npc.lifeMax * 6.0); + npc.damage = (int)((double)npc.damage * 2.0); + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + else if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + { + npc.lifeMax = (int)((double)npc.lifeMax * 32.5); + npc.damage = (int)((double)npc.damage * 2.0); + 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 = (int)((double)npc.damage * 2.5); + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + } + } + #endregion + + #region ScaleExpertMultiplayerStats + public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) + { + 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"))) + { + bossLifeScale = 1f; //set expert scale to 1 instead of 2 + float playerCount = (float)numPlayers; + if (playerCount > 20f) //max player count + { + playerCount = 20f; + } + float scalar = 0.4f + ((2f * playerCount) / 20f); //lower scaling because fuck u + int setToLifeMax = npc.lifeMax; + npc.lifeMax = (int)(npc.lifeMax * scalar * bossLifeScale); + if (npc.lifeMax < setToLifeMax) + { + npc.lifeMax = setToLifeMax; + } + } + } + } + } + #endregion + + #region CanBeHitBy + public override bool? CanBeHitByItem(NPC npc, Player player, Item item) + { + if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + return Main.player[npc.target].townNPCs >= 3f; + } + return null; + } + + public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) + { + if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + return Main.player[npc.target].townNPCs >= 3f; + } + 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; + } + if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + { + cooldownSlot = 1; + } + if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + { + cooldownSlot = 1; + } + 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 (enraged) + { + damage *= 3.0; + } + if (this.protection > 0f) + { + int trueDefense = defense; + if (pFlames) + { + trueDefense -= 4; + } + if (wDeath) + { + trueDefense -= 50; + } + if (gsInferno) + { + trueDefense -= 20; + } + if (aFlames) + { + trueDefense -= 10; + } + if (gState) + { + trueDefense /= 2; + } + if (aCrunch) + { + trueDefense /= 3; + } + if (trueDefense < 0) + { + trueDefense = 0; + } + double newDamage = (damage + (int)((double)trueDefense * 0.25)); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense + if (marked) + { + this.protection *= 0.5f; + } + if (npc.ichor) + { + this.protection *= 0.75f; + } + else if (npc.onFire2) + { + this.protection *= 0.8f; + } + if (npc.betsysCurse) + { + this.protection *= 0.66f; + } + if (this.protection < 0f) + { + this.protection = 0f; + } + if (newDamage >= 1.0) + { + newDamage = (double)((int)((double)(1f - this.protection) * newDamage)); //DR calc 195 * 0.4 = 78 damage 0.6 DR + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + this.protection = this.defProtection; + } + 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 (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + npc.chaseable = Main.player[npc.target].townNPCs >= 3f; + } + #region BossRush + if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) + { + switch (CalamityPlayer.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 ? 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 ? 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 ? 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 ? 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; + 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); + } + this.newAI[0] += 1f; + if (this.newAI[0] >= 60f) + { + this.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.dontTakeDamage = false; + 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 ? 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 ? 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) + { + this.newAI[0] += (enraged ? 6f : 3f); + } + if (this.newAI[0] >= 180f) + { + this.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 ? 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 ? 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 ? 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) + { + this.newAI[0] += 1f; + if (this.newAI[0] >= 480f) + { + this.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 ? 0.9f : 0.8f); + scaleFactor = (enraged ? 15f : 13f); + num2 = (enraged ? 22 : 25); + } + else if (flag3 & flag5) + { + num3 = (enraged ? 0.8f : 0.7f); + scaleFactor = (enraged ? 13f : 11f); + num2 = (enraged ? 30 : 35); + } + else if (flag5 && !flag3 && !flag4) + { + num2 = 25; + } + int num4 = 24; + float num5 = 18f; + if (flag4) + { + num4 = (enraged ? 18 : 20); + num5 = (enraged ? 30f : 28f); + } + else if (flag5 & flag3) + { + num4 = (enraged ? 21 : 23); + num5 = (enraged ? 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) + { + #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 ? 10f : 7f); + float num12 = (enraged ? 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 ? 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)(28f * Main.expertDamage); //56 + } + if (npc.ai[1] == 0f & flag2) + { + npc.ai[1] = 5f; + } + if (npc.ai[1] == 0f) + { + float num37 = (enraged ? 8f : 5.5f); + float num38 = (enraged ? 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 ? 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 ? 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 ? 12f : 8f); + float num64 = (enraged ? 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 (npc.buffImmune[mod.BuffType("Enraged")]) + { + npc.buffImmune[mod.BuffType("Enraged")] = false; + } + if (SCal > -1) + { + if (!npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && npc.type != mod.NPCType("SupremeCalamitas")) + { + npc.active = false; + npc.netUpdate = true; + } + } + 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; + } + } + #region RevengeanceAIChanges + if (CalamityWorld.revenge || 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.CountNPCS(NPCID.MoonLordFreeEye) > 3) + { + npc.dontTakeDamage = true; + } + } + else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) + { + bool flag90 = npc.ai[2] == 0f; + float num1133 = (float)(-(float)flag90.ToDirectionInt()); + if (npc.ai[0] == -2f) + { + if (npc.type == NPCID.MoonLordHead && NPC.CountNPCS(mod.NPCType("Eidolist")) < 1) + { + if (NPC.CountNPCS(NPCID.MoonLordFreeEye) <= 3 || enraged) + { + if (this.newAI[1] < 600f) + { + this.newAI[1] += 1f; + } + if (this.newAI[1] >= 600f) + { + this.newAI[1] = 0f; + npc.netUpdate = true; + if (Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Eidolist"), 0, 0f, 0f, 0f, 0f, 255); + } + } + } + } + if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.75) + { + if (this.newAI[2] < 90f) + { + this.newAI[2] += 1f; + } + if ((int)this.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 (this.newAI[2] < 150f) + { + this.newAI[2] += 1f; + } + if ((int)this.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 (npc.type == NPCID.MoonLordHead) + { + if (Main.netMode != 1) + { + this.newAI[0] += 1f; + if (this.newAI[0] >= (enraged ? 300f : 480f)) + { + this.newAI[0] = 0f; + npc.TargetClosest(true); + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); + for (int num194 = 0; num194 < 40; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int laserDamage = 30; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + else + { + if (Main.netMode != 1) + { + this.newAI[0] += 1f; + if (this.newAI[0] >= (enraged ? 300f : 480f)) + { + this.newAI[0] = 0f; + npc.TargetClosest(true); + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); + for (int num194 = 0; num194 < 40; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int laserDamage = 30; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + } + } + #endregion + #region LunaticCultist + else if (npc.type == NPCID.CultistBoss) + { + bool goNuts = (double)npc.life <= (double)npc.lifeMax * 0.5 || enraged; + if (goNuts) + { + if (NPC.CountNPCS(mod.NPCType("Eidolist")) < 2) + { + if (this.newAI[0] < 120f) + { + this.newAI[0] += 1f; + } + if (this.newAI[0] >= 120f) + { + this.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); + } + if (NPC.CountNPCS(mod.NPCType("Eidolist")) > 1) + { + this.newAI[0] = -780f; + } + } + } + } + if (!goNuts) + { + 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.5 : 0.33); + 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 * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 1.4f : 1.3f) * num); + npc.defense = 38; + this.newAI[0] += 1f; + if (this.newAI[0] >= 480f) + { + this.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.5f * num); + npc.defense = (int)((float)npc.defDefense * 1.1f); + } + else + { + npc.damage = (int)((float)npc.defDamage * 1.2f * num); + npc.defense = (int)((float)npc.defDefense * 1.2f); + } + 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.02f; //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 && NPC.CountNPCS(NPCID.Golem) > 0 && !CalamityWorld.bossRushActive) + { + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) + { + golemDamageBonus = 1.3; + } + else if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) + { + golemDamageBonus = 1.25; + } + 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 + } + 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) + { + if ((double)npc.life < (double)npc.lifeMax * 0.15) + { + golemDamageBonus = 1.2; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.33) + { + golemDamageBonus = 1.15; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + golemDamageBonus = 1.1; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.8) + { + golemDamageBonus = 1.05; + } + else + { + golemDamageBonus = 1.0; + } + if (npc.ai[0] == 1f) + { + 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 + } + 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 + } + } + } + else if (npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight) + { + npc.life = 4000; + npc.damage = 120; + npc.dontTakeDamage = true; + } + #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.006f; + npc.velocity.Y *= 1.006f; + } + else if (npc.life < npc.lifeMax / 4) + { + npc.velocity.X *= 1.003f; + npc.velocity.Y *= 1.003f; + } + else if (npc.life < npc.lifeMax / 2) + { + npc.velocity.X *= 1.0015f; + npc.velocity.Y *= 1.0015f; + } + if (npc.life > npc.lifeMax / 2) + { + npc.defense = 42; + npc.damage = (int)(60f * Main.damageMultiplier); //120 + if (!jungle && !CalamityWorld.bossRushActive) + { + npc.defense *= 2; + npc.damage *= 2; + } + if (Main.netMode != 1) + { + npc.localAI[1] += (enraged ? 4f : 2f); + } + } + else + { + npc.defense = 22; + npc.damage = (int)(100f * Main.damageMultiplier); //200 + if (!jungle && !CalamityWorld.bossRushActive) + { + npc.defense *= 4; + npc.damage *= 2; + } + this.newAI[0] += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + this.newAI[0] += 0.5f; + } + if (this.newAI[0] >= (enraged ? 150f : 270f)) + { + this.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) + { + this.newAI[1] += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + this.newAI[1] += 0.5f; + } + if (this.newAI[1] >= (enraged ? 180f : 240f)) + { + this.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 = 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] += 2f; + } + } + if (npc.type == NPCID.PlanterasTentacle) + { + bool jungle = Main.player[npc.target].ZoneJungle; + this.newAI[0] += 1f; + if (CalamityWorld.death || !jungle) + { + this.newAI[0] += 1f; + } + if (this.newAI[0] >= 480f) + { + this.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) + { + if (Main.netMode != 1) + { + if (npc.ai[1] != 1f || (!CalamityWorld.death && (double)npc.life > (double)npc.lifeMax * 0.25) || CalamityWorld.bossRushActive) + { + 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 ? 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) + { + this.newAI[0] += 1f; + if (npc.ai[1] == 1f || CalamityWorld.bossRushActive) + { + this.newAI[0] += 3f; + } + if (this.newAI[0] >= (enraged ? 180f : 240f)) //4 seconds or 1 second + { + this.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 ? 9 : 5; + if ((double)npc.life <= (double)npc.lifeMax * 0.7) + { + speed++; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3) + { + speed++; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1) + { + speed++; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speed++; + } + if (enraged) + { + speed += 3; + } + float speed2 = (float)speed; + float speedBuff = 3.8f + (3.8f * (1f - (float)npc.life / (float)npc.lifeMax)); + float speedBuff2 = 13f + (13f * (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; + } + 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 ? 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) + { + laserEye = npc.whoAmI; + bool spazAlive = false; + if (NPC.CountNPCS(NPCID.Spazmatism) > 0) + { + spazAlive = true; + } + if (npc.ai[0] == 0f) + { + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); + if ((double)npc.life < (double)npc.lifeMax * healthMult) + { + 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.damage = (int)((double)npc.defDamage * 1.2); + 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); + } + this.newAI[0] += (spazAlive ? 1f : 2f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + this.newAI[0] += 1f; + } + if (this.newAI[0] >= (enraged ? 180f : 240f)) + { + this.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) + { + fireEye = npc.whoAmI; + bool retAlive = false; + if (NPC.CountNPCS(NPCID.Retinazer) > 0) + { + retAlive = true; + } + if (npc.ai[0] == 0f) + { + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); + if ((double)npc.life < (double)npc.lifeMax * healthMult) + { + 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.damage = (int)((double)npc.defDamage * 1.2); + npc.defense = npc.defDefense + 30; + if (npc.ai[1] == 0f) + { + if (!Main.player[npc.target].dead) + { + this.newAI[0] += 1f; + } + if (this.newAI[0] >= (enraged ? 20f : 30f)) + { + this.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 ? 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); + npc.velocity.X *= (retAlive ? 1.003f : 1.004f); + npc.velocity.Y *= (retAlive ? 1.003f : 1.004f); + if (enraged) + { + npc.velocity.X *= 1.002f; + npc.velocity.Y *= 1.002f; + } + } + else + { + npc.ai[2] += (retAlive ? 0.35f : 0.5f); + npc.velocity.X *= (retAlive ? 1.005f : 1.007f); + npc.velocity.Y *= (retAlive ? 1.005f : 1.007f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.velocity.X *= (retAlive ? 1.001f : 1.002f); + npc.velocity.Y *= (retAlive ? 1.001f : 1.002f); + } + if (enraged) + { + npc.velocity.X *= 1.002f; + npc.velocity.Y *= 1.002f; + } + } + } + } + #endregion + #region TheDestroyer + else if (npc.type == NPCID.TheDestroyerBody) + { + int defenseUp = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + defenseUp; + npc.localAI[0] = 0f; + int shootTime = (enraged ? 4 : 2); + if ((double)Main.player[npc.target].statLife > (double)Main.player[npc.target].statLifeMax2 * 0.5 || CalamityWorld.bossRushActive) + { + shootTime += 2; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + shootTime += 1; + } + if (Main.netMode != 1) + { + this.newAI[0] += (float)Main.rand.Next(shootTime); + if (this.newAI[0] >= (float)Main.rand.Next(1400, 26000)) + { + this.newAI[0] = 0f; + npc.TargetClosest(true); + bool shootNoTileCollideLaser = false; + if (Main.rand.Next(3) == 0 || CalamityWorld.bossRushActive) + { + shootNoTileCollideLaser = true; + } + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) || + shootNoTileCollideLaser) + { + 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 < 8f) + { + speed = 8f; + } + if (speed > 12f) + { + speed = 12f; + } + 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.5f : 0.33f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + speed += CalamityWorld.death ? 0.5f : 0.33f; + } + 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 = 26; + int num10 = 100; + int value = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 4; + if (Main.rand.Next(value) == 0 || enraged) + { + num10 = 257; + num9 = 23; + } + 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); + Main.projectile[num11].timeLeft = 300; + if (shootNoTileCollideLaser) + { + Main.projectile[num11].tileCollide = false; + } + npc.netUpdate = true; + } + } + } + } + #endregion + #region WallofFlesh + else if (npc.type == NPCID.WallofFlesh) + { + if (enraged) + { + npc.velocity.X *= 2f; + } + else if (CalamityWorld.bossRushActive) + { + npc.velocity.X *= 1.5f; + } + else if (CalamityWorld.death) + { + npc.velocity.X *= 1.18f; + } + else + { + npc.velocity.X *= 1.12f; + } + } + else if (npc.type == NPCID.WallofFleshEye && 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 ? 7 : 4); + npc.localAI[1] = 0f; + npc.localAI[3] += (enraged ? 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 (this.newAI[0] == 0f) + { + if (npc.localAI[3] > 600f) + { + this.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; + this.newAI[0] += 1f; + if (this.newAI[0] >= (float)num352) + { + this.newAI[0] = 0f; + } + if (flag30) + { + float num353 = (enraged ? 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 ? 1.5f : 0.5f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.ai[3] += 1f; + } + } + } + } + else if (npc.type == NPCID.SkeletronHead) + { + if (npc.ai[1] == 1f) + { + if (Main.netMode != 1) + { + npc.localAI[1] += (enraged ? 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) { num176 += 3f; } + npc.damage = (int)((double)npc.defDamage * 1.2); + 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; + } + } + #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); + int damageBoost = (int)(40f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.defDamage + damageBoost; + if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + } + else if (npc.ai[0] == 3f) + { + this.newAI[0] += 1f; + bool flag39 = false; + if (CalamityWorld.death) + { + if (this.newAI[0] % 10f == 9f) + { + flag39 = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + if (this.newAI[0] % 20f == 19f) + { + flag39 = true; + } + } + else if (npc.life < npc.lifeMax / 3) + { + if (this.newAI[0] % 35f == 34f) + { + flag39 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + if (this.newAI[0] % 50f == 49f) + { + flag39 = true; + } + } + else if (this.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) + { + this.newAI[0] += 1f; + if (this.newAI[0] >= 240f) + { + this.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 + { + this.newAI[0] += 1f; + if (this.newAI[0] >= 300f) + { + this.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) + { + this.newAI[0] += 1f; + if (CalamityWorld.death) + { + this.newAI[0] += 2f; + } + } + if (this.newAI[0] >= 180f) + { + this.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 + } + #endregion + } + #endregion + + #region PostAI + public override void PostAI(NPC npc) + { + 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 (CalamityWorld.revenge) + { + 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 == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerTail || npc.type == NPCID.SkeletronPrime || + npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser || + npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.Plantera) + { + if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) + { + damage /= 2; + } + } + else if (npc.type == NPCID.Golem || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.MoonLordFreeEye || + npc.type == NPCID.MoonLordCore || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordHand) + { + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 4; + } + } + if (CalamityWorld.revenge) + { + if (projectile.type == ProjectileID.BallOHurt || + projectile.type == ProjectileID.TheMeatball || + projectile.type == ProjectileID.BlueMoon || + projectile.type == ProjectileID.Sunfury || + projectile.type == ProjectileID.TheDaoofPow || + projectile.type == ProjectileID.FlowerPow || + projectile.type == ProjectileID.FlowerPowPetal || + projectile.type == ProjectileID.Anchor || + projectile.type == ProjectileID.BoxingGlove || + projectile.type == ProjectileID.GolemFist) + { + damage = (int)((double)damage * 2); + } + if (projectile.type == ProjectileID.ChainGuillotine) + { + damage = (int)((double)damage * 1.2); + } + if (npc.type == NPCID.TheDestroyerBody || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt") || + npc.type == mod.NPCType("AquaticScourgeHead") || npc.type == mod.NPCType("AquaticScourgeTail")) + { + if (projectile.type == 239 || projectile.type == 245 || projectile.type == mod.ProjectileType("Shaderain") || projectile.aiStyle == 4 || + projectile.type == 522) + { + damage = (int)((double)damage * 0.65); + } + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).eGauntlet) + { + if (projectile.melee && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && + npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && + npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && + npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) + { + if (!AnyBossNPCS()) + damage = npc.lifeMax * 5; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).eTalisman) + { + if (projectile.magic && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && + npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && + npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && + npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) + { + if (!AnyBossNPCS()) + damage = npc.lifeMax * 5; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).nanotech) + { + if (projectile.thrown && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && + npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && + npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && + npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) + { + if (!AnyBossNPCS()) + damage = npc.lifeMax * 5; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver) + { + if (projectile.ranged && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && Main.rand.Next(15) == 0 && npc.type != 477 && + npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && npc.type != 344 && npc.type != 346 && npc.type != 345 && + npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && npc.type != mod.NPCType("EidolonWyrmHead") && + npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) + { + if (!AnyBossNPCS()) + damage = npc.lifeMax * 5; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).statisBeltOfCurses) + { + if ((projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && + Main.rand.Next(15) == 0 && npc.type != 477 && npc.type != 327 && npc.type != 135 && npc.type != 136 && npc.type != 325 && + npc.type != 344 && npc.type != 346 && npc.type != 345 && npc.type != mod.NPCType("Reaper") && npc.type != mod.NPCType("Mauler") && + npc.type != mod.NPCType("EidolonWyrmHead") && npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid")) + { + if (!AnyBossNPCS()) + damage = npc.lifeMax * 5; + } + } + } + #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 PreNPCLoot + public override bool PreNPCLoot(NPC npc) + { + #region BossRush + if (CalamityWorld.bossRushActive) + { + if (npc.type == mod.NPCType("ProfanedGuardianBoss")) + { + CalamityPlayer.bossRushStage = 7; + DespawnProj(); + } + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.boss) + { + CalamityPlayer.bossRushStage = 8; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Astrageldon")) + { + CalamityPlayer.bossRushStage = 9; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Bumblefuck")) + { + CalamityPlayer.bossRushStage = 12; + DespawnProj(); + } + else if (npc.type == mod.NPCType("HiveMindP2")) + { + CalamityPlayer.bossRushStage = 14; + DespawnProj(); + } + else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) + { + CalamityPlayer.bossRushStage = 16; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AquaticScourgeHead")) + { + CalamityPlayer.bossRushStage = 17; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DesertScourgeHead")) + { + CalamityPlayer.bossRushStage = 18; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CrabulonIdle")) + { + CalamityPlayer.bossRushStage = 20; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CeaselessVoid")) + { + CalamityPlayer.bossRushStage = 22; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PerforatorHive")) + { + CalamityPlayer.bossRushStage = 23; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Cryogen")) + { + CalamityPlayer.bossRushStage = 24; + DespawnProj(); + } + else if (npc.type == mod.NPCType("BrimstoneElemental")) + { + CalamityPlayer.bossRushStage = 25; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CosmicWraith")) + { + CalamityPlayer.bossRushStage = 26; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierThreeEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (npc.type == mod.NPCType("ScavengerBody")) + { + CalamityPlayer.bossRushStage = 27; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) + { + CalamityPlayer.bossRushStage = 30; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Polterghast")) + { + CalamityPlayer.bossRushStage = 31; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) + { + CalamityPlayer.bossRushStage = 32; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CalamitasRun3")) + { + CalamityPlayer.bossRushStage = 33; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierFourEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) + { + int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossType)) + { + CalamityPlayer.bossRushStage = 34; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) + { + if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) + && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityPlayer.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityPlayer.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) + { + CalamityPlayer.bossRushStage = 35; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Providence")) + { + CalamityPlayer.bossRushStage = 36; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SupremeCalamitas")) + { + CalamityPlayer.bossRushStage = 37; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Yharon")) + { + CalamityPlayer.bossRushStage = 38; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + CalamityPlayer.bossRushStage = 0; + DespawnProj(); + CalamityWorld.bossRushActive = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityPlayer.bossRushStage); + netMessage.Send(); + } + string key = "Mods.CalamityMod.BossRushTierFiveEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + return false; + } + switch (npc.type) + { + case NPCID.QueenBee: + CalamityPlayer.bossRushStage = 1; + DespawnProj(); + break; + case NPCID.BrainofCthulhu: + CalamityPlayer.bossRushStage = 2; + DespawnProj(); + break; + case NPCID.KingSlime: + CalamityPlayer.bossRushStage = 3; + DespawnProj(); + break; + case NPCID.EyeofCthulhu: + CalamityPlayer.bossRushStage = 4; + DespawnProj(); + break; + case NPCID.SkeletronPrime: + CalamityPlayer.bossRushStage = 5; + DespawnProj(); + break; + case NPCID.Golem: + CalamityPlayer.bossRushStage = 6; + DespawnProj(); + break; + case NPCID.TheDestroyer: + CalamityPlayer.bossRushStage = 10; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierOneEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + break; + case NPCID.Spazmatism: + CalamityPlayer.bossRushStage = 11; + DespawnProj(); + break; + case NPCID.Retinazer: + CalamityPlayer.bossRushStage = 11; + DespawnProj(); + break; + case NPCID.WallofFlesh: + CalamityPlayer.bossRushStage = 13; + DespawnProj(); + break; + case NPCID.SkeletronHead: + CalamityPlayer.bossRushStage = 15; + DespawnProj(); + break; + case NPCID.CultistBoss: + CalamityPlayer.bossRushStage = 19; + DespawnProj(); + string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; + Color messageColor2 = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + break; + case NPCID.Plantera: + CalamityPlayer.bossRushStage = 21; + DespawnProj(); + break; + case NPCID.DukeFishron: + CalamityPlayer.bossRushStage = 28; + DespawnProj(); + break; + case NPCID.MoonLordCore: + CalamityPlayer.bossRushStage = 29; + DespawnProj(); + break; + default: + break; + } + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityPlayer.bossRushStage); + netMessage.Send(); + } + return false; + } + #endregion + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmSteps = y / 4; + int abyssChasmY = (y - abyssChasmSteps) + 100; + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); + bool abyssPosX = false; + bool abyssPosY = ((double)(npc.position.Y / 16f) <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if ((double)(npc.position.X / 16f) < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if ((double)(npc.position.X / 16f) > abyssChasmX - 80) + { + abyssPosX = true; + } + } + bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && + ((((double)(npc.position.Y / 16f) > (Main.rockLayer - (double)Main.maxTilesY * 0.05)) && + abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && + !npc.buffImmune[mod.BuffType("CrushDepth")]); + if (hurtByAbyss) + { + return false; + } + if (CalamityWorld.revenge) + { + if (npc.type == NPCID.Probe) + { + return false; + } + } + if (!NPC.downedMechBossAny && (npc.type == NPCID.Spazmatism || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge20")); + } + if (!NPC.downedBoss1 && npc.type == NPCID.EyeofCthulhu) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge3")); + } + else if (!NPC.downedQueenBee && npc.type == NPCID.QueenBee) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge16")); + } + else if (!NPC.downedMechBoss1 && npc.type == NPCID.TheDestroyer) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge21")); + } + else if (!NPC.downedMechBoss2 && npc.type == NPCID.Spazmatism) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge22")); + } + else if (!NPC.downedMechBoss3 && npc.type == NPCID.SkeletronPrime) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge23")); + } + else if (!NPC.downedPlantBoss && npc.type == NPCID.Plantera) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge25")); + } + else if (!NPC.downedFishron && npc.type == NPCID.DukeFishron) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge2")); + } + else if (npc.type == NPCID.CultistBoss) + { + if (!NPC.downedAncientCultist) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge4")); + } + if (Main.bloodMoon) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge34")); + } + } + return true; + } + #endregion + + #region NPCLoot + public override void NPCLoot(NPC npc) + { + if (DraedonMayhem) + { + if (!AnyBossNPCS()) + { + DraedonMayhem = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + #region DefiledLoot + if (CalamityWorld.defiled) + { + if (npc.type == NPCID.AnglerFish || npc.type == NPCID.Werewolf) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AdhesiveBandage); + } + if (npc.type == NPCID.Werewolf) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonCharm); + } + } + } + else if (npc.type == NPCID.DesertBeast) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AncientHorn); + } + } + else if (npc.type == NPCID.ArmoredSkeleton) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BeamSword); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ArmorPolish); + } + } + else if (npc.type == NPCID.Clown) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bananarang); + } + } + else if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || npc.type == NPCID.ToxicSludge) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bezoar); + } + if (npc.type == NPCID.MossHornet) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TatteredBeeWing); + } + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Binoculars); + } + } + else if (npc.type == NPCID.DemonEye || npc.type == NPCID.WanderingEye) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackLens); + } + } + else if (npc.type == NPCID.CorruptSlime || npc.type == NPCID.DarkMummy) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Blindfold); + } + } + else if (npc.type >= 269 && npc.type <= 280) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Keybrand); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneFeather); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagnetSphere); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WispinaBottle); + } + } + else if (npc.type == NPCID.UndeadMiner) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BonePickaxe); + } + } + else if (npc.type == NPCID.Skeleton) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); + } + } + else if (npc.type == NPCID.ScutlixRider) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrainScrambler); + } + } + else if (npc.type == NPCID.Vampire) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrokenBatWing); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonStone); + } + } + else if (npc.type == NPCID.CaveBat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ChainKnife); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DepthMeter); + } + } + else if (npc.type == NPCID.DarkCaster || npc.type == NPCID.AngryBones) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ClothierVoodooDoll); + } + } + else if (npc.type == NPCID.PirateCaptain) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CoinGun); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DiscountCard); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Cutlass); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LuckyCoin); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PirateStaff); + } + } + else if (npc.type == NPCID.Reaper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DeathSickle); + } + } + else if (npc.type == NPCID.Demon) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemonScythe); + } + } + else if (npc.type == NPCID.DesertDjinn) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnLamp); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnsCurse); + } + } + else if (npc.type == NPCID.Shark) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + } + else if (npc.type == NPCID.Pixie || npc.type == NPCID.Wraith || npc.type == NPCID.Mummy) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FastClock); + } + } + else if (npc.type == NPCID.RedDevil) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FireFeather); + } + } + else if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman || npc.type == NPCID.ArmoredViking || npc.type == NPCID.IceTortoise) + { + if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostStaff); + } + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.IceSickle); + } + if (npc.type == NPCID.IceTortoise) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenTurtleShell); + } + } + } + else if (npc.type == NPCID.Harpy && Main.hardMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GiantHarpyFeather); + } + } + else if (npc.type == mod.NPCType("SunBat")) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HelFire); + } + } + else if (npc.type == mod.NPCType("Cryon")) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amarok); + } + } + else if (npc.type == NPCID.QueenBee) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HoneyedGoggles); + } + } + else if (npc.type == NPCID.Piranha) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Hook); + } + } + else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.InfernoFork); + } + } + else if (npc.type == NPCID.PinkJellyfish) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JellyfishNecklace); + } + } + else if (npc.type == NPCID.Paladin) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Kraken); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PaladinsHammer); + } + } + else if (npc.type == NPCID.SkeletonArcher) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagicQuiver); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Marrow); + } + } + else if (npc.type == NPCID.Lavabat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagmaStone); + } + } + else if (npc.type == NPCID.WalkingAntlion) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AntlionClaw); + } + } + else if (npc.type == NPCID.DarkMummy || npc.type == NPCID.GreenJellyfish) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Megaphone); + } + } + else if (npc.type == NPCID.CursedSkull) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (npc.type == NPCID.FireImp) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ObsidianRose); + } + } + else if (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PoisonStaff); + } + } + else if (npc.type == NPCID.SkeletonSniper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RifleScope); + } + } + else if (npc.type == NPCID.ChaosElemental) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RodofDiscord); + } + } + else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ShadowbeamStaff); + } + } + else if (npc.type == NPCID.SnowFlinx) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SnowballLauncher); + } + } + else if (npc.type == NPCID.RaggedCaster) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SpectreStaff); + } + } + else if (npc.type == NPCID.Plantera) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TheAxe); + } + } + else if (npc.type == NPCID.GiantBat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TrifoldMap); + } + } + else if (npc.type == NPCID.AngryTrapper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Uzi); + } + } + else if (npc.type == NPCID.FloatyGross || npc.type == NPCID.Corruptor) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vitamins); + } + } + else if (NPC.downedMechBossAny && npc.type == NPCID.GiantTortoise) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Yelets); + } + } + } + #endregion + #region ArmageddonLoot + if (CalamityWorld.armageddon) + { + if (npc.type == NPCID.Golem) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.DukeFishron) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.DD2Betsy) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.BrainofCthulhu) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.boss) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + } + else if (npc.type == NPCID.QueenBee) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.SkeletronHead) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.WallofFlesh) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.MoonLordCore) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.KingSlime) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) + { + int num64 = NPCID.Retinazer; + if (npc.type == NPCID.Retinazer) + { + num64 = NPCID.Spazmatism; + } + if (!NPC.AnyNPCs(num64)) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + } + else if (npc.type == NPCID.SkeletronPrime) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.TheDestroyer) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.Plantera) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + } + #endregion + #region AdrenalineReset + if (npc.boss && CalamityWorld.revenge) + { + if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && + npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && + npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && + npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) + { + if (Main.netMode != 2) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; + } + } + } + } + #endregion + #region StressDrops + bool revenge = CalamityWorld.revenge; + bool defiled = CalamityWorld.defiled; + if (revenge && npc.boss) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("StressPills"), 1, true); break; + case 1: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Laudanum"), 1, true); break; + case 2: npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HeartofDarkness"), 1, true); break; + } + } + } + #endregion + #region SpawnPolterghast + if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || + npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) + { + CalamityMod.ghostKillCount++; + if (CalamityMod.ghostKillCount >= 30 && Main.netMode != 1) + { + int lastPlayer = npc.lastInteraction; + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = npc.FindClosestPlayer(); + } + if (lastPlayer >= 0) + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); + CalamityMod.ghostKillCount = 0; + } + } + } + #endregion + #region SpawnGSS + if ((NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) + { + CalamityMod.sharkKillCount++; + if (CalamityMod.sharkKillCount >= 20 && Main.netMode != 1) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + int lastPlayer = npc.lastInteraction; + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = npc.FindClosestPlayer(); + } + if (lastPlayer >= 0) + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); + CalamityMod.sharkKillCount = 0; + } + } + } + #endregion + #region WormLootFromNearestSegment + if (npc.type == mod.NPCType("DesertScourgeHead")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DesertScourgeHead") || Main.npc[k].type == mod.NPCType("DesertScourgeBody") || Main.npc[k].type == mod.NPCType("DesertScourgeTail"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LesserHealingPotion, Main.rand.Next(8, 15)); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(7, 15)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaboundStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinade")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSpray")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AquaticDischarge")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeMask")); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + if (!CalamityWorld.downedDesertScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge")); + } + CalamityWorld.downedDesertScourge = true; + } + else if (npc.type == mod.NPCType("AquaticScourgeHead")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && + (Main.npc[k].type == mod.NPCType("AquaticScourgeHead") || + Main.npc[k].type == mod.NPCType("AquaticScourgeBody") || + Main.npc[k].type == mod.NPCType("AquaticScourgeBodyAlt") || + Main.npc[k].type == mod.NPCType("AquaticScourgeTail"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); + if (Main.hardMode) + { + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofSight, Main.rand.Next(20, 41)); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepseaStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinautical")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Downpour")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SubmarineShocker")); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + if (!CalamityWorld.downedAquaticScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge27")); + } + CalamityWorld.downedAquaticScourge = true; + } + else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) + { + string key = "Mods.CalamityMod.AstralBossText"; + Color messageColor = Color.Gold; + if (!CalamityWorld.downedStarGod) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge29")); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + CalamityWorld.downedStarGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("AstrumDeusHeadSpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusBodySpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusTailSpectral"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrumDeusTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(50, 81)); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Starfall")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); + } + if (Main.rand.Next(7) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AstrumDeusMask"), 1, true); + } + } + } + else if (npc.type == mod.NPCType("DevourerofGodsHead")) + { + DoGSecondStageCountdown = 21600; //6 minutes + for (int playerIndex = 0; playerIndex < 255; playerIndex++) + { + if (Main.player[playerIndex].active) + { + Player player = Main.player[playerIndex]; + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + if (hasBuff == mod.BuffType("AdrenalineMode")) + { + player.DelBuff(l); + l = -1; + } + if (hasBuff == mod.BuffType("RageMode")) + { + player.DelBuff(l); + l = -1; + } + } + } + } + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + string key = "Mods.CalamityMod.DoGBossText"; + Color messageColor = Color.Cyan; + string key2 = "Mods.CalamityMod.DoGBossText2"; + Color messageColor2 = Color.Orange; + if (!CalamityWorld.downedDoG) + { + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + CalamityWorld.downedDoG = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[k].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[k].type == mod.NPCType("DevourerofGodsTailS"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SupremeHealingPotion"), Main.rand.Next(8, 15)); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeathhailStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Excelsus")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheObliterator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eradicator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EradicatorMelee")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Deathwind")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaffoftheMechworm")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmiliteBar"), Main.rand.Next(25, 35)); + } + } + #endregion + #region ArmorSetLoot + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).tarraSet) + { + if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); + } + } + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).bloodflareSet) + { + if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(2) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); + } + } + if (!npc.SpawnedFromStatue && npc.damage > 0 && Main.rand.Next(6) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); + } + #endregion + #region Thingyouwillneverget + if (npc.type == mod.NPCType("Yharon") && Main.rand.Next(100) == 0 && npc.localAI[2] == 1f) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); + } + #endregion + #region Legendaries + if (revenge) + { + if (npc.type == NPCID.Golem) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AegisBlade")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AegisBlade")); + } + } + } + else if (npc.type == NPCID.Plantera) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlossomFlux")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlossomFlux")); + } + } + } + else if (npc.type == NPCID.DukeFishron) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrinyBaron")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrinyBaron")); + } + } + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malachite")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malachite")); + } + } + } + else if (npc.type == NPCID.DD2Betsy) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vesuvius")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vesuvius")); + } + } + } + else if (npc.type == NPCID.TheDestroyer) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SHPC")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SHPC")); + } + } + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicDischarge")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicDischarge")); + } + } + } + else if (npc.type == mod.NPCType("Siren")) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheCommunity")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheCommunity")); + } + } + } + } + #endregion + #region Rares + if (npc.type == NPCID.PossessedArmor) + { + if (Main.expertMode) + { + if (Main.rand.Next(150) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + } + else if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + } + } + else if (npc.type == NPCID.SeaSnail) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); + } + } + else if (npc.type == NPCID.GiantTortoise) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); + } + } + else if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); + } + } + else if (npc.type == NPCID.AnomuraFungus) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); + } + } + else if (npc.type == NPCID.Crawdad || npc.type == NPCID.Crawdad2) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); + } + } + else if (npc.type == NPCID.GreenJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + } + else if (npc.type == NPCID.PinkJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + } + else if (npc.type == NPCID.BlueJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + else if (npc.type == NPCID.MossHornet) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); + } + } + else if (npc.type == NPCID.DarkCaster) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); + } + } + else if (npc.type == NPCID.BigMimicCorruption || npc.type == NPCID.BigMimicCrimson || npc.type == NPCID.BigMimicHallow || npc.type == NPCID.BigMimicJungle) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); + } + } + else if (npc.type == NPCID.Clinger) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); + } + } + else if (npc.type == NPCID.Shark) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + } + else + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); + } + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + } + } + } + else if (npc.type == NPCID.PresentMimic) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); + } + } + else if (npc.type == NPCID.IchorSticker) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); + } + } + else if (npc.type == NPCID.Harpy && NPC.downedBoss1) + { + if (Main.expertMode) + { + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + } + else if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + } + } + else if (npc.type == NPCID.Antlion || npc.type == NPCID.WalkingAntlion || npc.type == NPCID.FlyingAntlion) + { + if (Main.expertMode) + { + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); + } + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); + } + } + else + { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); + } + } + } + else if (npc.type == NPCID.MartianSaucerCore) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); + } + } + else if (npc.type == NPCID.Demon) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); + } + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (npc.type == NPCID.BoneSerpentHead) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); + } + } + else if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); + } + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (npc.type == NPCID.Tim) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (npc.type == NPCID.GoblinSorcerer) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (npc.type == NPCID.PirateDeadeye) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); + } + } + else if (npc.type == NPCID.PirateCrossbower) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); + } + } + else if (npc.type == NPCID.GoblinSummoner) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); + } + } + else if (npc.type == NPCID.SandElemental) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottlewithBoobs")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(2, 4)); + } + else + { + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); + } + } + else if (npc.type == NPCID.Skeleton || npc.type == NPCID.ArmoredSkeleton) + { + if (Main.expertMode) + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); + } + } + else if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); + } + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + } + } + else if (npc.type == NPCID.GoblinWarrior) + { + if (Main.expertMode) + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); + } + } + else if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); + } + } + else if (npc.type == NPCID.MartianWalker) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); + } + } + else if (npc.type == NPCID.GiantCursedSkull || npc.type == NPCID.NecromancerArmored || npc.type == NPCID.Necromancer) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); + } + } + #endregion + #region Commons + if (npc.type == NPCID.Vulture) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather"), Main.rand.Next(1, 3)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather")); + } + } + else if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(1, 3)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood")); + } + } + else if (npc.type == NPCID.RedDevil || npc.type == NPCID.SeekerHead || npc.type == NPCID.IchorSticker) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 4)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(1, 3)); + } + } + else if (npc.type == NPCID.WyvernHead || npc.type == NPCID.AngryNimbus) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 4)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); + } + } + else if (npc.type == NPCID.IceTortoise || npc.type == NPCID.IcyMerman) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(1, 4)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(1, 3)); + } + } + else if (npc.type == NPCID.Plantera) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), Main.rand.Next(8, 12)); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), (Main.rand.Next(6, 10))); + } + } + else if (npc.type == NPCID.NebulaBrain || npc.type == NPCID.NebulaSoldier || npc.type == NPCID.NebulaHeadcrab || npc.type == NPCID.NebulaBeast) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(2, 4)); + } + } + else if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(1, 3))); + } + } + else if (npc.type == NPCID.CultistBoss) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(25, 31)); + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(20, 26))); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); + } + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(3, 6)); + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), (Main.rand.Next(2, 5))); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); + } + } + } + else if (npc.type == NPCID.DevourerHead || npc.type == NPCID.SeekerHead) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); + } + } + else if (npc.type == NPCID.FaceMonster || npc.type == NPCID.Herpling) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); + } + } + else if (npc.type == NPCID.ManEater) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); + } + } + else if (npc.type == NPCID.AngryTrapper) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); + } + } + else if (npc.type == NPCID.MotherSlime || npc.type == NPCID.Crimslime || npc.type == NPCID.CorruptSlime) + { + if (Main.expertMode) + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); + } + } + else if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); + } + } + else if (npc.type == NPCID.Moth) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); + } + } + else if (npc.type == NPCID.Derpling) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); + } + } + else if (npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.Arapaima) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); + } + } + #endregion + #region Boss Specials + if (npc.boss) + { + CalamityWorld.downedBossAny = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.BrainofCthulhu) + { + if (npc.boss) + { + bool downedEvil = CalamityWorld.downedWhar; + CalamityWorld.downedWhar = true; + if (!downedEvil) + { + if (WorldGen.crimson) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge8")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge11")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge9")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge12")); + } + } + } + } + else if (npc.type == NPCID.SkeletronHead) + { + bool downedSkull = CalamityWorld.downedSkullHead; + CalamityWorld.downedSkullHead = true; + if (!downedSkull) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge17")); + } + } + else if (npc.type == NPCID.WallofFlesh) + { + if (CalamityWorld.checkAstralMeteor()) + { + if (!CalamityWorld.spawnAstralMeteor) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + CalamityWorld.dropAstralMeteor(); + } + else if (Main.rand.Next(2) == 0 && !CalamityWorld.spawnAstralMeteor2) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor2 = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + CalamityWorld.dropAstralMeteor(); + } + else if (Main.rand.Next(4) == 0 && !CalamityWorld.spawnAstralMeteor3) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor3 = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + CalamityWorld.dropAstralMeteor(); + } + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MLGRune")); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Meowthrower")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimsonKey); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CorruptionKey); + } + bool hardMode = CalamityWorld.downedUgly; + CalamityWorld.downedUgly = true; + string key2 = "Mods.CalamityMod.UglyBossText"; + Color messageColor2 = Color.Crimson; + string key3 = "Mods.CalamityMod.UglyBossText2"; + Color messageColor3 = Color.Cyan; + if (!hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge7")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge18")); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + } + } + } + else if (npc.type == NPCID.SkeletronPrime || npc.type == mod.NPCType("BrimstoneElemental")) + { + bool downedPrime = CalamityWorld.downedSkeletor; + if (npc.type == NPCID.SkeletronPrime) + { + CalamityWorld.downedSkeletor = true; + } + string key = "Mods.CalamityMod.SteelSkullBossText"; + Color messageColor = Color.Crimson; + if (!downedPrime && !CalamityWorld.downedBrimstoneElemental) + { + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (npc.type == mod.NPCType("BrimstoneElemental")) + { + if (!CalamityWorld.downedBrimstoneElemental) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge6")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge26")); + } + CalamityWorld.downedBrimstoneElemental = true; + } + } + else if (npc.type == NPCID.Plantera || npc.type == mod.NPCType("CalamitasRun3")) + { + bool downedPlant = CalamityWorld.downedPlantThing; + if (npc.type == NPCID.Plantera) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JungleKey); + } + CalamityWorld.downedPlantThing = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + string key = "Mods.CalamityMod.PlantBossText"; + Color messageColor = Color.RoyalBlue; + string key2 = "Mods.CalamityMod.PlantOreText"; + Color messageColor2 = Color.GreenYellow; + if (npc.type == mod.NPCType("CalamitasRun3")) + { + if (!CalamityWorld.downedCalamitas && !downedPlant) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + npc.DropItemInstanced(npc.position, npc.Size, ItemID.BrokenHeroSword, 1, true); + if (!CalamityWorld.downedCalamitas) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge24")); + } + CalamityWorld.downedCalamitas = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.type == NPCID.Plantera) + { + if (!downedPlant) + { + CalamityWorld.spawnOre(mod.TileType("PerennialOre"), 12E-05, .4f, .65f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + if (!downedPlant && !CalamityWorld.downedCalamitas) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + } + else if (npc.type == NPCID.Golem) + { + bool downedIdiot = CalamityWorld.downedGolemBaby; + CalamityWorld.downedGolemBaby = true; + string key = "Mods.CalamityMod.BabyBossText"; + Color messageColor = Color.Lime; + string key2 = "Mods.CalamityMod.BabyBossText2"; + Color messageColor2 = Color.Yellow; + if (!downedIdiot) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge31")); + npc.DropItemInstanced(npc.position, npc.Size, ItemID.Picksaw, 1, true); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + } + else if (npc.type == NPCID.MoonLordCore) + { + bool downedMoonDude = CalamityWorld.downedMoonDude; + CalamityWorld.downedMoonDude = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + string key = "Mods.CalamityMod.MoonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.MoonBossText2"; + Color messageColor2 = Color.Violet; + string key3 = "Mods.CalamityMod.MoonBossText3"; + Color messageColor3 = Color.Crimson; + string key4 = "Mods.CalamityMod.ProfanedBossText2"; + Color messageColor4 = Color.Cyan; + string key5 = "Mods.CalamityMod.FutureOreText"; + Color messageColor5 = Color.LightGray; + if (!downedMoonDude) + { + CalamityWorld.spawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + Main.NewText(Language.GetTextValue(key4), messageColor4); + Main.NewText(Language.GetTextValue(key5), messageColor5); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); + } + } + if (Main.expertMode) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("MLGRune2"), 1, true); + } + } + else if (npc.type == NPCID.DD2Betsy) + { + CalamityWorld.downedBetsy = true; + } + else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NightmareFuel"), Main.rand.Next(10, 21)); + } + else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EndothermicEnergy"), Main.rand.Next(20, 41)); + } + else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DarksunFragment"), Main.rand.Next(10, 21)); + CalamityWorld.downedBuffedMothron = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Astrageldon")) + { + if (CalamityWorld.checkAstralMeteor()) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.dropAstralMeteor(); + } + if (!CalamityWorld.downedAstrageldon) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge30")); + } + CalamityWorld.downedAstrageldon = true; + } + else if (npc.type == NPCID.KingSlime) + { + if (revenge) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CrownJewel"), 1, true); + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (revenge) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CounterScarf"), 1, true); + } + } + else if (npc.type == mod.NPCType("HiveMindP2")) //boss 2 + { + if (!CalamityWorld.downedHiveMind) + { + if (!CalamityWorld.downedPerforator) + { + string key = "Mods.CalamityMod.SkyOreText"; + Color messageColor = Color.Cyan; + CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .3f, .5f); + 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("Knowledge14")); + } + CalamityWorld.downedHiveMind = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("PerforatorHive")) //boss 3 + { + if (!CalamityWorld.downedPerforator) + { + if (!CalamityWorld.downedHiveMind) + { + string key = "Mods.CalamityMod.SkyOreText"; + Color messageColor = Color.Cyan; + CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .3f, .5f); + 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("Knowledge13")); + } + CalamityWorld.downedPerforator = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) //boss 4 + { + if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) + && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else if (npc.type == mod.NPCType("Cryogen")) //boss 5 + { + if (!CalamityWorld.downedCryogen) + { + string key = "Mods.CalamityMod.IceOreText"; + Color messageColor = Color.LightSkyBlue; + CalamityWorld.spawnOre(mod.TileType("CryonicOre"), 15E-05, .35f, .55f); + 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("Knowledge19")); + } + CalamityWorld.downedCryogen = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) //boss 8 + { + int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossType)) + { + if (!CalamityWorld.downedLeviathan) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge10")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge28")); + } + CalamityWorld.downedLeviathan = true; + } + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) //boss 9 + { + if (!CalamityWorld.downedPlaguebringer) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge32")); + } + CalamityWorld.downedPlaguebringer = true; + } + else if (npc.type == mod.NPCType("ProfanedGuardianBoss")) //boss 10 + { + CalamityWorld.downedGuardians = true; + } + else if (npc.type == mod.NPCType("Providence")) //boss 11 + { + string key2 = "Mods.CalamityMod.ProfanedBossText3"; + Color messageColor2 = Color.Orange; + string key3 = "Mods.CalamityMod.TreeOreText"; + Color messageColor3 = Color.LightGreen; + if (!CalamityWorld.downedProvidence) + { + CalamityWorld.spawnOre(mod.TileType("UelibloomOre"), 15E-05, .3f, .7f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + } + } + CalamityWorld.downedProvidence = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("CeaselessVoid")) //boss 12 + { + CalamityWorld.downedSentinel1 = true; //21600 + if (DoGSecondStageCountdown > 14460) + { + DoGSecondStageCountdown = 14460; + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) //boss 13 + { + CalamityWorld.downedSentinel2 = true; //21600 + if (DoGSecondStageCountdown > 7260) + { + DoGSecondStageCountdown = 7260; + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("CosmicWraith")) //boss 14 + { + CalamityWorld.downedSentinel3 = true; //21600 + if (DoGSecondStageCountdown > 600) + { + DoGSecondStageCountdown = 600; + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Bumblefuck")) //boss 16 + { + CalamityWorld.downedBumble = true; + if (revenge) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RedLightningContainer"), 1, true); + } + } + else if (npc.type == mod.NPCType("Yharon")) //boss 17 + { + string key = "Mods.CalamityMod.DargonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.AuricOreText"; + Color messageColor2 = Color.Gold; + if (!CalamityWorld.downedYharon && npc.localAI[2] == 1f) + { + CalamityWorld.spawnOre(mod.TileType("AuricOre"), 2E-05, .5f, .8f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + if (npc.localAI[2] == 1f) + { + CalamityWorld.downedYharon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (!CalamityWorld.buffedEclipse && npc.localAI[2] != 2f) + { + CalamityWorld.buffedEclipse = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + else if (npc.type == mod.NPCType("SupremeCalamitas")) //boss 18 + { + CalamityWorld.downedSCal = true; + } + else if (npc.type == mod.NPCType("CrabulonIdle")) //boss 19 + { + if (!CalamityWorld.downedCrabulon) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge5")); + } + CalamityWorld.downedCrabulon = true; + } + else if (npc.type == mod.NPCType("ScavengerBody")) //boss 20 + { + if (!CalamityWorld.downedScavenger) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge33")); + } + CalamityWorld.downedScavenger = true; + if (revenge) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("InfernalBlood"), 1, true); + } + } + else if (npc.type == mod.NPCType("Polterghast")) //boss 21 + { + string key = "Mods.CalamityMod.GhostBossText"; + Color messageColor = Color.RoyalBlue; + if (!CalamityWorld.downedPolterghast) + { + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + CalamityWorld.downedPolterghast = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("THELORDE")) //boss 22 + { + CalamityWorld.downedLORDE = true; + } + #endregion + #region DeathDowns + if (CalamityWorld.death) + { + if (npc.type == mod.NPCType("SupremeCalamitas")) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Levi")); + } + } + #endregion + } + #endregion + + #region EditSpawnRate + public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) + { + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && NPC.downedMoonlord && Main.raining) + { + spawnRate = (int)((double)spawnRate * 0.75); + maxSpawns = (int)((float)maxSpawns * 1.25f); + } + if (player.GetModPlayer(mod).ZoneSulphur) + { + spawnRate = (int)((double)spawnRate * 0.6); + maxSpawns = (int)((float)maxSpawns * 0.8f); + } + else if (player.GetModPlayer(mod).ZoneAbyss) + { + spawnRate = (int)((double)spawnRate * 0.8); + maxSpawns = (int)((float)maxSpawns * 1.2f); + } + else if (player.GetModPlayer(mod).ZoneCalamity) + { + spawnRate = (int)((double)spawnRate * 0.7); + maxSpawns = (int)((float)maxSpawns * 1.15f); + } + else if (player.GetModPlayer(mod).ZoneAstral) + { + spawnRate = (int)((double)spawnRate * 0.5); + maxSpawns = (int)((float)maxSpawns * 1.15f); + } + 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).zerg) + { + spawnRate = (int)((double)spawnRate * 0.01); + maxSpawns = (int)((float)maxSpawns * 5f); + } + if (AnyBossNPCS() || player.GetModPlayer(mod).zen) + { + spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.5 : 50)); + maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.75f : 0.01f)); + } + } + #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).ZoneAstral) + { + pool[0] = 0f; + } + } + #endregion + + #region Drawing + public override void DrawEffects(NPC npc, ref Color drawColor) + { + 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; + } + } + + public override Color? GetAlpha(NPC npc, Color drawColor) + { + if (enraged) + return new Color(200, 50, 50, npc.alpha); + return null; + } + #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 && 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 && NPC.downedMoonlord) + 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.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++; + 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++; + 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++; + } + if (NPC.downedFishron) + { + shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 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 (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, 25, 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.downedCalamitas) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BlightedEyeball")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedAstrageldon) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("AstralChunk")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedStarGod) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Starcore")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.SpectreStaff); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + 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(20, 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].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || 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 DespawnHostileProjectiles + public void DespawnProj() + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) + { + projectile.Kill(); + } + proj = x; + } + } + #endregion + + #region Astral things + public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) + { + 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 diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index b3d43ae28c..41b8fdc51f 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.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; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - [AutoloadBossHead] - public class CeaselessVoid : ModNPC - { - private float bossLife; - private float beamPortal = 0f; - private float shootBoost = 0; - private float passedVar = 1f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Void"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 36f; - npc.width = 100; //324 - npc.height = 100; //216 - npc.defense = 0; - npc.lifeMax = 200; - if (Main.expertMode) - { - npc.lifeMax = 400; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); - } - 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 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() - { - 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); - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (Main.netMode != 1) - { - beamPortal += expertMode ? 2f : 1f; - beamPortal += shootBoost; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - beamPortal += 4f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - beamPortal += 2f; - } - if (beamPortal >= 1200f) - { - beamPortal = 0f; - 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; - num942 += (float)Main.rand.Next(-10, 11) * 0.05f; - num943 += (float)Main.rand.Next(-10, 11) * 0.05f; - 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 (npc.life <= (int)((double)npc.lifeMax * 0.5) && 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; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), mod.ProjectileType("DarkEnergyBall"), damage, 0f, Main.myPlayer, passedVar, 0f); - passedVar += 1f; - } - passedVar = 1f; - } - } - } - float num823 = 10f; - float num824 = 0.2f; - 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; - } - } - 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 += 1f; - 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); - } - return; - } - } - } - } - - 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() - { - 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) - { - 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); - } - } - } +using System; +using System.Collections.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.CeaselessVoid +{ + [AutoloadBossHead] + public class CeaselessVoid : ModNPC + { + private float bossLife; + private float beamPortal = 0f; + private float shootBoost = 0; + private float passedVar = 1f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 36f; + npc.width = 100; //324 + npc.height = 100; //216 + npc.defense = 0; + npc.lifeMax = 200; + if (Main.expertMode) + { + npc.lifeMax = 400; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); + } + 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 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() + { + 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); + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (Main.netMode != 1) + { + beamPortal += expertMode ? 2f : 1f; + beamPortal += shootBoost; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + beamPortal += 4f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + beamPortal += 2f; + } + if (beamPortal >= 1200f) + { + beamPortal = 0f; + 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; + num942 += (float)Main.rand.Next(-10, 11) * 0.05f; + num943 += (float)Main.rand.Next(-10, 11) * 0.05f; + 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 (npc.life <= (int)((double)npc.lifeMax * 0.5) && 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; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), mod.ProjectileType("DarkEnergyBall"), damage, 0f, Main.myPlayer, passedVar, 0f); + passedVar += 1f; + } + passedVar = 1f; + } + } + } + float num823 = 10f; + float num824 = 0.2f; + 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; + } + } + 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 += 1f; + 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); + } + return; + } + } + } + } + + 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() + { + 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) + { + 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 diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index ad56933f95..2d4bb20bf1 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,210 +1,210 @@ -using System; -using System.Collections.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.CeaselessVoid -{ - public class DarkEnergy : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 120; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 3000; - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 12000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.knockBackResist = 0.25f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - 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--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - 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.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; - } - } - 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 num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 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 (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - 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; - return; - } - } - 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; - return; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, 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); - } - } - } - } +using System; +using System.Collections.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.CeaselessVoid +{ + public class DarkEnergy : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 120; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 3000; + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 12000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.knockBackResist = 0.25f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + 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--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + 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.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; + } + } + 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 num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 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 (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + 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; + return; + } + } + 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; + return; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, 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 diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 2afbbdbe0d..c5a413fa14 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -1,161 +1,161 @@ -using System; -using System.Collections.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.CeaselessVoid -{ - public class DarkEnergy2 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 120; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 3000; - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 12000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.knockBackResist = 0.1f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - 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--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - 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.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; - } - } - npc.TargetClosest(true); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - 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; - int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].scale = 1.3f; - Main.dust[num1262].noGravity = true; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, 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); - } - } - } - } +using System; +using System.Collections.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.CeaselessVoid +{ + public class DarkEnergy2 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 120; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 3000; + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 12000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.knockBackResist = 0.1f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + 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--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + 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.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; + } + } + npc.TargetClosest(true); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + 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; + int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].scale = 1.3f; + Main.dust[num1262].noGravity = true; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, 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 diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index d3deb72f36..590e075d58 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -1,188 +1,188 @@ -using System; -using System.Collections.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.CeaselessVoid -{ - public class DarkEnergy3 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 120; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 3000; - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 12000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0.3f; - npc.noGravity = true; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - 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--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - 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.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; - } - } - npc.TargetClosest(true); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - 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; - } - int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].scale = 1.3f; - Main.dust[num1262].noGravity = true; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, 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); - } - } - } - } +using System; +using System.Collections.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.CeaselessVoid +{ + public class DarkEnergy3 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 120; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 3000; + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 12000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0.3f; + npc.noGravity = true; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + 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--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + 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.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; + } + } + npc.TargetClosest(true); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + 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; + } + int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].scale = 1.3f; + Main.dust[num1262].noGravity = true; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, 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 diff --git a/NPCs/CosmicWraith/CosmicLantern.cs b/NPCs/CosmicWraith/CosmicLantern.cs index f3ca952ae5..e5a832d047 100644 --- a/NPCs/CosmicWraith/CosmicLantern.cs +++ b/NPCs/CosmicWraith/CosmicLantern.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; - -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 = 100; - npc.width = 25; //324 - npc.height = 25; //216 - npc.defense = 85; - npc.lifeMax = 100; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 5000; - } - npc.alpha = 255; - npc.knockBackResist = 0.85f; - npc.noGravity = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - 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 true; - } - - 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); - } - } - } - } +using System; +using System.Collections.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.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 = 100; + npc.width = 25; //324 + npc.height = 25; //216 + npc.defense = 85; + npc.lifeMax = 100; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 5000; + } + npc.alpha = 255; + npc.knockBackResist = 0.85f; + npc.noGravity = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + 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 true; + } + + 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 diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs index d1d9e82d36..ea8271020d 100644 --- a/NPCs/CosmicWraith/CosmicWraith.cs +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -1,837 +1,837 @@ -using System; -using System.Collections.Generic; -using 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; - -namespace CalamityMod.NPCs.CosmicWraith -{ - [AutoloadBossHead] - public class CosmicWraith : ModNPC - { - private const int CosmicProjectiles = 3; - private const float CosmicAngleSpread = 170; - private int CosmicCountdown = 0; - private float phaseSwitch = 0f; - private float chargeSwitch = 0f; - private int dustTimer = 3; - private float spawnX = 750f; - private float spawnY = 120f; - - 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 = 150; - npc.width = 130; - npc.height = 130; - npc.defense = 70; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - npc.lifeMax = CalamityWorld.revenge ? 229500 : 140000; - if (CalamityWorld.death) - { - npc.lifeMax = 209250; - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); - npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; - if (CalamityWorld.death) - { - npc.lifeMax = 722250; - } - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4400000 : 3900000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(0, 15, 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("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 AI() - { - bool cosmicDust = (double)npc.life <= (double)npc.lifeMax * 0.85; - bool speedBoost = (double)npc.life <= (double)npc.lifeMax * 0.75; - bool cosmicRain = (double)npc.life <= (double)npc.lifeMax * 0.65; - bool cosmicSpeed = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool cosmicTeleport = (double)npc.life <= (double)npc.lifeMax * 0.33; - 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; //should be lower - float num1001 = 5f; - float scaleFactor4 = 0.75f; //should be 0.75 - int num1002 = 0; //should be 0 - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = cosmicSpeed ? 12f : 15f; //should be lower - float num1006 = 0.333333343f; - float num1007 = 10f; //yes - num1006 *= num1005; - 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) - { - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - 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) - { - speed2 += 3; - } - 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; - 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, 10f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - } - } - } - } - float speed = expertMode ? 6f : 5.5f; - if (speedBoost) - { - speed = expertMode ? 7.5f : 7f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - speed += 3f; - } - if (npc.ai[0] <= 2f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (num1245 < speed) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = speed / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } - } - if (npc.ai[0] == 0f) - { - npc.chaseable = true; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (float)(200 + Main.rand.Next(200))) - { - 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(-40, 41); - num1251 += Main.rand.Next(-40, 41); - 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.damage = 0; - 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); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= (cosmicTeleport ? 5 : 4); - if (npc.alpha <= 0) - { - 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.damage = expertMode ? 240 : 150; - npc.dontTakeDamage = false; - 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; - return; - } - } - 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); - float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles - float num1066 = 0.2f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles - float num10662 = 0.075f; - 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 = player.position.X + (float)(player.width / 2) - vector122.X; - float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.life < npc.lifeMax / 3 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 10f == 9f) - { - flag104 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - if (npc.ai[1] % 15f == 14f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 20f == 19f) - { - flag104 = true; - } - if (flag104 && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) - { - if (Main.netMode != 1) - { - float num1070 = 15f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged) - { - num1070 += 3f; - } - if (cosmicRain) - { - num1070 += 2f; //changed from 3 not a prob - } - if (cosmicSpeed) - { - num1070 += 2f; - } - 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("CosmicFlameBurst"); //projectile type - int num1076 = Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num1076].timeLeft = 240; - } - } - if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) - { - num1065 = 14f; //changed from 14 not a prob - num1066 = 0.25f; //changed from 0.1 not a prob - num10662 = 0.1f; - vector122 = vector121; - num1067 = player.position.X + (float)(player.width / 2) - vector122.X; - num1068 = player.position.Y + (float)(player.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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662; - } - } - } - 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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662 * 2f; - } - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - 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 + spawnX), (int)(Main.player[npc.target].position.Y + 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 - spawnX), (int)(Main.player[npc.target].position.Y + 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 -= 60f; - } - spawnY = 120f; - npc.netUpdate = true; - } - } - 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 += 1f; - if (chargeSwitch == 0f) - { - 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) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - chargeSwitch = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (chargeSwitch == 1f) - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - chargeSwitch = 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 (chargeSwitch == 2f) - { - 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); //changed - 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) - { - chargeSwitch = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - chargeSwitch = 4f; - } - 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)) / (cosmicSpeed ? 11.65f : 14.75f); //num1005 12f 15f - } - } - else if (chargeSwitch == 4f) - { - npc.ai[1] -= 3f; - if (npc.ai[1] <= 0f) - { - chargeSwitch = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.95f; - } - if (phaseSwitch > 300f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - chargeSwitch = 0f; - phaseSwitch = 0f; - npc.netUpdate = true; - return; - } - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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; - } - Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); - int frameCount = Main.npcFrameCount[npc.type]; - float scale = npc.scale; - float rotation = npc.rotation; - 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(lightColor), - 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)); - 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)); - 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(lightColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); - return false; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override void NPCLoot() - { - 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) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, 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.Projectiles; +using CalamityMod.NPCs; + +namespace CalamityMod.NPCs.CosmicWraith +{ + [AutoloadBossHead] + public class CosmicWraith : ModNPC + { + private const int CosmicProjectiles = 3; + private const float CosmicAngleSpread = 170; + private int CosmicCountdown = 0; + private float phaseSwitch = 0f; + private float chargeSwitch = 0f; + private int dustTimer = 3; + private float spawnX = 750f; + private float spawnY = 120f; + + 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 = 150; + npc.width = 130; + npc.height = 130; + npc.defense = 70; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + npc.lifeMax = CalamityWorld.revenge ? 229500 : 140000; + if (CalamityWorld.death) + { + npc.lifeMax = 209250; + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); + npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; + if (CalamityWorld.death) + { + npc.lifeMax = 722250; + } + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4400000 : 3900000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(0, 15, 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("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 AI() + { + bool cosmicDust = (double)npc.life <= (double)npc.lifeMax * 0.85; + bool speedBoost = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool cosmicRain = (double)npc.life <= (double)npc.lifeMax * 0.65; + bool cosmicSpeed = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool cosmicTeleport = (double)npc.life <= (double)npc.lifeMax * 0.33; + 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; //should be lower + float num1001 = 5f; + float scaleFactor4 = 0.75f; //should be 0.75 + int num1002 = 0; //should be 0 + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = cosmicSpeed ? 12f : 15f; //should be lower + float num1006 = 0.333333343f; + float num1007 = 10f; //yes + num1006 *= num1005; + 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) + { + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + 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) + { + speed2 += 3; + } + 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; + 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, 10f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + } + } + } + } + float speed = expertMode ? 6f : 5.5f; + if (speedBoost) + { + speed = expertMode ? 7.5f : 7f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + speed += 3f; + } + if (npc.ai[0] <= 2f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (num1245 < speed) + { + npc.velocity.X = num1243; + npc.velocity.Y = num1244; + } + else + { + num1245 = speed / num1245; + npc.velocity.X = num1243 * num1245; + npc.velocity.Y = num1244 * num1245; + } + } + if (npc.ai[0] == 0f) + { + npc.chaseable = true; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (float)(200 + Main.rand.Next(200))) + { + 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(-40, 41); + num1251 += Main.rand.Next(-40, 41); + 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.damage = 0; + 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); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= (cosmicTeleport ? 5 : 4); + if (npc.alpha <= 0) + { + 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.damage = expertMode ? 240 : 150; + npc.dontTakeDamage = false; + 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; + return; + } + } + 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); + float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles + float num1066 = 0.2f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles + float num10662 = 0.075f; + 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 = player.position.X + (float)(player.width / 2) - vector122.X; + float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.life < npc.lifeMax / 3 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 10f == 9f) + { + flag104 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + if (npc.ai[1] % 15f == 14f) + { + flag104 = true; + } + } + else if (npc.ai[1] % 20f == 19f) + { + flag104 = true; + } + if (flag104 && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) + { + if (Main.netMode != 1) + { + float num1070 = 15f; //changed from 10 + if (npc.GetGlobalNPC(mod).enraged) + { + num1070 += 3f; + } + if (cosmicRain) + { + num1070 += 2f; //changed from 3 not a prob + } + if (cosmicSpeed) + { + num1070 += 2f; + } + 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("CosmicFlameBurst"); //projectile type + int num1076 = Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num1076].timeLeft = 240; + } + } + if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) + { + num1065 = 14f; //changed from 14 not a prob + num1066 = 0.25f; //changed from 0.1 not a prob + num10662 = 0.1f; + vector122 = vector121; + num1067 = player.position.X + (float)(player.width / 2) - vector122.X; + num1068 = player.position.Y + (float)(player.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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662; + } + } + } + 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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662 * 2f; + } + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + 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 + spawnX), (int)(Main.player[npc.target].position.Y + 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 - spawnX), (int)(Main.player[npc.target].position.Y + 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 -= 60f; + } + spawnY = 120f; + npc.netUpdate = true; + } + } + 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 += 1f; + if (chargeSwitch == 0f) + { + 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) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + chargeSwitch = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (chargeSwitch == 1f) + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + chargeSwitch = 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 (chargeSwitch == 2f) + { + 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); //changed + 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) + { + chargeSwitch = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + chargeSwitch = 4f; + } + 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)) / (cosmicSpeed ? 11.65f : 14.75f); //num1005 12f 15f + } + } + else if (chargeSwitch == 4f) + { + npc.ai[1] -= 3f; + if (npc.ai[1] <= 0f) + { + chargeSwitch = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.95f; + } + if (phaseSwitch > 300f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + chargeSwitch = 0f; + phaseSwitch = 0f; + npc.netUpdate = true; + return; + } + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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; + } + Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); + int frameCount = Main.npcFrameCount[npc.type]; + float scale = npc.scale; + float rotation = npc.rotation; + 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(lightColor), + 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)); + 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)); + 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(lightColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override void NPCLoot() + { + 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) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/CosmicWraith/SignusBomb.cs b/NPCs/CosmicWraith/SignusBomb.cs index 81e678d329..043424632e 100644 --- a/NPCs/CosmicWraith/SignusBomb.cs +++ b/NPCs/CosmicWraith/SignusBomb.cs @@ -1,177 +1,177 @@ -using System; -using System.Collections.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.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 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] >= 900f) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - npc.ai[3] += 1f; - npc.dontTakeDamage = (npc.ai[3] >= 750f ? false : true); - if (npc.ai[3] >= 600f) - { - 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; - } - return; - } - - 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; - } - } +using System; +using System.Collections.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.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 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] >= 900f) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + npc.ai[3] += 1f; + npc.dontTakeDamage = (npc.ai[3] >= 750f ? false : true); + if (npc.ai[3] >= 600f) + { + 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; + } + return; + } + + 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 diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index fcc4c75985..e40dd444fd 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.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; - -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 = 50000; - } - aiType = -1; - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - 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); - } - } - } - } +using System; +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.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 = 50000; + } + aiType = -1; + npc.knockBackResist = 0.75f; + npc.noGravity = true; + npc.noTileCollide = true; + 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 diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index c2f2555e2b..2240c8fe76 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -1,574 +1,574 @@ -using System; -using System.Collections.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.Crabulon -{ - [AutoloadBossHead] - public class CrabulonIdle : ModNPC - { - private float shotSpacing = 1000f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 14f; - npc.damage = 30; - npc.width = 164; //324 - npc.height = 154; //216 - npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 2640 : 1800; - if (CalamityWorld.death) - { - npc.lifeMax = 6930; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3600000 : 3000000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.noGravity = false; - npc.noTileCollide = false; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); - 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 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), npc.scale * 1.2f); - Main.dust[sporeDust].noGravity = true; - Main.dust[sporeDust].velocity *= 0.5f; - npc.damage = 0; - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 420f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.damage = 0; - 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) - { - int damageBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.defDamage + damageBoost; - 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) - { - 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; - return; - } - } - else if (npc.ai[0] == 3f) - { - int damageBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.defDamage + damageBoost; - 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 + shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 100f; - } - shotSpacing = 1000f; - } - 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.2f; //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) - { - 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); - } - } - 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 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); - } - else - { - CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); - } - 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 < 10; 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); - } - } - } +using System; +using System.Collections.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.Crabulon +{ + [AutoloadBossHead] + public class CrabulonIdle : ModNPC + { + private float shotSpacing = 1000f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 14f; + npc.damage = 30; + npc.width = 164; //324 + npc.height = 154; //216 + npc.defense = 8; + npc.lifeMax = CalamityWorld.revenge ? 2640 : 1800; + if (CalamityWorld.death) + { + npc.lifeMax = 6930; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3600000 : 3000000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.noGravity = false; + npc.noTileCollide = false; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); + 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 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), npc.scale * 1.2f); + Main.dust[sporeDust].noGravity = true; + Main.dust[sporeDust].velocity *= 0.5f; + npc.damage = 0; + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 420f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.damage = 0; + 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) + { + int damageBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.defDamage + damageBoost; + 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) + { + 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; + return; + } + } + else if (npc.ai[0] == 3f) + { + int damageBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.defDamage + damageBoost; + 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 + shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= 100f; + } + shotSpacing = 1000f; + } + 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.2f; //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) + { + 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); + } + } + 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 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); + } + else + { + CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); + } + 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 < 10; 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 diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs index 3faa3baae5..657ca735c5 100644 --- a/NPCs/Cryogen/Cryocore.cs +++ b/NPCs/Cryogen/Cryocore.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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; - return; - } - - 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); - } - } - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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; + return; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs index 76a103c645..8b11b4eae1 100644 --- a/NPCs/Cryogen/Cryocore2.cs +++ b/NPCs/Cryogen/Cryocore2.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode && Main.rand.Next(3) == 0) - { - player.AddBuff(BuffID.Frostburn, 60, true); - } - else if (Main.rand.Next(5) == 0) - { - player.AddBuff(BuffID.Frostburn, 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); - } - } - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode && Main.rand.Next(3) == 0) + { + player.AddBuff(BuffID.Frostburn, 60, true); + } + else if (Main.rand.Next(5) == 0) + { + player.AddBuff(BuffID.Frostburn, 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 2cd28baf80..c33b1cda27 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,1031 +1,1031 @@ -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; - -namespace CalamityMod.NPCs.Cryogen -{ - [AutoloadBossHead] - public class Cryogen : ModNPC - { - private int time = 0; - private bool oneTime = true; - private float iceShard = 0f; - private bool drawAltTexture = false; - - 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 ? 24300 : 17900; - if (CalamityWorld.death) - { - npc.lifeMax = 36900; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4500000 : 3800000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); - bossBag = mod.ItemType("CryogenBag"); - } - - 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) - { - 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 (oneTime) - { - RainStart(); - oneTime = 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 < 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; - } - if (num1245 < num1246) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = num1246 / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } - if ((double)npc.life < (double)npc.lifeMax * 0.83) - { - npc.ai[0] = 1f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - return; - } - } - 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 += 4f; - if (iceShard > 8f) - { - iceShard = 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 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.66) - { - npc.ai[0] = 2f; - npc.localAI[0] = 0f; - iceShard = 0f; - npc.netUpdate = true; - return; - } - } - 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)); - 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); - } - } - } - } - } - 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; - } - if (num1245 < num1246) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = num1246 / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } - if ((double)npc.life < (double)npc.lifeMax * 0.49) - { - npc.ai[0] = 3f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - return; - } - } - 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 += 4f; - if (iceShard > 8f) - { - iceShard = 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 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 = 0f; - npc.netUpdate = true; - return; - } - } - 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; - } - if (num1245 < speed) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = speed / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } - 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; - npc.localAI[3] = (float)num1250; - iceShard = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.alpha += 4; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.localAI[3] * 16f - (float)(npc.width / 2); - npc.position.Y = 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.damage = expertMode ? 96 : 60; - 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.dontTakeDamage = false; - npc.chaseable = true; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - iceShard = 0f; - 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); - } - return; - } - } - else - { - 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 -= 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.05 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (num1375 < 170f || iceShard > 0f) - { - if (num1375 < 170f) - { - iceShard = 17f; - } - 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 > 0f) - { - if (num1375 < 190f) - { - iceShard = 19f; - } - 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 > 0f) - { - if (num1375 < 200f) - { - iceShard = 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; - return; - } - 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); - } - } - return; - } - } - } - } - - 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 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 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, 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() - { - 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); - } - } - } - - 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("CryogenTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; 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(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("Permafrost")); - } - 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(3, 6)); - 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) - { - if (Main.expertMode && Main.rand.Next(3) == 0) - { - player.AddBuff(BuffID.Frostburn, 100, true); - } - else if (Main.rand.Next(5) == 0) - { - player.AddBuff(BuffID.Frostburn, 100, true); - } - } - } +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; + +namespace CalamityMod.NPCs.Cryogen +{ + [AutoloadBossHead] + public class Cryogen : ModNPC + { + private int time = 0; + private bool oneTime = true; + private float iceShard = 0f; + private bool drawAltTexture = false; + + 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 ? 4900000 : 4200000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 10, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); + bossBag = mod.ItemType("CryogenBag"); + } + + 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) + { + 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 (oneTime) + { + RainStart(); + oneTime = 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 < 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; + } + if (num1245 < num1246) + { + npc.velocity.X = num1243; + npc.velocity.Y = num1244; + } + else + { + num1245 = num1246 / num1245; + npc.velocity.X = num1243 * num1245; + npc.velocity.Y = num1244 * num1245; + } + if ((double)npc.life < (double)npc.lifeMax * 0.83) + { + npc.ai[0] = 1f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + return; + } + } + 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 += 4f; + if (iceShard > 8f) + { + iceShard = 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 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.66) + { + npc.ai[0] = 2f; + npc.localAI[0] = 0f; + iceShard = 0f; + npc.netUpdate = true; + return; + } + } + 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)); + 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); + } + } + } + } + } + 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; + } + if (num1245 < num1246) + { + npc.velocity.X = num1243; + npc.velocity.Y = num1244; + } + else + { + num1245 = num1246 / num1245; + npc.velocity.X = num1243 * num1245; + npc.velocity.Y = num1244 * num1245; + } + if ((double)npc.life < (double)npc.lifeMax * 0.49) + { + npc.ai[0] = 3f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + return; + } + } + 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 += 4f; + if (iceShard > 8f) + { + iceShard = 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 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 = 0f; + npc.netUpdate = true; + return; + } + } + 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; + } + if (num1245 < speed) + { + npc.velocity.X = num1243; + npc.velocity.Y = num1244; + } + else + { + num1245 = speed / num1245; + npc.velocity.X = num1243 * num1245; + npc.velocity.Y = num1244 * num1245; + } + 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; + npc.localAI[3] = (float)num1250; + iceShard = (float)num1251; + npc.netUpdate = true; + Block:; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.alpha += 4; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.localAI[3] * 16f - (float)(npc.width / 2); + npc.position.Y = 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.damage = expertMode ? 96 : 60; + 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.dontTakeDamage = false; + npc.chaseable = true; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + iceShard = 0f; + 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); + } + return; + } + } + else + { + 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 -= 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.05 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (num1375 < 170f || iceShard > 0f) + { + if (num1375 < 170f) + { + iceShard = 17f; + } + 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 > 0f) + { + if (num1375 < 190f) + { + iceShard = 19f; + } + 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 > 0f) + { + if (num1375 < 200f) + { + iceShard = 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; + return; + } + 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); + } + } + return; + } + } + } + } + + 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 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 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, 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() + { + 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); + } + } + } + + 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("CryogenTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; 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(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("Permafrost")); + } + 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(3, 6)); + 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) + { + if (Main.expertMode && Main.rand.Next(3) == 0) + { + player.AddBuff(BuffID.Frostburn, 100, true); + } + else if (Main.rand.Next(5) == 0) + { + player.AddBuff(BuffID.Frostburn, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 511ffd00d8..fa295b5898 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -1,126 +1,126 @@ -using System; -using System.Collections.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.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 = 1200; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 150000; - } - 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; - return; - } - } - - 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); - } - } - } - } +using System; +using System.Collections.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.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 = 170000; + } + 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; + return; + } + } + + 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 diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index d8ca2cac85..54d6f37de7 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.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.Projectiles; - -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.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } - - 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); - } - } - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 8a5d81ac70..9a249c441a 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,177 +1,177 @@ -using System; -using System.Collections.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.DesertScourge -{ - public class DesertScourgeBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 12; //70 - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 36; //216 - npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 2500 : 2300; - if (CalamityWorld.death) - { - npc.lifeMax = 4900; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8400000 : 7500000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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) - { - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 200, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 12; //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 ? 9000000 : 8100000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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) + { + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 200, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index c80241481e..840ea0209e 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; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeBodySmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 9; //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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - 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); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeBodySmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 9; //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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + 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); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 100, true); + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 4700fa0a5b..ac158671f8 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,482 +1,482 @@ -using System; -using System.Collections.Generic; -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; - -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 ? 2500 : 2300; - if (CalamityWorld.death) - { - npc.damage = 50; - npc.lifeMax = 4900; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8400000 : 7500000; - } - 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.buffImmune[mod.BuffType("ExoFreeze")] = false; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - bossBag = mod.ItemType("DesertScourgeBag"); - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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) - { - 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 ? 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.None; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 600, 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod; + +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 ? 9000000 : 8100000; + } + 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.buffImmune[mod.BuffType("ExoFreeze")] = false; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + bossBag = mod.ItemType("DesertScourgeBag"); + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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) + { + 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 ? 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 600, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index 4211fa18c5..797d1f7ef7 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -1,451 +1,451 @@ -using System; -using System.Collections.Generic; -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; - -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 = 13; //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.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - 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); - npc.damage = (int)(npc.damage * 1.1f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 200, 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod; + +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 = 13; //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.value = Item.buyPrice(0, 0, 5, 0); + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + 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); + npc.damage = (int)(npc.damage * 1.1f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 200, true); + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 88ae5126aa..1c913bd45b 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.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; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 9; - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 48; //216 - npc.defense = 18; - npc.lifeMax = CalamityWorld.revenge ? 2500 : 2300; - if (CalamityWorld.death) - { - npc.lifeMax = 4900; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8400000 : 7500000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 9; + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 48; //216 + npc.defense = 18; + npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; + if (CalamityWorld.death) + { + npc.lifeMax = 5100; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 9000000 : 8100000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index fa923c444b..34705d61cc 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; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeTailSmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 4; - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 48; //216 - npc.defense = 9; - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - 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); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 50, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeTailSmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 4; + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 48; //216 + npc.defense = 9; + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + 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); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 50, true); + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index 1eea7045b1..e56344c005 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.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; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DriedSeekerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 9; //70 - npc.npcSlots = 5f; - npc.width = 18; //324 - npc.height = 18; //216 - npc.defense = 5; - 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.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); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DriedSeekerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 9; //70 + npc.npcSlots = 5f; + npc.width = 18; //324 + npc.height = 18; //216 + npc.defense = 5; + 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.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); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 9270088fad..c3b1cf762a 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -1,123 +1,123 @@ -using System; -using System.Collections.Generic; -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.DesertScourge -{ - public class DriedSeekerHead : ModNPC - { - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 23; //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.value = Item.buyPrice(0, 0, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - 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; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 200, 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +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 = 23; //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.value = Item.buyPrice(0, 0, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + 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; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 200, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index 52a43977bd..b104b9f988 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.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; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DriedSeekerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 5; - npc.npcSlots = 5f; - npc.width = 18; //324 - npc.height = 18; //216 - npc.defense = 10; - 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.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; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 50, 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.Projectiles; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DriedSeekerTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 5; + npc.npcSlots = 5f; + npc.width = 18; //324 + npc.height = 18; //216 + npc.defense = 10; + 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.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; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 50, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 79b3fcf9ba..84eba3f308 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.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 Terraria.GameContent.Events; - -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 ? 10000 : 8000; - if (CalamityWorld.death) - { - npc.lifeMax = 14000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 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.behindTiles = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.timeLeft = NPC.activeTime * 30; - } - - 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.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) - { - if (npc.soundDelay == 0) - { - float num1533 = npc.Distance(vector260) / 40f; - if (num1533 < 10f) - { - num1533 = 10f; - } - if (num1533 > 20f) - { - num1533 = 20f; - } - npc.soundDelay = (int)num1533; - Main.PlaySound(15, npc.Center, 4); - } - 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 = 7f; - break; - case 1: - velocityX = 14f; velocityY = 5f; - break; - case 2: - velocityX = 8f; velocityY = 9f; - 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) < 400f && (npc.ai[2] >= 30f || npc.ai[2] < 0f)) - { - if (npc.localAI[0] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); - npc.localAI[0] = -1f; - } - npc.ai[2] = -30f; - Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); - npc.velocity = vector261 * 12f; - } - } - 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; - return; - } - } - } - - 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 void FindFrame(int frameHeight) - { - if (npc.localAI[3] == 0f) - { - npc.spriteDirection = -npc.direction; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override void 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); - } - } +using System; +using System.Collections.Generic; +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; + +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); + 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; + } + + 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.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) + { + if (npc.soundDelay == 0) + { + float num1533 = npc.Distance(vector260) / 40f; + if (num1533 < 10f) + { + num1533 = 10f; + } + if (num1533 > 20f) + { + num1533 = 20f; + } + npc.soundDelay = (int)num1533; + Main.PlaySound(15, npc.Center, 4); + } + 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 = 7f; + break; + case 1: + velocityX = 14f; velocityY = 5f; + break; + case 2: + velocityX = 8f; velocityY = 9f; + 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) < 400f && (npc.ai[2] >= 30f || npc.ai[2] < 0f)) + { + if (npc.localAI[0] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + npc.localAI[0] = -1f; + } + npc.ai[2] = -30f; + Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); + npc.velocity = vector261 * 12f; + } + } + 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; + return; + } + } + } + + 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 void FindFrame(int frameHeight) + { + if (npc.localAI[3] == 0f) + { + npc.spriteDirection = -npc.direction; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override void 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 diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 92e28e4c5f..aa0a142349 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,117 +1,117 @@ -using System; -using System.Collections.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 DankCreeper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - } - - public override void SetDefaults() - { - npc.damage = 18; - 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.value = Item.buyPrice(0, 0, 0, 0); - 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; - } - 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, 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); - } - } - } - - public override void NPCLoot() - { - if (Main.expertMode && Main.netMode != 1) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 12, 0f, Main.myPlayer, 0f, 0f); - } - } - } +using System; +using System.Collections.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 DankCreeper : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + } + + public override void SetDefaults() + { + npc.damage = 18; + 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.value = Item.buyPrice(0, 0, 0, 0); + 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; + } + 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, 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); + } + } + } + + public override void NPCLoot() + { + if (Main.expertMode && Main.netMode != 1) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 12, 0f, Main.myPlayer, 0f, 0f); + } + } + } } \ No newline at end of file diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index cdfce79599..6179c03aec 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -1,141 +1,141 @@ -using System; -using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); - 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 = 15; - if (Main.expertMode) - { - num184 = 12; - } - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); - 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, 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); - } - } - } - } +using System; +using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); + 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 = 15; + if (Main.expertMode) + { + num184 = 12; + } + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); + 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, 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 diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 35528e6673..7609df3de6 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -1,186 +1,186 @@ -using System; -using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, 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.02f; - 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.03f; - } - 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 > 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; - } - } - - 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); - } - } - } - } +using System; +using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, 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.02f; + 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.03f; + } + 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 > 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; + } + } + + 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 diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index ae440ab9fb..1daf4d8f8f 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -1,186 +1,186 @@ -using System; -using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind2 < 0) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind2; - 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.02f; - float num752 = 300f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind2].life < (double)Main.npc[CalamityGlobalNPC.hiveMind2].lifeMax * 0.25) - { - num752 += 30f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind2].life < (double)Main.npc[CalamityGlobalNPC.hiveMind2].lifeMax * 0.1) - { - num752 += 60f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.03f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind2 < 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; - } - } - - 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); - } - } - } - } +using System; +using System.Collections.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 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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind2 < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.hiveMind2; + 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.02f; + float num752 = 300f; + if ((double)Main.npc[CalamityGlobalNPC.hiveMind2].life < (double)Main.npc[CalamityGlobalNPC.hiveMind2].lifeMax * 0.25) + { + num752 += 30f; + } + if ((double)Main.npc[CalamityGlobalNPC.hiveMind2].life < (double)Main.npc[CalamityGlobalNPC.hiveMind2].lifeMax * 0.1) + { + num752 += 60f; + } + if (expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 100f; + num751 += 0.03f; + } + if (revenge) + { + num751 += 0.1f; + } + if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind2 < 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; + } + } + + 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 diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 5fa9c2d393..f0f0558b3f 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.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.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.value = Item.buyPrice(0, 0, 0, 0); - 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.2f); - } - - 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")); - } - } - } - } +using System; +using System.Collections.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.value = Item.buyPrice(0, 0, 0, 0); + 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.2f); + } + + 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 diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 7fed56689c..323b3e3cad 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,319 +1,319 @@ -using System; -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.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 ? 3600 : 2000; - if (CalamityWorld.death) - { - npc.lifeMax = 6600; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 790000 : 650000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.boss = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - } - - 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; + +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 ? 3600 : 2000; + if (CalamityWorld.death) + { + npc.lifeMax = 6600; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 790000 : 650000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.boss = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); + } + + 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(5, 8); - 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) - { - 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) < 8 && NPC.CountNPCS(NPCID.DevourerHead) < 2) - { - 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 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); - } - } - } + 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(5, 8); + 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) + { + 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) < 8 && NPC.CountNPCS(NPCID.DevourerHead) < 2) + { + 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 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 diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 44aa188cab..7edefb420a 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -1,726 +1,726 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -//reminder to remove unnecessary "CalamityMod." before CalamityWorld -//reminder to replace "ModLoader.GetMod("CalamityMod")." with "mod." -//enable the //CalamityGlobalNPC.hiveMind2 bit - -/* 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 = 30; - 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 = 30; - npc.width = 150; //324 - npc.height = 120; //216 - npc.defense = 5; - npc.lifeMax = CalamityWorld.revenge ? 4320 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 7200; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 880000 : 740000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - bossBag = mod.ItemType("HiveMindBag"); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - if (Main.expertMode) - { - minimumDriftTime = 240; - } - if (CalamityWorld.revenge) - { - minimumDriftTime = 120; - reelbackFade = 5; - driftBoost = 3f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - lungeRots = 0.4; - minimumDriftTime = 60; - reelbackFade = 7; - //decelerationTime = 20; - //lungeFade = 6; - //lungeDelay = 120; - 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 arg_5ADA_0 = npc.type; - int arg_5AE7_0 = npc.type; - int arg_5AF4_0 = npc.type; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (state != 0 && ((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.hiveMind2 = 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 ? 11 : 14; - 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) - { - 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 < 10; 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"), 90, 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; + +//reminder to remove unnecessary "CalamityMod." before CalamityWorld +//reminder to replace "ModLoader.GetMod("CalamityMod")." with "mod." +//enable the //CalamityGlobalNPC.hiveMind2 bit + +/* 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 = 30; + 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 = 30; + npc.width = 150; //324 + npc.height = 120; //216 + npc.defense = 5; + npc.lifeMax = CalamityWorld.revenge ? 4320 : 3000; + if (CalamityWorld.death) + { + npc.lifeMax = 7200; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 880000 : 740000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); + bossBag = mod.ItemType("HiveMindBag"); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + if (Main.expertMode) + { + minimumDriftTime = 240; + } + if (CalamityWorld.revenge) + { + minimumDriftTime = 120; + reelbackFade = 5; + driftBoost = 3f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + lungeRots = 0.4; + minimumDriftTime = 60; + reelbackFade = 7; + //decelerationTime = 20; + //lungeFade = 6; + //lungeDelay = 120; + 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 arg_5ADA_0 = npc.type; + int arg_5AE7_0 = npc.type; + int arg_5AF4_0 = npc.type; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (state != 0 && ((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.hiveMind2 = 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 ? 11 : 14; + 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) + { + 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 < 10; 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"), 90, true); + } + } + } +} diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 7854e643e5..3010ccf08a 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.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.Projectiles; - -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 = 42; - 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; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 0); - 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() - { - bool revenge = CalamityWorld.revenge; - 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); - } - } - } - } +using System; +using System.Collections.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.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 = 42; + 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; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 0, 0); + 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() + { + bool revenge = CalamityWorld.revenge; + 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 diff --git a/NPCs/Leviathan/LevScreenShaderData.cs b/NPCs/Leviathan/LevScreenShaderData.cs index c7137998d0..3b125744d6 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(); - } - } +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 diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index 5022fb4a60..dda1fbd214 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; - } - } +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 diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 40abd7bb57..5a84f52acc 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -1,771 +1,771 @@ -using System; -using System.Collections.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.Leviathan -{ - [AutoloadBossHead] - public class Leviathan : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.damage = 75; - npc.width = 850; - npc.height = 450; - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 71800 : 60000; - if (CalamityWorld.death) - { - npc.lifeMax = 150000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 7200000 : 6300000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 30, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - bossBag = mod.ItemType("LeviathanBag"); - } - - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - bool playerWet = player.wet; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int npcType = mod.NPCType("Siren"); - bool sirenAlive = false; - if (NPC.CountNPCS(npcType) > 0) - { - sirenAlive = true; - } - 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 = npc.defDefense * 2; - } - 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 ? 4f : 9f; - float num413 = sirenAlive ? 0.2f : 0.35f; - 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] += 1f; - if (!sirenAlive) - { - npc.ai[2] += 2f; - } - else - { - if (!playerWet) - { - npc.ai[2] += 0.5f; - } - if (Siren.phase2) - { - npc.ai[2] += 0.5f; - } - if (Siren.phase3) - { - npc.ai[2] += 0.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 = playerWet ? 40 : 48; - int num420 = mod.ProjectileType("LeviathanBomb"); - if (expertMode) - { - num418 = sirenAlive ? 14f : 17f; - num419 = playerWet ? 29 : 33; - } - if (npc.GetGlobalNPC(mod).enraged) - { - 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] += 1f; - npc.ai[1] += (float)(num1038 / 2); - if (revenge) - { - npc.ai[1] += 1f; - } - if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.ai[1] += 2f; - } - else - { - if (Siren.phase2 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.5f; - } - if (Siren.phase3 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.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; - return; - } - } - else if (npc.ai[0] == 2f) - { - Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; - int num1043 = 1; //2 - if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || 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.localAI[1] = 1f; - 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) - { - 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; - } - npc.localAI[1] = 0f; - 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) - { - 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; - return; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = sirenAlive ? 750 : 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) - { - npc.localAI[1] = 1f; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[1] = 0f; - 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; - return; - } - } - } - } - } - - 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 2; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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)) - { - 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(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 < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode && hardMode) - { - 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("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 (npc.localAI[0] == 0f) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); - } - } - else - { - if (npc.localAI[0] == 0f) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor); - } - } - 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; - npc.localAI[0] += 1f; - } - if (npc.localAI[0] > 1f) - { - npc.localAI[0] = 0f; - 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); - } - } +using System; +using System.Collections.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.Leviathan +{ + [AutoloadBossHead] + public class Leviathan : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Leviathan"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.npcSlots = 20f; + npc.damage = 75; + npc.width = 850; + npc.height = 450; + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 78900 : 60000; + if (CalamityWorld.death) + { + npc.lifeMax = 165000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 7600000 : 6700000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 30, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + bossBag = mod.ItemType("LeviathanBag"); + } + + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + bool playerWet = player.wet; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int npcType = mod.NPCType("Siren"); + bool sirenAlive = false; + if (NPC.CountNPCS(npcType) > 0) + { + sirenAlive = true; + } + 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 = npc.defDefense * 2; + } + 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 ? 4f : 9f; + float num413 = sirenAlive ? 0.2f : 0.35f; + 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] += 1f; + if (!sirenAlive) + { + npc.ai[2] += 2f; + } + else + { + if (!playerWet) + { + npc.ai[2] += 0.5f; + } + if (Siren.phase2) + { + npc.ai[2] += 0.5f; + } + if (Siren.phase3) + { + npc.ai[2] += 0.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 = playerWet ? 40 : 48; + int num420 = mod.ProjectileType("LeviathanBomb"); + if (expertMode) + { + num418 = sirenAlive ? 14f : 17f; + num419 = playerWet ? 29 : 33; + } + if (npc.GetGlobalNPC(mod).enraged) + { + 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] += 1f; + npc.ai[1] += (float)(num1038 / 2); + if (revenge) + { + npc.ai[1] += 1f; + } + if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.ai[1] += 2f; + } + else + { + if (Siren.phase2 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.5f; + } + if (Siren.phase3 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.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; + return; + } + } + else if (npc.ai[0] == 2f) + { + Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; + int num1043 = 1; //2 + if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || 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.localAI[1] = 1f; + 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) + { + 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; + } + npc.localAI[1] = 0f; + 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) + { + 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; + return; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = sirenAlive ? 750 : 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) + { + npc.localAI[1] = 1f; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[1] = 0f; + 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; + return; + } + } + } + } + } + + 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 2; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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)) + { + 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(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 < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode && hardMode) + { + 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("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 (npc.localAI[0] == 0f) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); + } + } + else + { + if (npc.localAI[0] == 0f) + { + CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor); + } + } + 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; + npc.localAI[0] += 1f; + } + if (npc.localAI[0] > 1f) + { + npc.localAI[0] = 0f; + 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 diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 4798b22cbd..682448bd78 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.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.Leviathan -{ - public class LeviathanStart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("???"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 0; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.value = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; - music = mod.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), 0f, 0.5f, 0.3f); - 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); - } - } - } - } +using System; +using System.Collections.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.Leviathan +{ + public class LeviathanStart : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("???"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 0; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.value = 0f; + npc.noGravity = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.rarity = 2; + music = mod.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 diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index ba3bdbc15c..ca018378af 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.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; - -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.damage = 34; - npc.width = 90; //324 - npc.height = 20; //216 - npc.defense = 9; - npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - 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 - 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 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); - } - } - } - } +using System; +using System.Collections.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.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.damage = 34; + npc.width = 90; //324 + npc.height = 20; //216 + npc.defense = 9; + npc.lifeMax = 650; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + 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 + 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 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 diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index a00af3d6fb..830491526c 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,933 +1,933 @@ -using System; -using System.Collections.Generic; -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; - -namespace CalamityMod.NPCs.Leviathan -{ - [AutoloadBossHead] - public class Siren : ModNPC - { - public static bool phase2 = false; - public static bool phase3 = false; - private bool spawnedLevi = false; - private bool secondClone = false; - private bool drawAltTexture = false; - private float phaseSwitch = 0f; - private float chargeSwitch = 0f; - private float anotherFloat = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Siren"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.damage = 60; //150 - npc.npcSlots = 16f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 25; - npc.lifeMax = CalamityWorld.revenge ? 34464 : 23800; - if (CalamityWorld.death) - { - npc.lifeMax = 48000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4000000 : 3500000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.boss = true; - npc.value = Item.buyPrice(0, 30, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); - bossBag = mod.ItemType("LeviathanBag"); - } - - 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 (npc.localAI[2] == 0f) - { - drawAltTexture = (Main.rand.Next(2) == 0); - npc.localAI[2] = 1f; - npc.netUpdate = true; - } - 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.75f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1006 = 0.333333343f; - float num1007 = 10f; - Vector2 vector = npc.Center; - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); - int npcType = mod.NPCType("Leviathan"); - bool halfLife = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool leviAlive = false; - if (NPC.CountNPCS(npcType) > 0) - { - leviAlive = true; - } - float num1000 = leviAlive ? 14f : 18f; - float num1005 = leviAlive ? 14f : 18f; - 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")); - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("Leviathan")); - spawnedLevi = true; - } - phase2 = true; - } - int defenseMult = phase2 ? 2 : 3; - if ((!leviAlive && halfLife) || CalamityWorld.death) - { - npc.defense = npc.defDefense * 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; - } - phase3 = 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; - return; - } - } - 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; - return; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.rotation = npc.velocity.X * 0.02f; - 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 = 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, 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; - return; - } - } - else if (npc.ai[0] == 2f) - { - npc.rotation = npc.velocity.X * 0.02f; - float num1065 = 6f; - float num1066 = 0.12f; - float num10662 = 0.04f; - 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 = player.position.X + (float)(player.width / 2) - vector122.X; - float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged) - { - if (npc.ai[1] % 10f == 9f) - { - flag104 = true; - } - } - else if ((!leviAlive && halfLife) || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 15f == 14f) - { - flag104 = true; - } - } - else - { - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - if (npc.ai[1] % 20f == 19f) - { - flag104 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - 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 && 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) - { - 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 (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) - { - num1065 = 14f; - num1066 = 0.15f; - num10662 = 0.05f; - vector122 = vector121; - num1067 = player.position.X + (float)(player.width / 2) - vector122.X; - num1068 = player.position.Y + (float)(player.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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662; - } - } - } - else if (num1069 > 240f) //120 - { - 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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662 * 2f; - } - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - } - 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 += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - phaseSwitch += 1f; - } - if (chargeSwitch == 0f) - { - 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 >= 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) / (leviAlive ? 13.9f : 17.8f); //14f 18f - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (leviAlive ? 13.9f : 17.8f); //14f 18f - if (!flag64) - { - anotherFloat += 1f; - if (anotherFloat == 120f) - { - npc.netUpdate = true; - } - } - else - { - anotherFloat = 0f; - } - } - else - { - chargeSwitch = 1f; - npc.ai[2] = vector126.X; - anotherFloat = vector126.Y; - npc.netUpdate = true; - } - } - else if (chargeSwitch == 1f) - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - chargeSwitch = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], 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 == 2f) - { - 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 = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - anotherFloat = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - chargeSwitch = 4f; - } - 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 == 4f) - { - npc.ai[1] -= 3f; - if (npc.ai[1] <= 0f) - { - chargeSwitch = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.95f; - } - if (phaseSwitch > 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - anotherFloat = 0f; - chargeSwitch = 0f; - phaseSwitch = 0f; - npc.netUpdate = true; - return; - } - } - 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; - return; - } - } - - 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - 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, 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); - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = (drawAltTexture ? mod.GetTexture("NPCs/Leviathan/SirenAlt") : mod.GetTexture("NPCs/Leviathan/Siren")); - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; - } - - 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] <= 1f) - { - 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() - { - bool hardMode = Main.hardMode; - int bossAlive = mod.NPCType("Leviathan"); - if (!NPC.AnyNPCs(bossAlive)) - { - 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(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 < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode && hardMode) - { - 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("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); - } - } +using System; +using System.Collections.Generic; +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; + +namespace CalamityMod.NPCs.Leviathan +{ + [AutoloadBossHead] + public class Siren : ModNPC + { + public static bool phase2 = false; + public static bool phase3 = false; + private bool spawnedLevi = false; + private bool secondClone = false; + private bool drawAltTexture = false; + private float phaseSwitch = 0f; + private float chargeSwitch = 0f; + private float anotherFloat = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Siren"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.damage = 60; //150 + npc.npcSlots = 16f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 25; + npc.lifeMax = CalamityWorld.revenge ? 36200 : 23800; + if (CalamityWorld.death) + { + npc.lifeMax = 51000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4200000 : 3700000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.boss = true; + npc.value = Item.buyPrice(0, 30, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); + bossBag = mod.ItemType("LeviathanBag"); + } + + 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 (npc.localAI[2] == 0f) + { + drawAltTexture = (Main.rand.Next(2) == 0); + npc.localAI[2] = 1f; + npc.netUpdate = true; + } + 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.75f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1006 = 0.333333343f; + float num1007 = 10f; + Vector2 vector = npc.Center; + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + int npcType = mod.NPCType("Leviathan"); + bool halfLife = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool leviAlive = false; + if (NPC.CountNPCS(npcType) > 0) + { + leviAlive = true; + } + float num1000 = leviAlive ? 14f : 18f; + float num1005 = leviAlive ? 14f : 18f; + 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")); + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("Leviathan")); + spawnedLevi = true; + } + phase2 = true; + } + int defenseMult = phase2 ? 2 : 3; + if ((!leviAlive && halfLife) || CalamityWorld.death) + { + npc.defense = npc.defDefense * 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; + } + phase3 = 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; + return; + } + } + 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; + return; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.rotation = npc.velocity.X * 0.02f; + 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 = 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, 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; + return; + } + } + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.02f; + float num1065 = 6f; + float num1066 = 0.12f; + float num10662 = 0.04f; + 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 = player.position.X + (float)(player.width / 2) - vector122.X; + float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.GetGlobalNPC(mod).enraged) + { + if (npc.ai[1] % 10f == 9f) + { + flag104 = true; + } + } + else if ((!leviAlive && halfLife) || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 15f == 14f) + { + flag104 = true; + } + } + else + { + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + if (npc.ai[1] % 20f == 19f) + { + flag104 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + 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 && 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) + { + 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 (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) + { + num1065 = 14f; + num1066 = 0.15f; + num10662 = 0.05f; + vector122 = vector121; + num1067 = player.position.X + (float)(player.width / 2) - vector122.X; + num1068 = player.position.Y + (float)(player.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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662; + } + } + } + else if (num1069 > 240f) //120 + { + 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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662 * 2f; + } + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + } + 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 += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + phaseSwitch += 1f; + } + if (chargeSwitch == 0f) + { + 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 >= 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) / (leviAlive ? 13.9f : 17.8f); //14f 18f + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (leviAlive ? 13.9f : 17.8f); //14f 18f + if (!flag64) + { + anotherFloat += 1f; + if (anotherFloat == 120f) + { + npc.netUpdate = true; + } + } + else + { + anotherFloat = 0f; + } + } + else + { + chargeSwitch = 1f; + npc.ai[2] = vector126.X; + anotherFloat = vector126.Y; + npc.netUpdate = true; + } + } + else if (chargeSwitch == 1f) + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + chargeSwitch = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], 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 == 2f) + { + 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 = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + anotherFloat = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + chargeSwitch = 4f; + } + 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 == 4f) + { + npc.ai[1] -= 3f; + if (npc.ai[1] <= 0f) + { + chargeSwitch = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.95f; + } + if (phaseSwitch > 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + anotherFloat = 0f; + chargeSwitch = 0f; + phaseSwitch = 0f; + npc.netUpdate = true; + return; + } + } + 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; + return; + } + } + + 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + 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, 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); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = (drawAltTexture ? mod.GetTexture("NPCs/Leviathan/SirenAlt") : mod.GetTexture("NPCs/Leviathan/Siren")); + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + return false; + } + + 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] <= 1f) + { + 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() + { + bool hardMode = Main.hardMode; + int bossAlive = mod.NPCType("Leviathan"); + if (!NPC.AnyNPCs(bossAlive)) + { + 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(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 < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode && hardMode) + { + 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("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 diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs index 11d8914386..a2a01430fc 100644 --- a/NPCs/Leviathan/SirenClone.cs +++ b/NPCs/Leviathan/SirenClone.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; - -namespace CalamityMod.NPCs.Leviathan -{ - public class SirenClone : ModNPC - { - public int timer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Clone"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 0; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 0); - 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 (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 *= (CalamityWorld.death ? 15f : 11f); //9 - timer++; - if (timer > (CalamityWorld.death ? 30 : 60)) - { - if (Main.netMode != 1) - { - int type = mod.ProjectileType("WaterSpear"); - switch (Main.rand.Next(6)) - { - case 0: type = mod.ProjectileType("FrostMist"); break; - case 1: - case 2: - case 3: - case 4: - case 5: type = mod.ProjectileType("WaterSpear"); break; - } - int damage = Main.expertMode ? 35 : 48; - Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, type, damage, 1f, npc.target); - } - timer = 0; - } - if (NPC.CountNPCS(mod.NPCType("Siren")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return; - } - } - - 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); - } - } - } - } +using System; +using System.Collections.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.Leviathan +{ + public class SirenClone : ModNPC + { + public int timer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Clone"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 0; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 0); + 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 (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 *= (CalamityWorld.death ? 15f : 11f); //9 + timer++; + if (timer > (CalamityWorld.death ? 30 : 60)) + { + if (Main.netMode != 1) + { + int type = mod.ProjectileType("WaterSpear"); + switch (Main.rand.Next(6)) + { + case 0: type = mod.ProjectileType("FrostMist"); break; + case 1: + case 2: + case 3: + case 4: + case 5: type = mod.ProjectileType("WaterSpear"); break; + } + int damage = Main.expertMode ? 35 : 48; + Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, type, damage, 1f, npc.target); + } + timer = 0; + } + if (NPC.CountNPCS(mod.NPCType("Siren")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return; + } + } + + 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 diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index a7fe492323..07705d8c26 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -1,104 +1,104 @@ -using System; -using System.Collections.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.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 = 30; - npc.width = 160; //324 - npc.height = 160; //216 - npc.defense = 10; - npc.lifeMax = 500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 300000; - } - 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]; - if (npc.type == mod.NPCType("SirenIce")) - { - 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) ? -30f : 30f); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - 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; - return; - } - } - - 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 void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 150, 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); - } - } - } - } +using System; +using System.Collections.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.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 = 30; + npc.width = 160; //324 + npc.height = 160; //216 + 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]; + if (npc.type == mod.NPCType("SirenIce")) + { + 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) ? -30f : 30f); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + 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; + return; + } + } + + 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 void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 150, 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 diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 3e5d02f884..e564eea0c4 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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 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, 3, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 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, 3, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index e5d5e55d1a..3ad830b50b 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; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class AngryDog : ModNPC - { - public 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, 8, 0); - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); - npc.DeathSound = SoundID.NPCDeath5; - } - - 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.type == 155) - { - if (npc.velocity.Y == 0f && num40 < 100f && Math.Abs(npc.velocity.X) > 3f && ((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) && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - } - } - 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.type == 155) - { - if (npc.velocity.X > 0f && npc.direction < 0) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.velocity.X < 0f && npc.direction > 0) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - } - 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.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, 80, 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)); - } - } - } +using System; +using System.Collections.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 AngryDog : ModNPC + { + public 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, 8, 0); + npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); + npc.DeathSound = SoundID.NPCDeath5; + } + + 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.type == 155) + { + if (npc.velocity.Y == 0f && num40 < 100f && Math.Abs(npc.velocity.X) > 3f && ((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) && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + } + } + 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.type == 155) + { + if (npc.velocity.X > 0f && npc.direction < 0) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.velocity.X < 0f && npc.direction > 0) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + } + 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.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, 80, 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)); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index fc1e8bc55c..cd64492fd6 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.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 ArmoredDiggerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } - - public override void SetDefaults() - { - npc.damage = 40; - npc.width = 38; //324 - npc.height = 38; //216 - npc.defense = 40; - npc.lifeMax = 2000; - npc.knockBackResist = 0f; - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - 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 OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Chilled, 200, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - else - { - player.AddBuff(BuffID.Chilled, 100, true); - player.AddBuff(BuffID.Electrified, 60, true); - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } +using System; +using System.Collections.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 = 40; + npc.width = 38; //324 + npc.height = 38; //216 + npc.defense = 40; + npc.lifeMax = 2000; + npc.knockBackResist = 0f; + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + 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 OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Chilled, 200, true); + player.AddBuff(BuffID.Electrified, 120, true); + } + else + { + player.AddBuff(BuffID.Chilled, 100, true); + player.AddBuff(BuffID.Electrified, 60, true); + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 91bdd0bb5c..0ac28e62e9 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.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; - -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 = 50; - npc.npcSlots = 5f; - npc.width = 54; //324 - npc.height = 54; //216 - npc.defense = 15; - npc.lifeMax = 2000; - npc.knockBackResist = 0f; - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - } - - public override void AI() - { - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < 9; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < 8) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("ArmoredDiggerBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("ArmoredDiggerTail"), 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; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.02f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Chilled, 200, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - else - { - player.AddBuff(BuffID.Chilled, 100, true); - player.AddBuff(BuffID.Electrified, 60, true); - } - } - - 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 void NPCLoot() - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(3, 6)); - } - } - } +using System; +using System.Collections.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 = 50; + npc.npcSlots = 5f; + npc.width = 54; //324 + npc.height = 54; //216 + npc.defense = 15; + npc.lifeMax = 2000; + npc.knockBackResist = 0f; + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + } + + public override void AI() + { + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < 9; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < 8) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("ArmoredDiggerBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("ArmoredDiggerTail"), 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; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.02f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Chilled, 200, true); + player.AddBuff(BuffID.Electrified, 120, true); + } + else + { + player.AddBuff(BuffID.Chilled, 100, true); + player.AddBuff(BuffID.Electrified, 60, true); + } + } + + 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 void NPCLoot() + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(3, 6)); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 93c944dc7f..5a902b5b4b 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.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 ArmoredDiggerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 38; //324 - npc.height = 38; //216 - npc.defense = 55; - npc.lifeMax = 2000; - npc.knockBackResist = 0f; - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.Item4; - npc.DeathSound = SoundID.Item14; - 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 OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Chilled, 200, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - else - { - player.AddBuff(BuffID.Chilled, 100, true); - player.AddBuff(BuffID.Electrified, 60, 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); - } - } - } +using System; +using System.Collections.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 = 20; + npc.width = 38; //324 + npc.height = 38; //216 + npc.defense = 55; + npc.lifeMax = 2000; + npc.knockBackResist = 0f; + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.Item4; + npc.DeathSound = SoundID.Item14; + 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 OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Chilled, 200, true); + player.AddBuff(BuffID.Electrified, 120, true); + } + else + { + player.AddBuff(BuffID.Chilled, 100, true); + player.AddBuff(BuffID.Electrified, 60, 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index 3c42e0c6f8..9eccf0e677 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.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.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; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Weak, 100, true); - } - else - { - player.AddBuff(BuffID.Weak, 60, 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")); - } - } - } +using System; +using System.Collections.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; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Weak, 100, true); + } + else + { + player.AddBuff(BuffID.Weak, 60, 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 diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index b82bd9e496..324f4ec13f 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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 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, 3, 0, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 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, 3, 0, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index fbd135db4c..392e987abe 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,351 +1,351 @@ -using System; -using System.Collections.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 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, 3, 0, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath35; - npc.behindTiles = true; - } - - 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")); - } - } - } +using System; +using System.Collections.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 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, 3, 0, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath35; + npc.behindTiles = true; + } + + 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 diff --git a/NPCs/NormalNPCs/CalamityEye.cs b/NPCs/NormalNPCs/CalamityEye.cs index c47fbe7d20..6a1adb02db 100644 --- a/NPCs/NormalNPCs/CalamityEye.cs +++ b/NPCs/NormalNPCs/CalamityEye.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.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.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, 9, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Weak, 200, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 100, true); - } - else - { - player.AddBuff(BuffID.Weak, 60, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 50, true); - } - } - - 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("CalamityDust")); - } - if (Main.rand.Next(3) == 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); - } - } - } +using System; +using System.Collections.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.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, 9, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Weak, 200, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 100, true); + } + else + { + player.AddBuff(BuffID.Weak, 60, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 50, true); + } + } + + 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("CalamityDust")); + } + if (Main.rand.Next(3) == 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 diff --git a/NPCs/NormalNPCs/ChaosSlime.cs b/NPCs/NormalNPCs/ChaosSlime.cs index be5d1e62fb..3d979647b6 100644 --- a/NPCs/NormalNPCs/ChaosSlime.cs +++ b/NPCs/NormalNPCs/ChaosSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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 ChaosSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos 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 = 25; - npc.lifeMax = 300; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.alpha = 50; - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss) - { - 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, mod.DustType("DWSparkle"), 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("DWSparkle"), 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("ChaoticOre"), Main.rand.Next(10, 27)); - } - } +using System; +using System.Collections.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 ChaosSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos 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 = 25; + npc.lifeMax = 300; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 40, 0); + npc.alpha = 50; + npc.lavaImmune = true; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss) + { + 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, mod.DustType("DWSparkle"), 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("DWSparkle"), 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("ChaoticOre"), Main.rand.Next(10, 27)); + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/CharredSlime.cs b/NPCs/NormalNPCs/CharredSlime.cs index 973a202170..ff86633979 100644 --- a/NPCs/NormalNPCs/CharredSlime.cs +++ b/NPCs/NormalNPCs/CharredSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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, 15, 0); - npc.alpha = 50; - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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)); - } - } +using System; +using System.Collections.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, 15, 0); + npc.alpha = 50; + npc.lavaImmune = true; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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 diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 1f6ac236be..1935c49dab 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -1,325 +1,325 @@ -using System; -using System.Collections.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 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, 50, 0); - npc.HitSound = SoundID.NPCHit12; - npc.DeathSound = SoundID.NPCDeath18; - npc.rarity = 2; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - 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) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); - } - } - } +using System; +using System.Collections.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 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, 50, 0); + npc.HitSound = SoundID.NPCHit12; + npc.DeathSound = SoundID.NPCDeath18; + npc.rarity = 2; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + 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) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 7edd908cf2..f05cc08de5 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,112 +1,112 @@ -using System; -using System.Collections.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 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, 9, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath6; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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"), 150, true); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Confused, 200, true); - } - else - { - player.AddBuff(BuffID.Confused, 60, 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); - } - } - } - } +using System; +using System.Collections.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 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, 9, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath6; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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"), 150, true); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Confused, 200, true); + } + else + { + player.AddBuff(BuffID.Confused, 60, 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 diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 99493b1017..eec917b691 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amber Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 25; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 18; - npc.lifeMax = 60; - npc.knockBackResist = 0.3f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amber Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 25; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 18; + npc.lifeMax = 60; + npc.knockBackResist = 0.3f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 68ba5ad9e5..4d5408903f 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amethyst Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 15; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 8; - npc.lifeMax = 40; - npc.knockBackResist = 0.75f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amethyst Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 15; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 8; + npc.lifeMax = 40; + npc.knockBackResist = 0.75f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 11caf352ac..d78b547600 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.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 CrawlerCrystal : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 35; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 18; - npc.lifeMax = 200; - npc.knockBackResist = 0.15f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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")); - } - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 35; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 18; + npc.lifeMax = 200; + npc.knockBackResist = 0.15f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 4083cb200b..b78aab0464 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Diamond Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 24; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 16; - npc.lifeMax = 100; - npc.knockBackResist = 0.35f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Diamond Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 24; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 16; + npc.lifeMax = 100; + npc.knockBackResist = 0.35f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index a52479d6cf..6c898fa970 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Emerald Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 20; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 12; - npc.lifeMax = 70; - npc.knockBackResist = 0.55f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Emerald Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 20; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 12; + npc.lifeMax = 70; + npc.knockBackResist = 0.55f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 0, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 2491e532b5..d5c59ea92e 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruby Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 23; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 14; - npc.lifeMax = 90; - npc.knockBackResist = 0.45f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 2, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruby Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 23; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 14; + npc.lifeMax = 90; + npc.knockBackResist = 0.45f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 2, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 77900c6f98..f9dc3396d0 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sapphire Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 18; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 10; - npc.lifeMax = 60; - npc.knockBackResist = 0.65f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 0, 45); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sapphire Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 18; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 10; + npc.lifeMax = 60; + npc.knockBackResist = 0.65f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 0, 45); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index a71ec8dbd5..8d52fbae64 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.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 - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Topaz Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = 3; - npc.damage = 12; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 6; - npc.lifeMax = 30; - npc.knockBackResist = 0.85f; - animationType = 257; - aiType = NPCID.AnomuraFungus; - npc.value = Item.buyPrice(0, 0, 0, 10); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath36; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Topaz Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = 3; + npc.damage = 12; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 6; + npc.lifeMax = 30; + npc.knockBackResist = 0.85f; + animationType = 257; + aiType = NPCID.AnomuraFungus; + npc.value = Item.buyPrice(0, 0, 0, 10); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath36; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 6f2e28ca54..390b9b5c08 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.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 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, 5, 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; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.ManaSickness, 100, true); - player.AddBuff(BuffID.Confused, 60, true); - } - else - { - player.AddBuff(BuffID.ManaSickness, 60, true); - player.AddBuff(BuffID.Confused, 60, 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)); - } - } +using System; +using System.Collections.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, 5, 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; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.ManaSickness, 100, true); + player.AddBuff(BuffID.Confused, 60, true); + } + else + { + player.AddBuff(BuffID.ManaSickness, 60, true); + player.AddBuff(BuffID.Confused, 60, 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 diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 1c458fabec..8cd6cad49f 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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 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, 6, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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 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, 6, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 98962d8b16..a2cc1766be 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.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; - -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, 8, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - } - - 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, 27); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 92, 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.spriteDirection = -npc.direction; - } - - public override void FindFrame(int frameHeight) - { - if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) - { - npc.frame.Y = frameHeight * 7; - 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 * 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 && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.Next(3) == 0) - { - player.AddBuff(mod.BuffType("GlacialState"), 30, true); - } - } - else - { - player.AddBuff(BuffID.Frostburn, 160, 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")); - } - } +using System; +using System.Collections.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, 8, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + } + + 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, 27); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 92, 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.spriteDirection = -npc.direction; + } + + public override void FindFrame(int frameHeight) + { + if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) + { + npc.frame.Y = frameHeight * 7; + 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 * 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 && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 300, true); + if (Main.rand.Next(3) == 0) + { + player.AddBuff(mod.BuffType("GlacialState"), 30, true); + } + } + else + { + player.AddBuff(BuffID.Frostburn, 160, 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")); + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index b7fc4215da..64ed0eb8c7 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.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 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, 5, 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; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.ManaSickness, 100, true); - player.AddBuff(BuffID.Weak, 260, true); - } - else - { - player.AddBuff(BuffID.ManaSickness, 80, true); - player.AddBuff(BuffID.Weak, 200, 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)); - } - } +using System; +using System.Collections.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, 5, 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; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.ManaSickness, 100, true); + player.AddBuff(BuffID.Weak, 260, true); + } + else + { + player.AddBuff(BuffID.ManaSickness, 80, true); + player.AddBuff(BuffID.Weak, 200, 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 diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 2099a4669e..5c2a1ad2d9 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,328 +1,328 @@ -using System; -using System.Collections.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 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, 2, 0, 0); - npc.alpha = 50; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath59; - npc.timeLeft = NPC.activeTime * 2; - } - - 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; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) - { - return 0.1f; - } - 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)); - } - } - } - } +using System; +using System.Collections.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 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, 2, 0, 0); + npc.alpha = 50; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath59; + npc.timeLeft = NPC.activeTime * 2; + } + + 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; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) + { + return 0.1f; + } + 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 diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/NormalNPCs/HeatSpirit.cs index 93fd7ffe10..89f8e31c73 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/NormalNPCs/HeatSpirit.cs @@ -1,112 +1,112 @@ -using System; -using System.Collections.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, 5, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.OnFire, 180, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 80, true); - } - else - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 40, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - } +using System; +using System.Collections.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, 5, 0); + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.OnFire, 180, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 80, true); + } + else + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 40, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 12700fc726..e7ee138862 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,230 +1,230 @@ -using System; -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 - { - int chargetimer = 0; - int basespeed = 1; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth Elemental"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 50; - npc.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.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 2, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.rarity = 2; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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; - - } - } +using System; +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 + { + int chargetimer = 0; + int basespeed = 1; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth Elemental"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 50; + npc.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.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 2, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.rarity = 2; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index eb8032f988..97afb75cde 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.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.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, 50, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.coldDamage = true; - npc.rarity = 2; - } - - 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 && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.Next(3) == 0) - { - player.AddBuff(mod.BuffType("GlacialState"), 30, true); - } - } - else - { - player.AddBuff(BuffID.Frostburn, 160, 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"), Main.rand.Next(2, 4)); - 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")); - } - } - } +using System; +using System.Collections.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 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, 50, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.coldDamage = true; + npc.rarity = 2; + } + + 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 && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 300, true); + if (Main.rand.Next(3) == 0) + { + player.AddBuff(mod.BuffType("GlacialState"), 30, true); + } + } + else + { + player.AddBuff(BuffID.Frostburn, 160, 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"), Main.rand.Next(2, 4)); + 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 diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index bf23aa1da7..bd7841705c 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.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; - -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.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.value = Item.buyPrice(0, 5, 0, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0.2f; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.OnFire, 300, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } - else - { - player.AddBuff(BuffID.OnFire, 150, true); - player.AddBuff(mod.BuffType("HolyLight"), 60, 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); - } - } - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 5, 0, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.knockBackResist = 0.2f; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.OnFire, 300, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } + else + { + player.AddBuff(BuffID.OnFire, 150, true); + player.AddBuff(mod.BuffType("HolyLight"), 60, 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 diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs index 468ff5c6e9..1fb601664b 100644 --- a/NPCs/NormalNPCs/IrradiatedSlime.cs +++ b/NPCs/NormalNPCs/IrradiatedSlime.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 IrradiatedSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Irradiated Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 500; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 100; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || !Main.raining) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * 0.15f; - } - - 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); - } - } - } - - 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")); - } - } - } +using System; +using System.Collections.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 = 500; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 100; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord || !Main.raining) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * 0.15f; + } + + 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); + } + } + } + + 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 diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index d595900d6d..763892738f 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.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; - -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, 4, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath2; - } - - 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) - { - 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")); - } - } - } +using System; +using System.Collections.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 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, 4, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath2; + } + + 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) + { + 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 diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 2a0a6964d2..d4ddecc597 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.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, 12, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - 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)); - } - } +using System; +using System.Collections.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, 12, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + 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 diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index 4d439208f3..10e231f8af 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -1,129 +1,129 @@ -using System; -using System.Collections.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 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, 4, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath36; - } - - 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) - { - 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")); - } - } - } +using System; +using System.Collections.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 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, 4, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath36; + } + + 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) + { + 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 diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 2e5f14f2e4..f7306ff57d 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.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 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, 5, 0, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - } - - 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")); - } - } +using System; +using System.Collections.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 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, 5, 0, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + } + + 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 diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 8051c80458..a42a2ac9a3 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -1,150 +1,150 @@ -using System; -using System.Collections.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 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, 5, 0, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = 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() - { - 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 = 299; - 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)); - } - } +using System; +using System.Collections.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 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, 5, 0, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = 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() + { + 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 = 299; + 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 diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 97e1a5a97f..ca505f7edd 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.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 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, 5, 0, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = 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() - { - 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)); - } - } +using System; +using System.Collections.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 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, 5, 0, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = 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() + { + 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 diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 95c8f4fd2f..66fb0e4ce9 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.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; -using CalamityMod.Projectiles; - -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, 5, 0, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = 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() - { - 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)); - } - } +using System; +using System.Collections.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 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, 5, 0, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = 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() + { + 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 diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index f90b703feb..fc157f2bd4 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.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; - -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, 4, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 300, true); - } - else - { - player.AddBuff(BuffID.Bleeding, 160, 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); - } - } - } - } +using System; +using System.Collections.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, 4, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 300, true); + } + else + { + player.AddBuff(BuffID.Bleeding, 160, 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 diff --git a/NPCs/NormalNPCs/Pitbull.png b/NPCs/NormalNPCs/Pitbull.png index 9db2e197cd..f8f42b55d3 100644 Binary files a/NPCs/NormalNPCs/Pitbull.png and b/NPCs/NormalNPCs/Pitbull.png differ diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index 34193f5f99..ebf4fb5663 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.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, 8, 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; - } - - 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) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(mod.BuffType("Plague"), 280, true); - } - else - { - player.AddBuff(mod.BuffType("Plague"), 260, 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); - } - } - } - } +using System; +using System.Collections.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, 8, 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; + } + + 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) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(mod.BuffType("Plague"), 280, true); + } + else + { + player.AddBuff(mod.BuffType("Plague"), 260, 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 diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index 510553ebdd..af739ec331 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.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; - } - - 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) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } - else - { - player.AddBuff(mod.BuffType("Plague"), 280, 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); - } - } - } - } +using System; +using System.Collections.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; + } + + 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) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + } + else + { + player.AddBuff(mod.BuffType("Plague"), 280, 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 diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index a7136c585c..8cee41d604 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -1,181 +1,181 @@ -using System; -using System.Collections.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"); - } - - 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; - } - - 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) - { - 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)); - } - } +using System; +using System.Collections.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"); + } + + 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; + } + + 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) + { + 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 diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs index a10eb5af45..af84283a3c 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.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; - -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; - } - - /*public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - }*/ - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.09f; - } - - 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 < 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)); - } - } +using System; +using System.Collections.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; + } + + /*public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + }*/ + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.09f; + } + + 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 < 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 diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index d97a7f0a85..c3731fbbfd 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -1,143 +1,143 @@ -using System; -using System.Collections.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, 0, 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; - } - - 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) - { - 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"), 180, 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.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, 0, 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; + } + + 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) + { + 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"), 180, true); + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs index 061623275b..7e5171fa68 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/NormalNPCs/PlaguedTortoise.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.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, 35, 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; - } - - 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) - { - 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)); - } - } +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, 35, 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; + } + + 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) + { + 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 diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 7815d1e523..7e81cfbfd3 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.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; - -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, 10, 0); - npc.lavaImmune = true; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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(mod.NPCType("ProfanedEnergyBody"))) - { - 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() - { - CalamityGlobalNPC.energyFlame = -1; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); - } - } +using System; +using System.Collections.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, 10, 0); + npc.lavaImmune = true; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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(mod.NPCType("ProfanedEnergyBody"))) + { + 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() + { + CalamityGlobalNPC.energyFlame = -1; + 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 diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 942bd54e68..4d347d5361 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,238 +1,238 @@ -using System; -using System.Collections.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.value = Item.buyPrice(0, 0, 10, 0); - 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) - { - 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; - 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 bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (CalamityGlobalNPC.energyFlame > 0) - { - 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); - } - } - } - } +using System; +using System.Collections.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.value = Item.buyPrice(0, 0, 10, 0); + 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) + { + 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; + 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 bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (CalamityGlobalNPC.energyFlame > 0) + { + 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 diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 52622520da..8e72a8065f 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.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.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 = 90; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 34; - npc.scale = 1.25f; - npc.lifeMax = 490; - npc.knockBackResist = 0.2f; - animationType = 153; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = 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); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.05f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(mod.BuffType("HolyLight"), 60, 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("EssenceofCinder")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); - } - } - } +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 = 90; + npc.aiStyle = 39; + npc.width = 46; + npc.height = 32; + npc.defense = 34; + npc.scale = 1.25f; + npc.lifeMax = 490; + npc.knockBackResist = 0.2f; + animationType = 153; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.noGravity = 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); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.05f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(mod.BuffType("HolyLight"), 60, 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("EssenceofCinder")); + } + 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 diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index d8b0b4bbfa..2bc0457b4c 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -1,182 +1,182 @@ -using System; -using System.Collections.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.lavaImmune = true; - npc.value = Item.buyPrice(0, 10, 0, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath26; - } - - 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); - } - } - } - - 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)); - } - } +using System; +using System.Collections.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.lavaImmune = true; + npc.value = Item.buyPrice(0, 10, 0, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath26; + } + + 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); + } + } + } + + 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 diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 973d7b68ef..b1fac39fe8 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -1,591 +1,591 @@ -using System; -using System.Collections.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, 1, 0, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Electrified, 200, true); - } - else - { - 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(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - } +using System; +using System.Collections.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, 1, 0, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Electrified, 200, true); + } + else + { + 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(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 2f774caf87..e59a9bad56 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.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.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, 9, 0); - npc.HitSound = SoundID.NPCHit31; - npc.DeathSound = SoundID.NPCDeath34; - } - - 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) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.15f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Electrified, 60, 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")); - } - } - } +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, 9, 0); + npc.HitSound = SoundID.NPCHit31; + npc.DeathSound = SoundID.NPCDeath34; + } + + 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) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.15f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Electrified, 60, 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 diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 6c62e110a1..5b3d31d615 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.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.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, 10, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - } - - 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) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.OnFire, 300, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } - else - { - player.AddBuff(BuffID.OnFire, 150, true); - player.AddBuff(mod.BuffType("HolyLight"), 60, 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(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - } +using System; +using System.Collections.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.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, 10, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath4; + } + + 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) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.OnFire, 300, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } + else + { + player.AddBuff(BuffID.OnFire, 150, true); + player.AddBuff(mod.BuffType("HolyLight"), 60, 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(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 8cd31ce10e..c05907a9d0 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.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; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Sunskater : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunskater"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = 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, 20, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCDeath/Sunskater"); - npc.knockBackResist = 0.7f; - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.OnFire, 300, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } - else - { - player.AddBuff(BuffID.OnFire, 150, true); - player.AddBuff(mod.BuffType("HolyLight"), 60, true); - } - } - - public override void NPCLoot() - { - if (Main.hardMode) - { - 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); - } - } - } - } +using System; +using System.Collections.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 + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunskater"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = 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, 20, 0); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); + npc.knockBackResist = 0.7f; + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.OnFire, 300, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } + else + { + player.AddBuff(BuffID.OnFire, 150, true); + player.AddBuff(mod.BuffType("HolyLight"), 60, true); + } + } + + public override void NPCLoot() + { + if (Main.hardMode) + { + 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 diff --git a/NPCs/NormalNPCs/SuperDummy.cs b/NPCs/NormalNPCs/SuperDummy.cs index dcc632b923..aa5ab55f97 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 b13ef48d7e..de911f0644 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -1,450 +1,450 @@ -using System; -using System.Collections.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 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; - npc.knockBackResist = 0.05f; - npc.value = Item.buyPrice(0, 2, 0, 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; - } - - 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() - { - 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")); - } - } - } +using System; +using System.Collections.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 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; + npc.knockBackResist = 0.05f; + npc.value = Item.buyPrice(0, 2, 0, 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; + } + + 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() + { + 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 diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 498871b5a0..344e2ba53a 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.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.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, 3, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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 || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * 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")); - } - } - } +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, 3, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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 || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * 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 diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index b661ab689d..703d26f365 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.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; - -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, 1, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * 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")); - } - } - } +using System; +using System.Collections.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, 1, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * 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 diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 7db5d6b605..7c8afeda49 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -1,155 +1,155 @@ -using System; -using System.Collections.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 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 = 3500; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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() - { - 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); - } - } - } - - 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); - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 100, 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.Projectiles; + +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 = 3500; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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() + { + 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); + } + } + } + + 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); + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 1ab6b3b50b..4729f2d0ca 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.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.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 = 3000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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() - { - 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); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - } +using System; +using System.Collections.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 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 = 3000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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() + { + 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); + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index f42a3165b1..6244a9f01e 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.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.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 = 2000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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() - { - 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); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - } +using System; +using System.Collections.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 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 = 2000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 800000 : 600000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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() + { + 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); + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 2f12a63716..6fbd148811 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.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.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.value = Item.buyPrice(0, 0, 0, 0); - 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.2f); - } - - 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")); - } - } - } - } +using System; +using System.Collections.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.value = Item.buyPrice(0, 0, 0, 0); + 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.2f); + } + + 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 diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 823c0443ca..a9545f71f5 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.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; - -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 = 3500; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 0); - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - } - - 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) - { - 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); - } - } - } - - 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"), 240, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 200, true); - } - 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod; + +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 = 3500; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 0); + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + } + + 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) + { + 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); + } + } + } + + 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"), 240, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 200, true); + } + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index c0269caad9..8e32a6e274 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; - -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 = 3000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 0); - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - } - - 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) - { - 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); - } - } - } - - 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"), 200, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 160, true); - } - 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +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 = 3000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 0); + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + } + + 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) + { + 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); + } + } + } + + 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"), 200, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 160, true); + } + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index fad57a8acb..9941f439ed 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.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; - -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 = 2000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 0); - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - } - - 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) - { - 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); - } - } - } - - 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"), 120, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 120, true); - } - 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.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +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 = 2000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 800000 : 600000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 0); + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + } + + 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 || !NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) + { + 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); + } + } + } + + 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"), 120, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 120, true); + } + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index ee255cf64a..fb78e8675d 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,415 +1,415 @@ -using System; -using System.Collections.Generic; -using 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.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 ? 3594 : 2500; - if (CalamityWorld.death) - { - npc.lifeMax = 5031; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3000000 : 2400000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - bossBag = mod.ItemType("PerforatorBag"); - } - - 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), 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), 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - 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), 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; - } - 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 ? 12 : 16; - 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); - } - } - } - if (npc.ai[0] == 0f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles - float num1066 = 0.12f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles - float num10662 = 0.04f; - 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 = player.position.X + (float)(player.width / 2) - vector122.X; - float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) - { - num1065 = 14f; //changed from 14 not a prob - num1066 = 0.15f; //changed from 0.1 not a prob - num10662 = 0.05f; - vector122 = vector121; - num1067 = player.position.X + (float)(player.width / 2) - vector122.X; - num1068 = player.position.Y + (float)(player.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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662; - } - } - } - 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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662 * 2f; - } - } - } - } - 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 < 10; 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) - { - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using 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.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 ? 3594 : 2500; + if (CalamityWorld.death) + { + npc.lifeMax = 5031; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3000000 : 2400000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath19; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + bossBag = mod.ItemType("PerforatorBag"); + } + + 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), 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), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + 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), 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; + } + 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 ? 12 : 16; + 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); + } + } + } + if (npc.ai[0] == 0f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles + float num1066 = 0.12f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles + float num10662 = 0.04f; + 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 = player.position.X + (float)(player.width / 2) - vector122.X; + float num1068 = player.position.Y + (float)(player.height / 2) - 300f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, player.position, player.width, player.height)) + { + num1065 = 14f; //changed from 14 not a prob + num1066 = 0.15f; //changed from 0.1 not a prob + num10662 = 0.05f; + vector122 = vector121; + num1067 = player.position.X + (float)(player.width / 2) - vector122.X; + num1068 = player.position.Y + (float)(player.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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662; + } + } + } + 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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662 * 2f; + } + } + } + } + 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 < 10; 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) + { + 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 diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index accdf916d5..37519abc78 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -1,111 +1,111 @@ -using System; -using System.Collections.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 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 = 3500; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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; - } - 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); - } - } - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 100, 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.Projectiles; + +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 = 3500; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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; + } + 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); + } + } + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 38699bb686..033ea8d5d8 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,111 +1,111 @@ -using System; -using System.Collections.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 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 = 3000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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; - } - 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); - } - } - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 80, 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.Projectiles; + +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 = 3000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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; + } + 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); + } + } + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 80, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 6769ac49c3..65f9ea9050 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -1,112 +1,112 @@ -using System; -using System.Collections.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 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 = 2000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - npc.behindTiles = true; - npc.noGravity = true; - 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; - } - 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); - } - } - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Bleeding, 60, 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.Projectiles; + +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 = 2000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 800000 : 600000; + } + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + npc.behindTiles = true; + npc.noGravity = true; + 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; + } + 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); + } + } + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Bleeding, 60, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs index e811384a72..16048e6665 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(); - } - } +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 diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index c82783b12d..4dfc927545 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; - } - } +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 diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index 3f9de08a80..2577d04cda 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.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; - -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.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 ? 9f : 8f; - float num2 = revenge ? 0.25f : 0.2f; - 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"), 60, 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); - } - } - } - } +using System; +using System.Collections.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.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.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 ? 9f : 8f; + float num2 = revenge ? 0.25f : 0.2f; + 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"), 60, 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 diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index 21c2c8060c..bf8ebf9793 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.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; - -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.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 ? 24f : 22f; - 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"), 80, 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); - } - } - } - } +using System; +using System.Collections.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.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.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 ? 24f : 22f; + 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"), 80, 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 diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index becb86b795..ef82cd5731 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.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; - -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 = 1000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - 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 + 4.2f); //4f - } - 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"), 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); - } - } - } - } +using System; +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.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 = 1000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + 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 + 4.2f); //4f + } + 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"), 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 diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 4123c2b3c5..336650eb4c 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,151 +1,151 @@ -using System; -using System.Collections.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.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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - 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] >= 600f ? 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; - } - } +using System; +using System.Collections.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.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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + 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] >= 600f ? 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 diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 32dd1d6c9a..a4e3be7ad0 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,1208 +1,1208 @@ -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; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - [AutoloadBossHead] - public class PlaguebringerGoliath : ModNPC - { - private const int MissileProjectiles = 5; - private const float MissileAngleSpread = 90; - private int MissileCountdown = 0; - private bool halfLife = false; - private int despawnTimer = 600; - private bool canDespawn = false; - private float chargeDistance = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 90; //150 - npc.npcSlots = 64f; - npc.width = 198; //324 - npc.height = 198; //216 - npc.defense = 55; - npc.lifeMax = CalamityWorld.revenge ? 70875 : 58500; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 6900000 : 6300000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.boss = true; - npc.value = Item.buyPrice(0, 25, 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("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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); - bossBag = mod.ItemType("PlaguebringerGoliathBag"); - } - - 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 num1041 = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.defDamage - num1041; - 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 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 = 0f; break; - case 1: chargeDistance = 400f; break; - case 2: chargeDistance = -400f; break; - } - } - npc.ai[0] = (float)num596; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - 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); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - chargeDistance)) < 20f) - { - switch (Main.rand.Next(3)) - { - case 0: chargeDistance = 0f; break; - case 1: chargeDistance = 400f; break; - case 2: chargeDistance = -400f; break; - } - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = revenge ? 28f : 26f; //16 - 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) - { - 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 = 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) - { - 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) - 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.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 not a prob - if (npc.GetGlobalNPC(mod).enraged) - { - num1050 = 200; - } - else if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1050 = 250; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num1050 = revenge ? 300 : 350; //300 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1050 = revenge ? 350 : 375; //450 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num1050 = 400; //500 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num1050 = 450; //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) - { - npc.localAI[0] = 1f; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - 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; - return; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - float num1053 = 12f; //12 found one! dictates speed during bee spawn - float num1054 = 0.2f; //0.1 found one! dictates speed during bee spawn - 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; - return; - } - } - 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; - 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); - if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; //0.25 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; //0.25 not a prob - } - bool flag103 = false; - 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(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")) < 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")) < 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; - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 5f) - { - 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 ((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")) < 4) - { - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 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")) < 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; - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 3f) - { - float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles - float num1066 = 0.15f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles - float num10662 = 0.05f; - 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) - 360f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged) - { - if (npc.ai[1] % 10f == 9f) - { - flag104 = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - 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 ? 7f : 6f; - if (jungleEnrage || npc.GetGlobalNPC(mod).enraged) - { - 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 = mod.ProjectileType("PlagueStingerGoliathV2"); //projectile type - if (expertMode) - { - if (Main.rand.Next(2) == 0) - { - num1075 = mod.ProjectileType("PlagueStingerGoliath"); - } - num1074 = 28; - if (npc.life >= (npc.lifeMax * 0.75f)) - { - if (Main.rand.Next(13) == 0) - { - num1074 = 36; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - else if (npc.life < (npc.lifeMax * 0.75f) && npc.life >= (npc.lifeMax * 0.5f)) - { - if (Main.rand.Next(9) == 0) - { - num1074 = 38; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - else - { - num1074 = 30; - } - } - else if (npc.life < (npc.lifeMax * 0.5f) && npc.life >= (npc.lifeMax * 0.25f)) - { - if (Main.rand.Next(5) == 0) - { - num1074 = 40; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - else - { - num1074 = 32; - } - } - else if (npc.life < (npc.lifeMax * 0.25f)) - { - if (Main.rand.Next(3) == 0) - { - num1074 = 42; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - else - { - num1074 = 34; - } - } - } - else - { - if (Main.rand.Next(13) == 0) - { - num1074 = 50; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, -1f, 0f); - } - } - 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 = 14f; //changed from 14 not a prob - num1066 = 0.2f; //changed from 0.1 not a prob - num10662 = 0.07f; - 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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662; - } - } - } - else if (num1069 > 250f) - { - 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 + num10662; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10662 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num10662; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10662 * 2f; - } - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - return; - } - } - 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); - 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); - } - } - } - npc.localAI[0] = 1f; - 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.spriteDirection = npc.direction; - return; - } - npc.localAI[0] = 0f; - 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.spriteDirection = npc.direction; - return; - } - 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) - { - npc.localAI[0] = 1f; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - 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; - return; - } - } - } - } - - 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 4; - } - } - - 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) - { - 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]; - Texture2D texture2 = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); - Texture2D texture3 = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); - if (npc.localAI[0] == 1f) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); - } - else - { - if (npc.localAI[1] == 0f) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); - } - } - 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 (npc.localAI[0] != 1f) - { - npc.localAI[1] += 1f; - } - } - if (npc.localAI[1] > 1f) - { - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("BloomStone"), 1, true); - } - 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 < 10; 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(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"), 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - } +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; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + [AutoloadBossHead] + public class PlaguebringerGoliath : ModNPC + { + private const int MissileProjectiles = 5; + private const float MissileAngleSpread = 90; + private int MissileCountdown = 0; + private bool halfLife = false; + private int despawnTimer = 600; + private bool canDespawn = false; + private float chargeDistance = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 90; //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 ? 7500000 : 6800000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.boss = true; + npc.value = Item.buyPrice(0, 25, 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("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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); + bossBag = mod.ItemType("PlaguebringerGoliathBag"); + } + + 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 num1041 = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.defDamage - num1041; + 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 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 = 0f; break; + case 1: chargeDistance = 400f; break; + case 2: chargeDistance = -400f; break; + } + } + npc.ai[0] = (float)num596; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + } + 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); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - chargeDistance)) < 20f) + { + switch (Main.rand.Next(3)) + { + case 0: chargeDistance = 0f; break; + case 1: chargeDistance = 400f; break; + case 2: chargeDistance = -400f; break; + } + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = revenge ? 28f : 26f; //16 + 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) + { + 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 = 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) + { + 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) - 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.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 not a prob + if (npc.GetGlobalNPC(mod).enraged) + { + num1050 = 200; + } + else if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1050 = 250; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num1050 = revenge ? 300 : 350; //300 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1050 = revenge ? 350 : 375; //450 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num1050 = 400; //500 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num1050 = 450; //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) + { + npc.localAI[0] = 1f; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + 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; + return; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + float num1053 = 12f; //12 found one! dictates speed during bee spawn + float num1054 = 0.2f; //0.1 found one! dictates speed during bee spawn + 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; + return; + } + } + 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; + 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); + if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; //0.25 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; //0.25 not a prob + } + bool flag103 = false; + 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(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")) < 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")) < 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; + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 5f) + { + 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 ((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")) < 4) + { + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 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")) < 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; + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 3f) + { + float num1065 = 6f; //changed from 6 to 7.5 modifies speed while firing projectiles + float num1066 = 0.15f; //changed from 0.075 to 0.09375 modifies speed while firing projectiles + float num10662 = 0.05f; + 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) - 360f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.GetGlobalNPC(mod).enraged) + { + if (npc.ai[1] % 10f == 9f) + { + flag104 = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + 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 ? 7f : 6f; + if (jungleEnrage || npc.GetGlobalNPC(mod).enraged) + { + 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 = mod.ProjectileType("PlagueStingerGoliathV2"); //projectile type + if (expertMode) + { + if (Main.rand.Next(2) == 0) + { + num1075 = mod.ProjectileType("PlagueStingerGoliath"); + } + num1074 = 28; + if (npc.life >= (npc.lifeMax * 0.75f)) + { + if (Main.rand.Next(13) == 0) + { + num1074 = 36; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + else if (npc.life < (npc.lifeMax * 0.75f) && npc.life >= (npc.lifeMax * 0.5f)) + { + if (Main.rand.Next(9) == 0) + { + num1074 = 38; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + else + { + num1074 = 30; + } + } + else if (npc.life < (npc.lifeMax * 0.5f) && npc.life >= (npc.lifeMax * 0.25f)) + { + if (Main.rand.Next(5) == 0) + { + num1074 = 40; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + else + { + num1074 = 32; + } + } + else if (npc.life < (npc.lifeMax * 0.25f)) + { + if (Main.rand.Next(3) == 0) + { + num1074 = 42; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + else + { + num1074 = 34; + } + } + } + else + { + if (Main.rand.Next(13) == 0) + { + num1074 = 50; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, -1f, 0f); + } + } + 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 = 14f; //changed from 14 not a prob + num1066 = 0.2f; //changed from 0.1 not a prob + num10662 = 0.07f; + 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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662; + } + } + } + else if (num1069 > 250f) + { + 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 + num10662; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10662 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num10662; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10662 * 2f; + } + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + return; + } + } + 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); + 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); + } + } + } + npc.localAI[0] = 1f; + 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.spriteDirection = npc.direction; + return; + } + npc.localAI[0] = 0f; + 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.spriteDirection = npc.direction; + return; + } + 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) + { + npc.localAI[0] = 1f; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + 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; + return; + } + } + } + } + + 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 4; + } + } + + 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) + { + 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]; + Texture2D texture2 = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); + Texture2D texture3 = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); + if (npc.localAI[0] == 1f) + { + CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); + } + else + { + if (npc.localAI[1] == 0f) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); + } + } + 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 (npc.localAI[0] != 1f) + { + npc.localAI[1] += 1f; + } + } + if (npc.localAI[1] > 1f) + { + npc.localAI[1] = 0f; + npc.netUpdate = true; + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("BloomStone"), 1, true); + } + 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 < 10; 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(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"), 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } } \ No newline at end of file diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index 0d60adffb8..d2606c39f1 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -1,624 +1,624 @@ -using System; -using System.Collections.Generic; -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.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 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 150000; - } - 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; - } - - 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) - { - 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); - } - } +using System; +using System.Collections.Generic; +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.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 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 150000; + } + 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; + } + + 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) + { + 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 diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 992087737d..93e85e0439 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.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.NPCs.Polterghast -{ - public class PhantomFuckYou : ModNPC - { - public bool start = true; - public 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 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 (NPC.CountNPCS(mod.NPCType("Polterghast")) < 1) - { - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Polterghast +{ + public class PhantomFuckYou : ModNPC + { + public bool start = true; + public 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 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 (NPC.CountNPCS(mod.NPCType("Polterghast")) < 1) + { + 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 diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index c76cd84a6a..0f54d4101c 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.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.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -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 ? 1900000 : 1500000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 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[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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - } - - public override void AI() - { - npc.alpha -= 5; - if (npc.alpha < 50) - { - npc.alpha = 50; - } - CalamityGlobalNPC.ghostBoss2 = npc.whoAmI; - if (CalamityGlobalNPC.ghostBoss <= 0) - { - 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 *= 4; - } - else - { - npc.damage = expertMode ? 336 : 210; - npc.defense = 0; - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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) - { - 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; - } - } - } - } +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; + +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 ? 1900000 : 1500000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 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[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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + } + + public override void AI() + { + npc.alpha -= 5; + if (npc.alpha < 50) + { + npc.alpha = 50; + } + CalamityGlobalNPC.ghostBoss2 = npc.whoAmI; + if (CalamityGlobalNPC.ghostBoss <= 0) + { + 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 *= 4; + } + else + { + npc.damage = expertMode ? 336 : 210; + npc.defense = 0; + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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) + { + 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 diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 1365c91375..269435912c 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,803 +1,803 @@ -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; - -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 ? 490000 : 420000; - if (CalamityWorld.death) - { - npc.lifeMax = 665000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 5500000 : 4900000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(5, 0, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath39; - bossBag = mod.ItemType("PolterghastBag"); - } - - public override void AI() - { - if (Main.raining) - { - Main.raining = false; - if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 1.25f, 1.25f); - npc.TargetClosest(true); - Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) { npc.active = false; } - 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); - 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 - CalamityGlobalNPC.ghostBoss = npc.whoAmI; - 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 += 8f; - num735 = 0.15f; - } - else { despawnTimer = 600; } - if (phase2) - { - num734 = 3.5f; - num735 = 0.035f; - } - if (phase3) - { - if (NPC.CountNPCS(mod.NPCType("PolterPhantom")) > 0) - { - boostDR = true; - if (npc.ai[2] >= 300f) - { - num734 = phase5 ? 18f : 12f; - num735 = phase5 ? 0.12f : 0.08f; - } - else - { - if (phase5) - { - num734 = 5f; - num735 = 0.05f; - } - else if (phase4) - { - num734 = 4.5f; - num735 = 0.045f; - } - else - { - num734 = 4f; - num735 = 0.04f; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else - { - boostDR = false; - num734 = phase5 ? 22f : 18f; - num735 = phase5 ? 0.15f : 0.12f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; - 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; - } - npc.netUpdate = true; - } - } - } - 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; - } - 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 *= 2; - npc.damage *= 2; - } - else - { - npc.damage = expertMode ? 240 : 150; - npc.defense = 150; - } - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.9) - { - npc.localAI[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.8) - { - npc.localAI[1] += 1f; - } - if (speedBoost1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 6f; - } - if (expertMode) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] > 120f) - { - 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 = 11f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) - { - 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) - { - num746 *= 2; - } - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 300; - return; - } - 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) - { - 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) - { - 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; - return; - } - } - } - } - else if (!phase3) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] += 1f; - 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, 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) - { - npc.defense *= 3; - npc.damage *= 3; - } - else - { - npc.damage = expertMode ? 288 : 180; - npc.defense = 100; - } - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (speedBoost1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 8f; - } - if (expertMode) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] > 80f) - { - 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 = 11f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) - { - 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) - { - num746 *= 2; - } - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 400; - return; - } - 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) - { - 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) - { - 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; - return; - } - } - } - } - 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); - 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) - { - npc.defense = 400; - npc.damage *= 4; - } - 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; - return; - } - } - } - } - - public override void NPCLoot() - { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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.7f : 0f); //.9 - if (CalamityWorld.defiled) - { - protection += (1f - protection) * 0.5f; - } - 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 * (npc.ichor ? 0.88f : 1f))) * 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) - { - 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; - } - } - } - } +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; + +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 ? 510000 : 440000; + if (CalamityWorld.death) + { + npc.lifeMax = 705000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 6000000 : 5400000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(5, 0, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath39; + bossBag = mod.ItemType("PolterghastBag"); + } + + public override void AI() + { + if (Main.raining) + { + Main.raining = false; + if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 1.25f, 1.25f); + npc.TargetClosest(true); + Vector2 vector = npc.Center; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) { npc.active = false; } + 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); + 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 + CalamityGlobalNPC.ghostBoss = npc.whoAmI; + 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 += 8f; + num735 = 0.15f; + } + else { despawnTimer = 600; } + if (phase2) + { + num734 = 3.5f; + num735 = 0.035f; + } + if (phase3) + { + if (NPC.CountNPCS(mod.NPCType("PolterPhantom")) > 0) + { + boostDR = true; + if (npc.ai[2] >= 300f) + { + num734 = phase5 ? 18f : 12f; + num735 = phase5 ? 0.12f : 0.08f; + } + else + { + if (phase5) + { + num734 = 5f; + num735 = 0.05f; + } + else if (phase4) + { + num734 = 4.5f; + num735 = 0.045f; + } + else + { + num734 = 4f; + num735 = 0.04f; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else + { + boostDR = false; + num734 = phase5 ? 22f : 18f; + num735 = phase5 ? 0.15f : 0.12f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 600f) + { + npc.localAI[2] = 0f; + 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; + } + npc.netUpdate = true; + } + } + } + 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; + } + 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 *= 2; + npc.damage *= 2; + } + else + { + npc.damage = expertMode ? 240 : 150; + npc.defense = 150; + } + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.9) + { + npc.localAI[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.8) + { + npc.localAI[1] += 1f; + } + if (speedBoost1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 6f; + } + if (expertMode) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] > 120f) + { + 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 = 11f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + { + 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) + { + num746 *= 2; + } + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = 300; + return; + } + 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) + { + 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) + { + 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; + return; + } + } + } + } + else if (!phase3) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] += 1f; + 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, 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) + { + npc.defense *= 3; + npc.damage *= 3; + } + else + { + npc.damage = expertMode ? 288 : 180; + npc.defense = 100; + } + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (speedBoost1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 8f; + } + if (expertMode) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] > 80f) + { + 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 = 11f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + { + 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) + { + num746 *= 2; + } + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num748].timeLeft = 400; + return; + } + 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) + { + 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) + { + 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; + return; + } + } + } + } + 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); + 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) + { + npc.defense = 400; + npc.damage *= 4; + } + 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; + return; + } + } + } + } + + public override void NPCLoot() + { + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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 (CalamityWorld.defiled) + { + protection += (1f - protection) * 0.5f; + } + 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 * (npc.ichor ? 0.88f : 1f))) * 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) + { + 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 diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 1ec2f0534d..249a64c55a 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.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; - -namespace CalamityMod.NPCs.Polterghast -{ - public class PolterghastHook : ModNPC - { - public int despawnTimer = 300; - public 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 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) - { - 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 > 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 = 299; - 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 (CalamityGlobalNPC.ghostBoss >= 0 && !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) - { - 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); - } - } - } - } +using System; +using System.Collections.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.Polterghast +{ + public class PolterghastHook : ModNPC + { + public int despawnTimer = 300; + public 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 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) + { + 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 > 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 = 299; + 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 (CalamityGlobalNPC.ghostBoss >= 0 && !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) + { + 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 diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index f11e601925..7874fd92f5 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -1,381 +1,381 @@ -using System; -using System.Collections.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.ProfanedGuardianBoss -{ - [AutoloadBossHead] - public class ProfanedGuardianBoss : ModNPC - { - public int flareTimer = 0; //projectile stuff - public int flareProjectiles = 1; - public 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; - } - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - npc.boss = true; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - 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(1, 0, 0, 0); - 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.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; - 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) - { - npc.TargetClosest(false); - 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; - } - } - } - } - } - 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.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] = 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 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) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.ProfanedGuardianBoss +{ + [AutoloadBossHead] + public class ProfanedGuardianBoss : ModNPC + { + public int flareTimer = 0; //projectile stuff + public int flareProjectiles = 1; + public 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; + } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + npc.boss = true; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + 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(1, 0, 0, 0); + 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.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; + 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) + { + npc.TargetClosest(false); + 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; + } + } + } + } + } + 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.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] = 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 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) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index 65cbae4bb8..20aa286830 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.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; - -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 = 100; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 40; - npc.lifeMax = 40000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 400000 : 300000; - } - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - npc.boss = true; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - 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(1, 0, 0, 0); - 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 (CalamityGlobalNPC.doughnutBoss < 0) - { - 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) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.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 = 100; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 40; + npc.lifeMax = 40000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 400000 : 300000; + } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + npc.boss = true; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + 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(1, 0, 0, 0); + 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 (CalamityGlobalNPC.doughnutBoss < 0) + { + 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) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index 6fe613eddb..7fdcd78ae3 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.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; - -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 = 100; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 25; - npc.lifeMax = 25000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 240000 : 200000; - } - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - aiType = -1; - npc.boss = true; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - 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(1, 0, 0, 0); - 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 (CalamityGlobalNPC.doughnutBoss < 0) - { - 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) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.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 = 100; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 25; + npc.lifeMax = 25000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 240000 : 200000; + } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + aiType = -1; + npc.boss = true; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + 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(1, 0, 0, 0); + 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 (CalamityGlobalNPC.doughnutBoss < 0) + { + 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) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Providence/ProvScreenShaderData.cs b/NPCs/Providence/ProvScreenShaderData.cs index a749902918..a0536418ce 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(); - } - } +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 diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index bffe66f049..d81c74ac00 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.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.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.5f; - } - 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; - } - } - //this.DoGIndex = DoGIndex; - 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(200, 150, 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; - } - } +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.5f; + } + 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; + } + } + //this.DoGIndex = DoGIndex; + 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(200, 150, 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 diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 514fd33a33..59fbada23a 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.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; - -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 = 21875; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 180000 : 150000; - } - 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.value = Item.buyPrice(0, 5, 0, 0); - 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 (NPC.CountNPCS(mod.NPCType("Providence")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return; - } - 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 ? 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); - } - } - } - } - 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) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.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 = 21875; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 180000 : 150000; + } + 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.value = Item.buyPrice(0, 5, 0, 0); + 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 (NPC.CountNPCS(mod.NPCType("Providence")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return; + } + 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 ? 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); + } + } + } + } + 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) + { + 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 diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index c2ffab16fb..9793eb71f3 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,193 +1,193 @@ -using System; -using System.Collections.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.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 = 37500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 250000 : 200000; - } - 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.value = Item.buyPrice(0, 5, 0, 0); - 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) ? 30 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (NPC.CountNPCS(mod.NPCType("Providence")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return; - } - 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 > 120f) - { - 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(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) / 98f; //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) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.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 = 37500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 250000 : 200000; + } + 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.value = Item.buyPrice(0, 5, 0, 0); + 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) ? 30 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (NPC.CountNPCS(mod.NPCType("Providence")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return; + } + 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 > 120f) + { + 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(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) / 98f; //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) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 3831655336..380ad63013 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,293 +1,293 @@ -using System; -using System.Collections.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.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 = 80; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 30; - npc.lifeMax = 37500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 250000 : 200000; - } - 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.value = Item.buyPrice(0, 5, 0, 0); - 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 fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; - bool expertMode = Main.expertMode; - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 30 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (NPC.CountNPCS(mod.NPCType("Providence")) < 1) - { - npc.active = false; - npc.netUpdate = true; - return; - } - 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 ? 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 (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.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] = 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 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) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } +using System; +using System.Collections.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.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 = 80; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 30; + npc.lifeMax = 37500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 250000 : 200000; + } + 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.value = Item.buyPrice(0, 5, 0, 0); + 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 fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; + bool expertMode = Main.expertMode; + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 30 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (NPC.CountNPCS(mod.NPCType("Providence")) < 1) + { + npc.active = false; + npc.netUpdate = true; + return; + } + 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 ? 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 (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.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] = 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 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) + { + 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 diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index f618391090..6c8d9cda0a 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1,1231 +1,1231 @@ -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; - -namespace CalamityMod.NPCs.Providence -{ - [AutoloadBossHead] - public class Providence : ModNPC - { - private bool text = false; - private float bossLife; - 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 ? 299000 : 264500; - if (CalamityWorld.death) - { - npc.lifeMax = 402500; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 9900000 : 9000000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(3, 0, 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); - npc.HitSound = SoundID.NPCHit44; - npc.DeathSound = SoundID.NPCDeath46; - bossBag = mod.ItemType("ProvidenceBag"); - } - - public override void AI() - { - npc.damage = 0; - CalamityGlobalNPC.holyBoss = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; - bool isHoly = player.ZoneHoly; - bool isHell = player.ZoneUnderworldHeight; - bool canAttack = true; - bool attackMore = (double)npc.life <= (double)npc.lifeMax * 0.5; - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) - { - if (immuneTimer > 0) - { - immuneTimer--; - } - } - else - { - immuneTimer = 300; - } - npc.dontTakeDamage = (immuneTimer <= 0); - npc.rotation = npc.velocity.X * 0.004f; - if (Main.raining) - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) - { - float heal = revenge ? 90f : 120f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - heal = 30f; - } - 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; - } - } - } - } - bool tooFarAway = Vector2.Distance(Main.player[npc.target].Center, vector) > 2800f; - 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 (tooFarAway) - { - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("HolyInferno"), 2); - } - } - } - 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); - 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)); - int spawn1 = mod.NPCType("ProvSpawnDefense"); - int spawn2 = mod.NPCType("ProvSpawnHealer"); - int spawn3 = mod.NPCType("ProvSpawnOffense"); - int spawnNPC1 = NPC.NewNPC(x - 100, y - 100, spawn1, 0, 0f, 0f, 0f, 0f, 255); - int spawnNPC2 = NPC.NewNPC(x + 100, y - 100, spawn2, 0, 0f, 0f, 0f, 0f, 255); - int spawnNPC3 = NPC.NewNPC(x, y + 100, spawn3, 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, spawnNPC1, 0f, 0f, 0f, 0, 0, 0); - NetMessage.SendData(23, -1, -1, null, spawnNPC2, 0f, 0f, 0f, 0, 0, 0); - NetMessage.SendData(23, -1, -1, null, spawnNPC3, 0f, 0f, 0f, 0, 0, 0); - } - return; - } - } - } - if (NPC.CountNPCS(mod.NPCType("ProvSpawnOffense")) > 0 || - NPC.CountNPCS(mod.NPCType("ProvSpawnDefense")) > 0 || - NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) - { - npc.dontTakeDamage = true; - canAttack = false; - } - if (npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) - { - if (npc.ai[2] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < player.Center.X) - { - npc.ai[2] = 1f; - } - else - { - npc.ai[2] = -1f; - } - } - npc.TargetClosest(true); - int num851 = 800; - float num852 = Math.Abs(npc.Center.X - player.Center.X); - if (npc.Center.X < player.Center.X && npc.ai[2] < 0f && num852 > (float)num851) - { - npc.ai[2] = 0f; - } - if (npc.Center.X > player.Center.X && npc.ai[2] > 0f && num852 > (float)num851) - { - npc.ai[2] = 0f; - } - 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; - } - npc.velocity.X = npc.velocity.X + npc.ai[2] * 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 < 200f) //150 - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (num855 > 250f) //200 - { - npc.velocity.Y = npc.velocity.Y + 0.2f; - } - if (npc.velocity.Y > 6f) //8 - { - npc.velocity.Y = 6f; - } - if (npc.velocity.Y < -6f) //8 - { - npc.velocity.Y = -6f; - } - } - if (npc.ai[0] == 0f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = 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) - { - num856 = expertMode ? 21 : 22; - } - if (!canAttack) - { - if (attackMore) - { - num856 = expertMode ? 35 : 40; - } - else - { - 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) - { - 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; - npc.chaseable = 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 (!canAttack) - { - if (attackMore) - { - num864 = expertMode ? 40 : 45; - } - else - { - 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.chaseable = false; - 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 (!canAttack) - { - if (attackMore) - { - num870 = expertMode ? 8 : 11; - } - else - { - 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); - } - } - } - if (Main.netMode != 1) - { - 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) - { - Main.PlaySound(SoundID.Item20, player.position); - player.AddBuff(mod.BuffType("ExtremeGravity"), 1500, true); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.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(player.position.X, player.position.Y), player.width, player.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - text = false; - npc.ai[0] = -1f; - } - } - } - if (npc.ai[0] == 3f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = 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 (!canAttack) - { - if (attackMore) - { - num856 = expertMode ? 20 : 23; - } - else - { - 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; - npc.chaseable = 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) - { - num864 = expertMode ? 56 : 64; - } - if (!canAttack) - { - if (attackMore) - { - num864 = expertMode ? 115 : 135; - } - else - { - 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, (float)Main.rand.Next(5), 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.chaseable = false; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - if (Main.netMode != 1) - { - npc.ai[2] += (npc.GetGlobalNPC(mod).enraged ? 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 (!canAttack && attackMore) - { - npc.ai[2] += 1f; //4 - } - if (npc.ai[2] > (canAttack ? 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); - return; - } - } - 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.chaseable = false; - 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, Main.myPlayer, 0f, 0f); - npc.ai[0] = -1f; - } - } - } - else if (npc.ai[0] == 7f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - 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 = 0.8f; - if (num1221 % 2 == 1) - { - num1223 = 1.65f; - } - 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 && 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; - } - } - } - if (npc.ai[0] == -1f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = 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; - case 1: phase = 5; break; - case 2: phase = 0; break; - case 3: phase = attackMore ? 6 : 1; break; - case 4: phase = 2; break; - case 5: phase = 4; break; - case 6: phase = 1; break; - case 7: phase = 5; break; - case 8: - phase = attackMore ? 7 : 3; - if (attackMore) - { - 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; - case 10: phase = 2; break; - case 11: phase = 4; break; - case 12: - phase = attackMore ? 7 : 4; - if (attackMore) - { - 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; - case 14: phase = 0; break; - } - } - else - { - switch (phaseChange) - { - case 0: phase = 0; break; - case 1: - phase = attackMore ? 7 : 1; - if (attackMore) - { - 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; - case 3: phase = 4; break; - case 4: phase = 5; break; - case 5: phase = attackMore ? 6 : 4; break; - case 6: phase = 3; break; - case 7: phase = 1; break; - case 8: phase = 0; break; - case 9: phase = 2; break; - case 10: phase = 4; break; - case 11: - phase = attackMore ? 7 : 0; - if (attackMore) - { - 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; - case 13: phase = 1; break; - case 14: phase = 5; break; - } - } - npc.TargetClosest(true); - if (Math.Abs(npc.Center.X - player.Center.X) > 3000f) - { - phase = 0; - } - npc.ai[0] = (float)phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - - public override void NPCLoot() - { - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - 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 < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - if (isHoly) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianWings"), 1, true); - } - if (isHell) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianAegis"), 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(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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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 (CalamityWorld.defiled) - { - protection += (1f - protection) * 0.5f; - } - 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]; - Texture2D texture2 = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); - Texture2D texture3 = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); - Texture2D texture4 = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); - Texture2D texture5 = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); - Texture2D texture6 = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (npc.localAI[2] == 0f) - { - CalamityMod.DrawTexture(spriteBatch, texture5, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture6, 0, npc, drawColor); - } - } - else - { - if (frameUsed == 0) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - } - else if (frameUsed == 1) - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); - } - else if (frameUsed == 2) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor); - } - } - return false; - } - - public override void FindFrame(int frameHeight) //9 total frames - { - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (npc.localAI[2] == 0f) - { - 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; - npc.localAI[2] = 1f; - npc.netUpdate = 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 (npc.localAI[2] > 0f) - { - npc.localAI[2] = 0f; - npc.netUpdate = true; - } - 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; - npc.netUpdate = true; - } - } - } - - 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; - } - } - } - } +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; + +namespace CalamityMod.NPCs.Providence +{ + [AutoloadBossHead] + public class Providence : ModNPC + { + private bool text = false; + private float bossLife; + 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 ? 299000 : 264500; + if (CalamityWorld.death) + { + npc.lifeMax = 402500; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 9900000 : 9000000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(3, 0, 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); + npc.HitSound = SoundID.NPCHit44; + npc.DeathSound = SoundID.NPCDeath46; + bossBag = mod.ItemType("ProvidenceBag"); + } + + public override void AI() + { + npc.damage = 0; + CalamityGlobalNPC.holyBoss = npc.whoAmI; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + Vector2 vector = npc.Center; + bool isHoly = player.ZoneHoly; + bool isHell = player.ZoneUnderworldHeight; + bool canAttack = true; + bool attackMore = (double)npc.life <= (double)npc.lifeMax * 0.5; + if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + { + if (immuneTimer > 0) + { + immuneTimer--; + } + } + else + { + immuneTimer = 300; + } + npc.dontTakeDamage = (immuneTimer <= 0); + npc.rotation = npc.velocity.X * 0.004f; + if (Main.raining) + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) + { + float heal = revenge ? 90f : 120f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + heal = 30f; + } + 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; + } + } + } + } + bool tooFarAway = Vector2.Distance(Main.player[npc.target].Center, vector) > 2800f; + 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 (tooFarAway) + { + if (Main.netMode != 2) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("HolyInferno"), 2); + } + } + } + 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); + 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)); + int spawn1 = mod.NPCType("ProvSpawnDefense"); + int spawn2 = mod.NPCType("ProvSpawnHealer"); + int spawn3 = mod.NPCType("ProvSpawnOffense"); + int spawnNPC1 = NPC.NewNPC(x - 100, y - 100, spawn1, 0, 0f, 0f, 0f, 0f, 255); + int spawnNPC2 = NPC.NewNPC(x + 100, y - 100, spawn2, 0, 0f, 0f, 0f, 0f, 255); + int spawnNPC3 = NPC.NewNPC(x, y + 100, spawn3, 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, spawnNPC1, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(23, -1, -1, null, spawnNPC2, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(23, -1, -1, null, spawnNPC3, 0f, 0f, 0f, 0, 0, 0); + } + return; + } + } + } + if (NPC.CountNPCS(mod.NPCType("ProvSpawnOffense")) > 0 || + NPC.CountNPCS(mod.NPCType("ProvSpawnDefense")) > 0 || + NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) + { + npc.dontTakeDamage = true; + canAttack = false; + } + if (npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) + { + if (npc.ai[2] == 0f) + { + npc.TargetClosest(true); + if (npc.Center.X < player.Center.X) + { + npc.ai[2] = 1f; + } + else + { + npc.ai[2] = -1f; + } + } + npc.TargetClosest(true); + int num851 = 800; + float num852 = Math.Abs(npc.Center.X - player.Center.X); + if (npc.Center.X < player.Center.X && npc.ai[2] < 0f && num852 > (float)num851) + { + npc.ai[2] = 0f; + } + if (npc.Center.X > player.Center.X && npc.ai[2] > 0f && num852 > (float)num851) + { + npc.ai[2] = 0f; + } + 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; + } + npc.velocity.X = npc.velocity.X + npc.ai[2] * 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 < 200f) //150 + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (num855 > 250f) //200 + { + npc.velocity.Y = npc.velocity.Y + 0.2f; + } + if (npc.velocity.Y > 6f) //8 + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) //8 + { + npc.velocity.Y = -6f; + } + } + if (npc.ai[0] == 0f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = 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) + { + num856 = expertMode ? 21 : 22; + } + if (!canAttack) + { + if (attackMore) + { + num856 = expertMode ? 35 : 40; + } + else + { + 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) + { + 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; + npc.chaseable = 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 (!canAttack) + { + if (attackMore) + { + num864 = expertMode ? 40 : 45; + } + else + { + 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.chaseable = false; + 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 (!canAttack) + { + if (attackMore) + { + num870 = expertMode ? 8 : 11; + } + else + { + 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); + } + } + } + if (Main.netMode != 1) + { + 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) + { + Main.PlaySound(SoundID.Item20, player.position); + player.AddBuff(mod.BuffType("ExtremeGravity"), 1500, true); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.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(player.position.X, player.position.Y), player.width, player.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + text = false; + npc.ai[0] = -1f; + } + } + } + if (npc.ai[0] == 3f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = 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 (!canAttack) + { + if (attackMore) + { + num856 = expertMode ? 20 : 23; + } + else + { + 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; + npc.chaseable = 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) + { + num864 = expertMode ? 56 : 64; + } + if (!canAttack) + { + if (attackMore) + { + num864 = expertMode ? 115 : 135; + } + else + { + 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, (float)Main.rand.Next(5), 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.chaseable = false; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + if (Main.netMode != 1) + { + npc.ai[2] += (npc.GetGlobalNPC(mod).enraged ? 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 (!canAttack && attackMore) + { + npc.ai[2] += 1f; //4 + } + if (npc.ai[2] > (canAttack ? 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); + return; + } + } + 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.chaseable = false; + 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, Main.myPlayer, 0f, 0f); + npc.ai[0] = -1f; + } + } + } + else if (npc.ai[0] == 7f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + 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 = 0.8f; + if (num1221 % 2 == 1) + { + num1223 = 1.65f; + } + 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 && 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; + } + } + } + if (npc.ai[0] == -1f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = 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; + case 1: phase = 5; break; + case 2: phase = 0; break; + case 3: phase = attackMore ? 6 : 1; break; + case 4: phase = 2; break; + case 5: phase = 4; break; + case 6: phase = 1; break; + case 7: phase = 5; break; + case 8: + phase = attackMore ? 7 : 3; + if (attackMore) + { + 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; + case 10: phase = 2; break; + case 11: phase = 4; break; + case 12: + phase = attackMore ? 7 : 4; + if (attackMore) + { + 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; + case 14: phase = 0; break; + } + } + else + { + switch (phaseChange) + { + case 0: phase = 0; break; + case 1: + phase = attackMore ? 7 : 1; + if (attackMore) + { + 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; + case 3: phase = 4; break; + case 4: phase = 5; break; + case 5: phase = attackMore ? 6 : 4; break; + case 6: phase = 3; break; + case 7: phase = 1; break; + case 8: phase = 0; break; + case 9: phase = 2; break; + case 10: phase = 4; break; + case 11: + phase = attackMore ? 7 : 0; + if (attackMore) + { + 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; + case 13: phase = 1; break; + case 14: phase = 5; break; + } + } + npc.TargetClosest(true); + if (Math.Abs(npc.Center.X - player.Center.X) > 3000f) + { + phase = 0; + } + npc.ai[0] = (float)phase; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + } + + public override void NPCLoot() + { + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + 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 < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + if (isHoly) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianWings"), 1, true); + } + if (isHell) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianAegis"), 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(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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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 (CalamityWorld.defiled) + { + protection += (1f - protection) * 0.5f; + } + 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]; + Texture2D texture2 = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); + Texture2D texture3 = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); + Texture2D texture4 = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); + Texture2D texture5 = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); + Texture2D texture6 = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (npc.localAI[2] == 0f) + { + CalamityMod.DrawTexture(spriteBatch, texture5, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture6, 0, npc, drawColor); + } + } + else + { + if (frameUsed == 0) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + } + else if (frameUsed == 1) + { + CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor); + } + else if (frameUsed == 2) + { + CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor); + } + } + return false; + } + + public override void FindFrame(int frameHeight) //9 total frames + { + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (npc.localAI[2] == 0f) + { + 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; + npc.localAI[2] = 1f; + npc.netUpdate = 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 (npc.localAI[2] > 0f) + { + npc.localAI[2] = 0f; + npc.netUpdate = true; + } + 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; + npc.netUpdate = true; + } + } + } + + 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 diff --git a/NPCs/Scavenger/FlamePillar.cs b/NPCs/Scavenger/FlamePillar.cs index 932e682b2d..1ae564faac 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; - -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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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) - { - 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; - return; - } - } - } - - 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; - } - } - } - } +using System; +using System.Collections.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.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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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) + { + 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; + return; + } + } + } + + 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 diff --git a/NPCs/Scavenger/RockPillar.cs b/NPCs/Scavenger/RockPillar.cs index 06d95ce9a4..085ee61ea4 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; - -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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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; - return; - } - } - } - - 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; - } - } - } - } +using System; +using System.Collections.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.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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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; + return; + } + } + } + + 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 diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index b3256315d5..aac8c87ab7 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -1,609 +1,609 @@ -using System; -using System.Collections.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.Scavenger -{ - [AutoloadBossHead] - public class ScavengerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Main.npcFrameCount[npc.type] = 7; - } - - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 332; //324 - npc.height = 214; //216 - npc.defense = 80; - npc.lifeMax = CalamityWorld.revenge ? 51300 : 42700; - if (CalamityWorld.death) - { - npc.lifeMax = 85000; - } - 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, 30, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); - bossBag = mod.ItemType("RavagerBag"); - if (CalamityWorld.downedProvidence) - { - npc.defense = 180; - npc.lifeMax = 350000; - npc.value = Item.buyPrice(5, 0, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3800000 : 3300000; - } - } - - 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 + 21, (int)npc.Center.Y - 25, 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[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].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 ? 2f : 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 = 0; - 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 = 210; - } - } - } - 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 = 0; - 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 = 210; - } - } - } - 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) - { - npc.ai[1] += 1f; - } - if (!headActive || npc.GetGlobalNPC(mod).enraged) - { - npc.ai[1] += 1f; - } - if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged) - { - 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) ? 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) - { - 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 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) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 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/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) - { - 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 void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - } - } - - 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("RavagerTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; 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(50, 61)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BarofLife")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCalamity")); - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 3)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 3)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 3)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodPact")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FleshTotem")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hematemesis")); - } - } - } - } +using System; +using System.Collections.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.Scavenger +{ + [AutoloadBossHead] + public class ScavengerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Main.npcFrameCount[npc.type] = 7; + } + + public override void SetDefaults() + { + 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, 30, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); + bossBag = mod.ItemType("RavagerBag"); + if (CalamityWorld.downedProvidence) + { + npc.defense = 180; + npc.lifeMax = 350000; + npc.value = Item.buyPrice(5, 0, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4200000 : 3600000; + } + } + + 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 + 21, (int)npc.Center.Y - 25, 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[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].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 ? 2f : 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 = 0; + 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 = 210; + } + } + } + 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 = 0; + 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 = 210; + } + } + } + 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) + { + npc.ai[1] += 1f; + } + if (!headActive || npc.GetGlobalNPC(mod).enraged) + { + npc.ai[1] += 1f; + } + if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged) + { + 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) ? 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) + { + 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 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) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 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/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) + { + 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 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 < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RavagerTrophy")); + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(50, 61)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BarofLife")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCalamity")); + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 3)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 3)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 3)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodPact")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FleshTotem")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hematemesis")); + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index 6b703fd80b..399bbe76b7 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.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; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerClawLeft : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 10120; - 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.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 ? 500000 : 400000; - } - } - - public override void AI() - { - if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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.noTileCollide = true; - npc.ai[0] = 0f; - return; - } - } - 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++; - } - } - } - } +using System; +using System.Collections.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.Scavenger +{ + public class ScavengerClawLeft : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + 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.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 ? 550000 : 440000; + } + } + + public override void AI() + { + if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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.noTileCollide = true; + npc.ai[0] = 0f; + return; + } + } + 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++; + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index d70e18cc75..3e46eeea1a 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.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; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerClawRight : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 10120; - 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.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 ? 500000 : 400000; - } - } - - public override void AI() - { - if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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.noTileCollide = true; - npc.ai[0] = 0f; - return; - } - } - 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++; - } - } - } - } +using System; +using System.Collections.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.Scavenger +{ + public class ScavengerClawRight : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + 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.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 ? 550000 : 440000; + } + } + + public override void AI() + { + if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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.noTileCollide = true; + npc.ai[0] = 0f; + return; + } + } + 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++; + } + } + } + } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index 777f333a3a..25feb1c910 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -1,154 +1,154 @@ -using System; -using System.Collections.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.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 = 30705; - 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.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 ? 900000 : 750000; - } - } - - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - npc.noTileCollide = true; - if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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 -= 25f; - centerX += 21f; - 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); - } - } - } +using System; +using System.Collections.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.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.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 ? 960000 : 820000; + } + } + + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + npc.noTileCollide = true; + if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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 -= 25f; + centerX += 21f; + 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 diff --git a/NPCs/Scavenger/ScavengerHead2.cs b/NPCs/Scavenger/ScavengerHead2.cs index 382184bf5f..ea4d865c1a 100644 --- a/NPCs/Scavenger/ScavengerHead2.cs +++ b/NPCs/Scavenger/ScavengerHead2.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; - -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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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) - { - 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; - } - } +using System; +using System.Collections.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.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 (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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) + { + 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 diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index bbc29556a9..7a1b1ea1b5 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.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; - -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 = 20010; - 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.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 ? 800000 : 600000; - } - } - - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Vector2 center = npc.Center; - if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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) - { - npc.noTileCollide = true; - 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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.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.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 ? 870000 : 650000; + } + } + + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Vector2 center = npc.Center; + if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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) + { + npc.noTileCollide = true; + 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) + { + 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 diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index 4a23f03399..d79f3537bc 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.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; - -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 = 20010; - 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.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 ? 800000 : 600000; - } - } - - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Vector2 center = npc.Center; - if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) - { - 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) - { - npc.noTileCollide = true; - 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) - { - 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); - } - } - } - } +using System; +using System.Collections.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.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.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 ? 870000 : 650000; + } + } + + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Vector2 center = npc.Center; + if (NPC.CountNPCS(mod.NPCType("ScavengerBody")) < 1) + { + 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) + { + npc.noTileCollide = true; + 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) + { + 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 diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 124eea0888..b13d4a2253 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -1,560 +1,560 @@ -using System; -using System.Collections.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.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 = 50; - 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 ? 4500000 : 3800000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - animationType = 50; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.alpha = 60; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - } - - public override void AI() - { - 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) > 3600f) - { - 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 (NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) - { - flag100 = true; - } - if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) - { - 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 : 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 = 21; - 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 : 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 = expertMode ? 16 : 18; - 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.dontTakeDamage = false; - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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.5f; //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; - return; - } - } - else if (npc.ai[0] == 7f) - { - npc.damage = 0; - 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; - return; - } - } - 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); - } - } - return; - } - } - } - } - - public override bool CheckActive() - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); - } - - 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.ManaSickness, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 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; + +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 = 50; + 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 ? 4500000 : 3800000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + animationType = 50; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.alpha = 60; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + } + + public override void AI() + { + 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) > 3600f) + { + 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 (NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) + { + flag100 = true; + } + if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) + { + 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 : 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 = 21; + 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 : 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 = expertMode ? 16 : 18; + 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.dontTakeDamage = false; + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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.5f; //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; + return; + } + } + else if (npc.ai[0] == 7f) + { + npc.damage = 0; + 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; + return; + } + } + 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); + } + } + return; + } + } + } + } + + public override bool CheckActive() + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); + } + + 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.ManaSickness, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 2bc1dd7f47..04834ee39e 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,311 +1,311 @@ -using System; -using System.Collections.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.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGodCore : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - } - - public override void SetDefaults() - { - npc.damage = 50; - 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 ? 3000000 : 2700000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - 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 ((NPC.AnyNPCs(mod.NPCType("SlimeGod")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) && - !CalamityWorld.bossRushActive) - { - 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 = 75; - if (Main.netMode != 1) - { - npc.localAI[1] += (npc.GetGlobalNPC(mod).enraged ? 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 = 21; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssMine"); - } - else - { - num185 = mod.ProjectileType("AbyssMine2"); - num184 = 19; - } - 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 ? 16 : 18; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssBallVolley"); - } - else - { - num185 = mod.ProjectileType("AbyssBallVolley2"); - num184 = expertMode ? 14 : 16; - } - 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) - { - num1372 = 21f; - } - if (npc.GetGlobalNPC(mod).enraged) - { - 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; - } - return; - } - - 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, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - } - } +using System; +using System.Collections.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.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGodCore : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + } + + public override void SetDefaults() + { + npc.damage = 50; + 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 ? 3000000 : 2700000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + 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 ((NPC.AnyNPCs(mod.NPCType("SlimeGod")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) && + !CalamityWorld.bossRushActive) + { + 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 = 75; + if (Main.netMode != 1) + { + npc.localAI[1] += (npc.GetGlobalNPC(mod).enraged ? 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 = 21; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssMine"); + } + else + { + num185 = mod.ProjectileType("AbyssMine2"); + num184 = 19; + } + 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 ? 16 : 18; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssBallVolley"); + } + else + { + num185 = mod.ProjectileType("AbyssBallVolley2"); + num184 = expertMode ? 14 : 16; + } + 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) + { + num1372 = 21f; + } + if (npc.GetGlobalNPC(mod).enraged) + { + 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; + } + return; + } + + 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, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index a6dbbb5884..18163cc436 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -1,597 +1,597 @@ -using System; -using 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; - -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 = 50; - 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 ? 3600000 : 3000000; - } - npc.knockBackResist = 0f; - animationType = 50; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - 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) > 3600f) - { - 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 (NPC.AnyNPCs(mod.NPCType("SlimeGod")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodSplit"))) - { - flag100 = true; - } - if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) - { - 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 : 11f; - 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 = 19; - 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 ? 12f : 11f; - 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 ? 14 : 16; - 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.dontTakeDamage = false; - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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.5f; //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; - return; - } - } - else if (npc.ai[0] == 7f) - { - npc.damage = 0; - 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; - return; - } - } - 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); - } - } - return; - } - } - } - } - - public override bool CheckActive() - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); - } - - 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Cursed, 30, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - else - { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 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 Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod; + +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 = 50; + 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 ? 3600000 : 3000000; + } + npc.knockBackResist = 0f; + animationType = 50; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + npc.aiStyle = -1; + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + 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) > 3600f) + { + 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 (NPC.AnyNPCs(mod.NPCType("SlimeGod")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodSplit"))) + { + flag100 = true; + } + if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) + { + 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 : 11f; + 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 = 19; + 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 ? 12f : 11f; + 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 ? 14 : 16; + 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.dontTakeDamage = false; + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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.5f; //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; + return; + } + } + else if (npc.ai[0] == 7f) + { + npc.damage = 0; + 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; + return; + } + } + 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); + } + } + return; + } + } + } + } + + public override bool CheckActive() + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); + } + + 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Cursed, 30, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + else + { + player.AddBuff(BuffID.ManaSickness, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 04f55fa1c8..1fb5248abd 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -1,591 +1,591 @@ -using System; -using 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; - -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 ? 1800000 : 1500000; - } - npc.damage = 40; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 20; - npc.knockBackResist = 0f; - animationType = 50; - npc.value = Item.buyPrice(0, 8, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - bool flag100 = false; - bool hyperMode = false; - if (NPC.AnyNPCs(mod.NPCType("SlimeGod")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodSplit"))) - { - flag100 = true; - } - if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) - { - 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 : 11f; - 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 = 19; - 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 ? 12f : 11f; - 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 ? 14 : 16; - 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.dontTakeDamage = false; - 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; - return; - } - } - 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] >= 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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.5f; //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; - return; - } - } - else if (npc.ai[0] == 7f) - { - npc.damage = 0; - 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; - return; - } - } - 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); - } - } - return; - } - } - } - } - - public override bool CheckActive() - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); - } - - 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.ManaSickness, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 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 Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod; + +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 ? 1800000 : 1500000; + } + npc.damage = 40; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 20; + npc.knockBackResist = 0f; + animationType = 50; + npc.value = Item.buyPrice(0, 8, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + npc.aiStyle = -1; + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + bool flag100 = false; + bool hyperMode = false; + if (NPC.AnyNPCs(mod.NPCType("SlimeGod")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodSplit"))) + { + flag100 = true; + } + if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) + { + 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 : 11f; + 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 = 19; + 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 ? 12f : 11f; + 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 ? 14 : 16; + 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.dontTakeDamage = false; + 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; + return; + } + } + 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] >= 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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.5f; //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; + return; + } + } + else if (npc.ai[0] == 7f) + { + npc.damage = 0; + 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; + return; + } + } + 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); + } + } + return; + } + } + } + } + + public override bool CheckActive() + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); + } + + 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.ManaSickness, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 0016e74d51..9e9ad6a047 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -1,573 +1,573 @@ -using System; -using System.Collections.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.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 ? 2250000 : 1900000; - } - npc.damage = 40; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 10; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - animationType = 50; - npc.value = Item.buyPrice(0, 8, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - bool flag100 = false; - bool hyperMode = false; - if (NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || - NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) - { - flag100 = true; - } - if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) - { - 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 : 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 = 21; - 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 : 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 = expertMode ? 16 : 18; - 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.dontTakeDamage = false; - 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; - return; - } - } - 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.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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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.5f; - 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; - return; - } - } - else if (npc.ai[0] == 7f) - { - npc.damage = 0; - 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; - return; - } - } - 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); - } - } - return; - } - } - } - } - - public override bool CheckActive() - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); - } - - 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.ManaSickness, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 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; + +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 ? 2250000 : 1900000; + } + npc.damage = 40; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 10; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + animationType = 50; + npc.value = Item.buyPrice(0, 8, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + bool flag100 = false; + bool hyperMode = false; + if (NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) || + NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit"))) + { + flag100 = true; + } + if (!NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) || CalamityWorld.bossRushActive) + { + 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 : 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 = 21; + 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 : 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 = expertMode ? 16 : 18; + 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.dontTakeDamage = false; + 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; + return; + } + } + 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.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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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.5f; + 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; + return; + } + } + else if (npc.ai[0] == 7f) + { + npc.damage = 0; + 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; + return; + } + } + 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); + } + } + return; + } + } + } + } + + public override bool CheckActive() + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")); + } + + 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.ManaSickness, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index ec78327d27..424b5252d5 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.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.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -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.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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.ManaSickness, 60, 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.Projectiles; + +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.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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.ManaSickness, 60, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index 7af402f6d0..2075590404 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.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; - -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.value = Item.buyPrice(0, 0, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.ManaSickness, 60, 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.Projectiles; + +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.value = Item.buyPrice(0, 0, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.ManaSickness, 60, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index c9a520839f..238bb246fa 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Cursed, 60, 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.Projectiles; + +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.value = Item.buyPrice(0, 0, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index 6a6c0212e2..13de9e2212 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = 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"), 10, 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) - { - if (Main.expertMode) - { - player.AddBuff(BuffID.Cursed, 60, 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.Projectiles; + +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.value = Item.buyPrice(0, 0, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = 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"), 10, 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) + { + if (Main.expertMode) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 8efc253e89..1c1b8e899e 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -1,287 +1,287 @@ -using System; -using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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; - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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 diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index 18bfb11e4e..e336ec31c1 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -1,287 +1,287 @@ -using System; -using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - 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] >= 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; - } - } +using System; +using System.Collections.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.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.value = Item.buyPrice(0, 0, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + 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] >= 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 diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index a1895c9d1f..7836e7e6a0 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -1,186 +1,186 @@ -using System; -using System.Collections.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.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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - 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.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 && CalamityGlobalNPC.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) - { - 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); - } - } +using System; +using System.Collections.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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + 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.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 && CalamityGlobalNPC.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) + { + 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 diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index cf7b5013c8..6890826c2f 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,208 +1,208 @@ -using System; -using System.Collections.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.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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityWorld.death) - { - npc.lifeMax = 75000; - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 300000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3000000; - } - 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.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - 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 (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 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) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - 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) - { - 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); - } - } +using System; +using System.Collections.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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityWorld.death) + { + npc.lifeMax = 75000; + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 300000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3000000; + } + 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.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + npc.buffImmune[BuffID.Ichor] = false; + } + 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 (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 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) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + 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) + { + 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 diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 9641dfbd1c..5c6acd9d7e 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.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 Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod; - -namespace CalamityMod.NPCs.StormWeaver -{ - [AutoloadBossHead] - public class StormWeaverHead : ModNPC - { - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 30, 0, 0); - 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 AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (npc.defense < 99999 && CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - npc.defense = 99999; - } - else - { - npc.defense = 0; - } - 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); - } - } - 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 = false; - npc.velocity.Y = npc.velocity.Y + 10f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 10f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityGlobalNPC.DoGSecondStageCountdown = 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); - 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; - } - 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 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) - { - 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 num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBody") || Main.npc[num569].type == mod.NPCType("StormWeaverTail"))) - { - Main.npc[num569].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); - } - } +using System; +using System.Collections.Generic; +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; + +namespace CalamityMod.NPCs.StormWeaver +{ + [AutoloadBossHead] + public class StormWeaverHead : ModNPC + { + 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(0, 30, 0, 0); + 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 AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (npc.defense < 99999 && CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + npc.defense = 99999; + } + else + { + npc.defense = 0; + } + 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); + } + } + 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 = false; + npc.velocity.Y = npc.velocity.Y + 10f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 10f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityGlobalNPC.DoGSecondStageCountdown = 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); + 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; + } + 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 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) + { + 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 num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBody") || Main.npc[num569].type == mod.NPCType("StormWeaverTail"))) + { + Main.npc[num569].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 diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 8a7ac00294..e881bf1409 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -1,542 +1,542 @@ -using System; -using System.Collections.Generic; -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; - -namespace CalamityMod.NPCs.StormWeaver -{ - [AutoloadBossHead] - public class StormWeaverHeadNaked : ModNPC - { - 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) ? 5 : 30; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityWorld.death) - { - npc.lifeMax = 75000; - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 300000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3000000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 30, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - 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.buffImmune[BuffID.Ichor] = false; - } - } - - 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; - } - 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); - } - } - 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 = false; - npc.velocity.Y = npc.velocity.Y + 10f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 10f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - CalamityGlobalNPC.DoGSecondStageCountdown = 0; - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityGlobalNPC.DoGSecondStageCountdown = 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); - 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 && !CalamityWorld.death && !CalamityWorld.bossRushActive) - { - 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 ? 17f : 16f; - num189 = revenge ? 0.5f : 0.45f; - } - 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 && !CalamityWorld.death && !CalamityWorld.bossRushActive) - { - 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) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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) - { - 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() - { - 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); - } - } +using System; +using System.Collections.Generic; +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; + +namespace CalamityMod.NPCs.StormWeaver +{ + [AutoloadBossHead] + public class StormWeaverHeadNaked : ModNPC + { + 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) ? 5 : 30; + private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityWorld.death) + { + npc.lifeMax = 75000; + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 300000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3000000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(0, 30, 0, 0); + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + 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.buffImmune[BuffID.Ichor] = false; + } + } + + 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; + } + 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); + } + } + 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 = false; + npc.velocity.Y = npc.velocity.Y + 10f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 10f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + CalamityGlobalNPC.DoGSecondStageCountdown = 0; + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityGlobalNPC.DoGSecondStageCountdown = 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); + 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 && !CalamityWorld.death && !CalamityWorld.bossRushActive) + { + 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 ? 17f : 16f; + num189 = revenge ? 0.5f : 0.45f; + } + 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 && !CalamityWorld.death && !CalamityWorld.bossRushActive) + { + 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) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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) + { + 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() + { + 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 diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 0a8195c6e9..75f1f30135 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.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; - -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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - 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.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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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) - { - 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); - } - } +using System; +using System.Collections.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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + 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.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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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) + { + 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 diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index b89d18ae3c..25aed3ce27 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,180 +1,180 @@ -using System; -using System.Collections.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.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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (CalamityWorld.death) - { - npc.lifeMax = 75000; - } - if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - npc.lifeMax = 300000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3000000; - } - 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.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - npc.dontCountMe = true; - } - - 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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) - { - 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); - } - } +using System; +using System.Collections.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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (CalamityWorld.death) + { + npc.lifeMax = 75000; + } + if (CalamityGlobalNPC.DoGSecondStageCountdown <= 0) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + npc.lifeMax = 300000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3000000; + } + 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.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + npc.buffImmune[BuffID.Ichor] = false; + } + npc.dontCountMe = true; + } + + 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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) + { + 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 diff --git a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs index bbb08ac602..3ccbb9b065 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(); - } - } +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 diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/SupremeCalamitas/SCalSky.cs index 159ee149cc..92ec2ef37c 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; - } - } +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 diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 458d7d9559..9fa1c46163 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -1,128 +1,128 @@ -using System; -using System.Collections.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.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.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 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; - } - } - } - } +using System; +using System.Collections.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.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.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 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 diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index a9f5bf1602..9d7f9c75b5 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.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; - -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.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 AI() - { - if (damageTaken >= (CalamityWorld.death ? 25000.0 : 10000.0)) - { - npc.dontTakeDamage = true; - } - else - { - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - } - 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 bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (damage > npc.lifeMax / 25) - { - damage = 0; - return false; - } - damageTaken += damage; - if (crit) - { - damageTaken += damage; - } - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } +using System; +using System.Collections.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.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.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 AI() + { + if (damageTaken >= (CalamityWorld.death ? 25000.0 : 10000.0)) + { + npc.dontTakeDamage = true; + } + else + { + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + } + 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 bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (damage > npc.lifeMax / 25) + { + damage = 0; + return false; + } + damageTaken += damage; + if (crit) + { + damageTaken += damage; + } + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } } \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index a65b93ed8b..4368a5114f 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.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; - -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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (NPC.CountNPCS(mod.NPCType("SCalWormHeart")) <= 0 || !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - 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; - } - npc.localAI[1] = 0f; - 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 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; - } - } - } - } +using System; +using System.Collections.Generic; +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; + +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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (NPC.CountNPCS(mod.NPCType("SCalWormHeart")) <= 0) + { + 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; + } + npc.localAI[1] = 0f; + 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 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 diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index 355988156b..a443daef7e 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.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.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 ? 120000 : 100000; - if (CalamityWorld.death) - { - npc.lifeMax = 150000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 80000 : 60000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.noTileCollide = true; - 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 (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - 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.thrown && projectile.penetrate == -1) - { - damage = (int)((double)damage * 0.8); - } - else if (projectile.penetrate == -1) //not a minion and penetrate is infinite - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) //not a minion, penetrate is not infinite, penetrate is greater than 3 - { - damage = (int)((double)damage * 0.4); - } - else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 - { - projectile.penetrate = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } +using System; +using System.Collections.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.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 ? 120000 : 100000; + if (CalamityWorld.death) + { + npc.lifeMax = 150000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 80000 : 60000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.noGravity = true; + npc.noTileCollide = true; + 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) + { + 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.thrown && projectile.penetrate == -1) + { + damage = (int)((double)damage * 0.8); + } + else if (projectile.penetrate == -1) //not a minion and penetrate is infinite + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) //not a minion, penetrate is not infinite, penetrate is greater than 3 + { + damage = (int)((double)damage * 0.4); + } + else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 + { + projectile.penetrate = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } } \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index bd50ba2a3c..e3ec7d7438 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.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; - -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.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 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; - } - } +using System; +using System.Collections.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.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.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 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 diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 2546aea9fe..d4fdc78d32 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,152 +1,156 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SoulSeekerSupreme : ModNPC - { - public int timer = 0; - public 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.damage = 0; - npc.defense = 100; - npc.lifeMax = 5000; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = 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 (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - 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 = 1500; - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SoulSeekerSupreme : ModNPC + { + public int timer = 0; + public 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.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.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 (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + 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 diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 518e925d6f..f6b52f7279 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,2245 +1,2245 @@ -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; - -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 wormAlive = 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 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 Rectangle safeBox = default(Rectangle); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 450; - npc.npcSlots = 50f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; - if (CalamityWorld.death) - { - npc.lifeMax = 6250000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4500000 : 4000000; - } - 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.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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC1"); - } - - public override void AI() - { - #region StartUp - //CalamityGlobalNPC.supremeCalamitas = npc.whoAmI; - lootTimer++; - 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) - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) //works good - { - player.velocity.Y = -100f; - } - 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 (npc.localAI[3] == 0f) - { - npc.localAI[3] = 1f; - 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 - (revenge ? 1500f : 2000f)); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + (revenge ? 1500f : 2000f)); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - (revenge ? 1500f : 2000f)); - safeBox.Width = revenge ? 3000 : 4000; - safeBox.Height = revenge ? 3000 : 4000; - spawnYAdd = revenge ? 150 : 200; - } - 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 (npc.localAI[2] < 900f) - { - despawnProj = true; - npc.localAI[2] += 1f; - 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) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 4f : 6f)) - { - npc.localAI[0] = 0f; - int damage = expertMode ? 200 : 250; //800 500 - if (npc.localAI[2] < 300f) //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 (npc.localAI[2] < 600f) //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 += 400; - if (revenge) - { - spawnY -= 100; - } - if (CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - else if (CalamityWorld.death) - { - spawnY -= 100; - } - for (int x = 0; x < 5; x++) - { - int heart = NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, heart, 0f, 0f, 0f, 0, 0, 0); - } - int heart2 = NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, heart2, 0f, 0f, 0f, 0, 0, 0); - } - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - startBattle = true; - } - #endregion - #region SecondAttack - if (npc.localAI[2] < 1800f && startSecondAttack) - { - despawnProj = true; - npc.localAI[2] += 1f; - 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 (npc.localAI[2] < 1200f) - { - if (npc.localAI[2] % 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 (npc.localAI[2] < 1500f && npc.localAI[2] > 1200f) - { - if (npc.localAI[2] % 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 (npc.localAI[2] > 1500f) - { - if (npc.localAI[2] % 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); - } - } - npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 6f : 9f)) - { - npc.localAI[0] = 0f; - if (npc.localAI[2] < 1200f) //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 (npc.localAI[2] < 1500f) //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 (npc.localAI[2] < 2700f && startThirdAttack) - { - despawnProj = true; - npc.localAI[2] += 1f; - 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 ? 160 : 210; //640 420 - if (npc.localAI[2] % 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 (npc.localAI[2] % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 9f : 11f)) - { - npc.localAI[0] = 0f; - if (npc.localAI[2] < 2100f) //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 (npc.localAI[2] < 2400f) //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)) - { - 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 (npc.localAI[2] < 3600f && startFourthAttack) - { - despawnProj = true; - npc.localAI[2] += 1f; - 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 ? 175 : 220; //700 440 - if (npc.localAI[2] % 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 (npc.localAI[2] % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (npc.localAI[2] % 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; - } - npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 12f : 15f)) - { - npc.localAI[0] = 0f; - if (npc.localAI[2] < 3000f) //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 (npc.localAI[2] < 3300f) //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)) - { - 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 (npc.localAI[2] < 4500f && startFifthAttack) - { - despawnProj = true; - npc.localAI[2] += 1f; - 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 ? 200 : 250; //800 500 - if (npc.localAI[2] % 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 (npc.localAI[2] % 360 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (npc.localAI[2] % 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 (npc.localAI[2] % 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); - } - npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 15f : 18f)) - { - npc.localAI[0] = 0f; - if (npc.localAI[2] < 3900f) //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 (npc.localAI[2] < 4200f) //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) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC1"); - npc.noGravity = false; - npc.noTileCollide = false; - npc.damage = 0; - npc.velocity.X *= 0.98f; - npc.velocity.Y = 5f; - 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 (player.GetModPlayer(mod).sCalKillCount > 0) //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 += 400; - if (revenge) - { - spawnY -= 100; - } - if (CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - else if (CalamityWorld.death) - { - spawnY -= 100; - } - for (int x = 0; x < 5; x++) - { - int heart = NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, heart, 0f, 0f, 0f, 0, 0, 0); - } - int heart2 = NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, heart2, 0f, 0f, 0f, 0, 0, 0); - } - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - gettingTired = true; - return; - } - } - #endregion - #region DespawnProjectiles - if (npc.localAI[2] % 900 == 0 && despawnProj) - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || - projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || - projectile.type == mod.ProjectileType("BrimstoneBarrage") || - projectile.type == mod.ProjectileType("BrimstoneFireblast") || - projectile.type == mod.ProjectileType("BrimstoneWave"))) - { - projectile.Kill(); - } - 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) * 1500)), (int)(npc.Center.Y + (Math.Cos(I * 18) * 1500)), 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC2"); - if (NPC.AnyNPCs(mod.NPCType("SCalWormHead"))) - { - wormAlive = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - if (NPC.AnyNPCs(mod.NPCType("SupremeCataclysm")) || NPC.AnyNPCs(mod.NPCType("SupremeCatastrophe"))) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - npc.dontTakeDamage = false; - npc.chaseable = true; - } - wormAlive = false; - } - 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) - { - 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 <= 4) - { - 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); - } - } - else - { - 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); - } - 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; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC3"); - if (NPC.AnyNPCs(mod.NPCType("SCalWormHead"))) - { - wormAlive = true; - 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; - } - wormAlive = false; - } - 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) - { - 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; - int shot = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot <= 4) - { - 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, num182, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - else - { - 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; - int shot = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, 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 Color? GetAlpha(Color drawColor) - { - if (willCharge) - return new Color(100, 0, 0, 0); - return null; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("SupremeHealingPotion"); - } - - 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; - } - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) - { - damage /= 25; - } - } - - 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 (CalamityWorld.defiled) - { - protection += (1f - protection) * 0.5f; - } - 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 += 1.0; - if (npc.frameCounter < 7.0) - { - npc.frame.Y = 0; - } - else if (npc.frameCounter < 14.0) - { - npc.frame.Y = frameHeight; - } - else if (npc.frameCounter < 21.0) - { - npc.frame.Y = frameHeight * 2; - } - else - { - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - if (npc.ai[0] > 1f) - { - npc.frame.Y = npc.frame.Y + frameHeight * 3; - return; - } - } - - 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); - } - } - } +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; + +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 wormAlive = 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 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 Rectangle safeBox = default(Rectangle); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 450; + npc.npcSlots = 50f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; + if (CalamityWorld.death) + { + npc.lifeMax = 6250000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4500000 : 4000000; + } + 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.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; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC1"); + } + + public override void AI() + { + #region StartUp + CalamityGlobalNPC.SCal = npc.whoAmI; + lootTimer++; + 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) + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) //works good + { + player.velocity.Y = -100f; + } + 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 (npc.localAI[3] == 0f) + { + npc.localAI[3] = 1f; + 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 - (revenge ? 1500f : 2000f)); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + (revenge ? 1500f : 2000f)); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - (revenge ? 1500f : 2000f)); + safeBox.Width = revenge ? 3000 : 4000; + safeBox.Height = revenge ? 3000 : 4000; + spawnYAdd = revenge ? 150 : 200; + } + 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 (npc.localAI[2] < 900f) + { + despawnProj = true; + npc.localAI[2] += 1f; + 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) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 4f : 6f)) + { + npc.localAI[0] = 0f; + int damage = expertMode ? 200 : 250; //800 500 + if (npc.localAI[2] < 300f) //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 (npc.localAI[2] < 600f) //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 += 400; + if (revenge) + { + spawnY -= 100; + } + if (CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + else if (CalamityWorld.death) + { + spawnY -= 100; + } + for (int x = 0; x < 5; x++) + { + int heart = NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, heart, 0f, 0f, 0f, 0, 0, 0); + } + int heart2 = NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, heart2, 0f, 0f, 0f, 0, 0, 0); + } + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + startBattle = true; + } + #endregion + #region SecondAttack + if (npc.localAI[2] < 1800f && startSecondAttack) + { + despawnProj = true; + npc.localAI[2] += 1f; + 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 (npc.localAI[2] < 1200f) + { + if (npc.localAI[2] % 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 (npc.localAI[2] < 1500f && npc.localAI[2] > 1200f) + { + if (npc.localAI[2] % 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 (npc.localAI[2] > 1500f) + { + if (npc.localAI[2] % 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); + } + } + npc.localAI[0] += 1f; + if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 6f : 9f)) + { + npc.localAI[0] = 0f; + if (npc.localAI[2] < 1200f) //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 (npc.localAI[2] < 1500f) //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 (npc.localAI[2] < 2700f && startThirdAttack) + { + despawnProj = true; + npc.localAI[2] += 1f; + 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 ? 160 : 210; //640 420 + if (npc.localAI[2] % 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 (npc.localAI[2] % 240 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.localAI[0] += 1f; + if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 9f : 11f)) + { + npc.localAI[0] = 0f; + if (npc.localAI[2] < 2100f) //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 (npc.localAI[2] < 2400f) //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)) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC2"); + 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 (npc.localAI[2] < 3600f && startFourthAttack) + { + despawnProj = true; + npc.localAI[2] += 1f; + 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 ? 175 : 220; //700 440 + if (npc.localAI[2] % 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 (npc.localAI[2] % 240 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (npc.localAI[2] % 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; + } + npc.localAI[0] += 1f; + if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 12f : 15f)) + { + npc.localAI[0] = 0f; + if (npc.localAI[2] < 3000f) //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 (npc.localAI[2] < 3300f) //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)) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC3"); + 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 (npc.localAI[2] < 4500f && startFifthAttack) + { + despawnProj = true; + npc.localAI[2] += 1f; + 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 ? 200 : 250; //800 500 + if (npc.localAI[2] % 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 (npc.localAI[2] % 360 == 0) //fireblasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (npc.localAI[2] % 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 (npc.localAI[2] % 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); + } + npc.localAI[0] += 1f; + if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 15f : 18f)) + { + npc.localAI[0] = 0f; + if (npc.localAI[2] < 3900f) //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 (npc.localAI[2] < 4200f) //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) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/SC4"); + npc.noGravity = false; + npc.noTileCollide = false; + npc.damage = 0; + npc.velocity.X *= 0.98f; + npc.velocity.Y = 5f; + 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 (player.GetModPlayer(mod).sCalKillCount > 0) //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 += 400; + if (revenge) + { + spawnY -= 100; + } + if (CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + else if (CalamityWorld.death) + { + spawnY -= 100; + } + for (int x = 0; x < 5; x++) + { + int heart = NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, heart, 0f, 0f, 0f, 0, 0, 0); + } + int heart2 = NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, heart2, 0f, 0f, 0f, 0, 0, 0); + } + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + gettingTired = true; + return; + } + } + #endregion + #region DespawnProjectiles + if (npc.localAI[2] % 900 == 0 && despawnProj) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || + projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || + projectile.type == mod.ProjectileType("BrimstoneBarrage") || + projectile.type == mod.ProjectileType("BrimstoneFireblast") || + projectile.type == mod.ProjectileType("BrimstoneWave"))) + { + projectile.Kill(); + } + 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 (NPC.AnyNPCs(mod.NPCType("SCalWormHead"))) + { + wormAlive = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + if (NPC.AnyNPCs(mod.NPCType("SupremeCataclysm")) || NPC.AnyNPCs(mod.NPCType("SupremeCatastrophe"))) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + npc.dontTakeDamage = false; + npc.chaseable = true; + } + wormAlive = false; + } + 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) + { + 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 <= 4) + { + 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); + } + } + else + { + 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); + } + 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 (NPC.AnyNPCs(mod.NPCType("SCalWormHead"))) + { + wormAlive = true; + 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; + } + wormAlive = false; + } + 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) + { + 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; + int shot = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else if (randomShot <= 4) + { + 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, num182, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + } + else + { + 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; + int shot = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, 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 Color? GetAlpha(Color drawColor) + { + if (willCharge) + return new Color(100, 0, 0, 0); + return null; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("SupremeHealingPotion"); + } + + 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; + } + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) + { + damage /= 25; + } + } + + 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 (CalamityWorld.defiled) + { + protection += (1f - protection) * 0.5f; + } + 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 += 1.0; + if (npc.frameCounter < 7.0) + { + npc.frame.Y = 0; + } + else if (npc.frameCounter < 14.0) + { + npc.frame.Y = frameHeight; + } + else if (npc.frameCounter < 21.0) + { + npc.frame.Y = frameHeight * 2; + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + if (npc.ai[0] > 1f) + { + npc.frame.Y = npc.frame.Y + frameHeight * 3; + return; + } + } + + 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 diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index a2ca4c1032..c0a36fb80f 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,184 +1,184 @@ -using System; -using System.Collections.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.SupremeCalamitas -{ - [AutoloadBossHead] - public class SupremeCataclysm : ModNPC - { - public float distanceX = 250f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 150; - animationType = 126; - npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; - if (CalamityWorld.death) - { - npc.lifeMax = 500000; - } - 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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceY = 450f; - if (npc.localAI[1] <= 1000f) - { - npc.localAI[1] += 1f; - distanceX += 0.5f; - } - else if (npc.localAI[1] <= 2000f) - { - npc.localAI[1] += 1f; - distanceX -= 0.5f; - } - if (npc.localAI[1] >= 2000f) - { - npc.localAI[1] = 0f; - } - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); - float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; - float num740 = Main.player[npc.target].Center.X - vector83.X; - float num741 = Main.player[npc.target].Center.Y - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - 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; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] > 150f) - { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 2f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneHellblast"); - float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; - float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; - float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); - num694 = num689 / num694; - num692 *= num694; - num693 *= num694; - vector85.X += num692 * 3f; - vector85.Y += num693 * 3f; - if (Main.netMode != 1) - { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - - 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; - } - } - } - } +using System; +using System.Collections.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.SupremeCalamitas +{ + [AutoloadBossHead] + public class SupremeCataclysm : ModNPC + { + public float distanceX = 250f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 150; + animationType = 126; + npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; + if (CalamityWorld.death) + { + npc.lifeMax = 500000; + } + 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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + if (CalamityGlobalNPC.SCal <= 0) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + float num676 = 60f; + float num677 = 1.5f; + float distanceY = 450f; + if (npc.localAI[1] <= 1000f) + { + npc.localAI[1] += 1f; + distanceX += 0.5f; + } + else if (npc.localAI[1] <= 2000f) + { + npc.localAI[1] += 1f; + distanceX -= 0.5f; + } + if (npc.localAI[1] >= 2000f) + { + npc.localAI[1] = 0f; + } + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; + float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; + float num740 = Main.player[npc.target].Center.X - vector83.X; + float num741 = Main.player[npc.target].Center.Y - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + 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; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] > 150f) + { + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = 2f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneHellblast"); + float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; + float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; + float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); + num694 = num689 / num694; + num692 *= num694; + num693 *= num694; + vector85.X += num692 * 3f; + vector85.Y += num693 * 3f; + if (Main.netMode != 1) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + + 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 diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index bd53832a78..120d82f7b6 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,184 +1,184 @@ -using System; -using System.Collections.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.SupremeCalamitas -{ - [AutoloadBossHead] - public class SupremeCatastrophe : ModNPC - { - public float distanceX = 250f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 150; - animationType = 126; - npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; - if (CalamityWorld.death) - { - npc.lifeMax = 500000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = 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 AI() - { - bool expertMode = Main.expertMode; - if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceY = 450f; - if (npc.localAI[1] <= 1000f) - { - npc.localAI[1] += 1f; - distanceX += 0.5f; - } - else if (npc.localAI[1] <= 2000f) - { - npc.localAI[1] += 1f; - distanceX -= 0.5f; - } - if (npc.localAI[1] >= 2000f) - { - npc.localAI[1] = 0f; - } - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); - float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; - float num740 = Main.player[npc.target].Center.X - vector83.X; - float num741 = Main.player[npc.target].Center.Y - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - 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; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 150f) - { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 2f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneHellblast"); - float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; - float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; - float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); - num694 = num689 / num694; - num692 *= num694; - num693 *= num694; - vector85.X += num692 * 3f; - vector85.Y += num693 * 3f; - if (Main.netMode != 1) - { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - - 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; - } - } - } - } +using System; +using System.Collections.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.SupremeCalamitas +{ + [AutoloadBossHead] + public class SupremeCatastrophe : ModNPC + { + public float distanceX = 250f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 150; + animationType = 126; + npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; + if (CalamityWorld.death) + { + npc.lifeMax = 500000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = 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 AI() + { + bool expertMode = Main.expertMode; + if (CalamityGlobalNPC.SCal <= 0) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + float num676 = 60f; + float num677 = 1.5f; + float distanceY = 450f; + if (npc.localAI[1] <= 1000f) + { + npc.localAI[1] += 1f; + distanceX += 0.5f; + } + else if (npc.localAI[1] <= 2000f) + { + npc.localAI[1] += 1f; + distanceX -= 0.5f; + } + if (npc.localAI[1] >= 2000f) + { + npc.localAI[1] = 0f; + } + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; + float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; + float num740 = Main.player[npc.target].Center.X - vector83.X; + float num741 = Main.player[npc.target].Center.Y - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + 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; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 150f) + { + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = 2f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneHellblast"); + float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; + float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; + float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); + num694 = num689 / num694; + num692 *= num694; + num693 *= num694; + vector85.X += num692 * 3f; + vector85.Y += num693 * 3f; + if (Main.netMode != 1) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + + 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 diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index 52313f4c39..349244889d 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -1,248 +1,248 @@ -using System; -using System.Collections.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.TheDevourerofGods -{ - public class DevourerofGodsBody : ModNPC - { - public 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; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.5f; - } - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - 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 = 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) - { - damage = 0; - return false; - } - double protection = CalamityWorld.death ? 0.05 : 0.08; - if (CalamityWorld.defiled) - { - protection *= 0.75; - } - damage = (int)((double)damage * protection); - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage /= 2; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - if (projectile.minion) - { - return; - } - if (projectile.penetrate == -1) //not a minion and penetrate is infinite - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 - { - damage = (int)((double)damage * 0.7); - } - else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 - { - projectile.penetrate = 1; - } - } - - public override bool CheckActive() - { - 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"), 150, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 200, true); - player.AddBuff(BuffID.Darkness, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsBody : ModNPC + { + public 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; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.5f; + } + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + 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 = 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) + { + damage = 0; + return false; + } + double protection = CalamityWorld.death ? 0.05 : 0.08; + if (CalamityWorld.defiled) + { + protection *= 0.75; + } + damage = (int)((double)damage * protection); + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage /= 2; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + if (projectile.minion) + { + return; + } + if (projectile.penetrate == -1) //not a minion and penetrate is infinite + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 + { + damage = (int)((double)damage * 0.7); + } + else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 + { + projectile.penetrate = 1; + } + } + + public override bool CheckActive() + { + 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"), 150, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 200, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index 0f100dfdf4..bb3e13b0a9 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -1,161 +1,161 @@ -using System; -using System.Collections.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.TheDevourerofGods -{ - public class DevourerofGodsBody2 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Thots"); - } - - 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.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() - { - 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 = 300; - 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) - { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - damage = (int)((double)damage * 0.66f); - 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/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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 60, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 200, true); - player.AddBuff(BuffID.Darkness, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsBody2 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Thots"); + } + + 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.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() + { + 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 = 300; + 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) + { + if (damage > npc.lifeMax / 2) + { + damage = 0; + return false; + } + damage = (int)((double)damage * 0.66f); + 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/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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 60, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 200, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 308fea2f2a..03b590040f 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -1,487 +1,487 @@ -using System; -using System.Collections.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.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsBodyS : ModNPC - { - public double damageTaken = 0.0; - public int invinceTime = 360; - - 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 ? 625000 : 550000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 1020000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase - bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase - bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase - bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - else if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - npc.damage = expertMode ? 352 : 220; - npc.dontTakeDamage = false; - npc.alpha = 0; - } - } - float fallSpeed = 16f; - float turnSpeed = 0.3f; - float speed = fallSpeed; - if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) - { - if (speedBoost4 || CalamityWorld.death) - { - speed = 26f; - turnSpeed = 0.53f; - } - else if (speedBoost3) - { - speed = 21.5f; - turnSpeed = 0.43f; - } - else if (speedBoost2) - { - speed = 20.5f; - turnSpeed = 0.39f; - } - else if (speedBoost1) - { - speed = 19f; - turnSpeed = 0.36f; - } - } - else - { - turnSpeed = 0.2f; - if (speedBoost4 || CalamityWorld.death) - { - turnSpeed = 0.4f; - speed = 28f; - } - else if (speedBoost3) - { - turnSpeed = 0.29f; - speed = 22f; - } - else if (speedBoost2) - { - turnSpeed = 0.25f; - speed = 20f; - } - else if (speedBoost1) - { - turnSpeed = 0.22f; - speed = 18f; - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - else - { - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - } - - 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) - { - damage = 0; - return false; - } - damageTaken += (crit ? (damage * 2) : damage); - double protection = CalamityWorld.death ? 0.01 : 0.015; - if (CalamityWorld.defiled) - { - protection *= 0.75; - } - if (damageTaken >= 5000.0) - { - damage = (int)((double)damage * protection); - } - else - { - damage = (int)((double)damage * 0.1); - } - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage /= 2; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - if (projectile.minion) - { - return; - } - if (projectile.penetrate == -1) //not a minion and penetrate is infinite - { - damage = (int)((double)damage * 0.15); - } - else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 - { - damage = (int)((double)damage * 0.7); - } - else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 - { - projectile.penetrate = 1; - } - } - - public override bool CheckActive() - { - 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"), 150, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 200, true); - player.AddBuff(BuffID.Darkness, 100, 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.Projectiles; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsBodyS : ModNPC + { + public double damageTaken = 0.0; + public int invinceTime = 360; + + 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 ? 625000 : 550000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 1020000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase + bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase + bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase + bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + else if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + npc.damage = expertMode ? 352 : 220; + npc.dontTakeDamage = false; + npc.alpha = 0; + } + } + float fallSpeed = 16f; + float turnSpeed = 0.3f; + float speed = fallSpeed; + if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) + { + if (speedBoost4 || CalamityWorld.death) + { + speed = 26f; + turnSpeed = 0.53f; + } + else if (speedBoost3) + { + speed = 21.5f; + turnSpeed = 0.43f; + } + else if (speedBoost2) + { + speed = 20.5f; + turnSpeed = 0.39f; + } + else if (speedBoost1) + { + speed = 19f; + turnSpeed = 0.36f; + } + } + else + { + turnSpeed = 0.2f; + if (speedBoost4 || CalamityWorld.death) + { + turnSpeed = 0.4f; + speed = 28f; + } + else if (speedBoost3) + { + turnSpeed = 0.29f; + speed = 22f; + } + else if (speedBoost2) + { + turnSpeed = 0.25f; + speed = 20f; + } + else if (speedBoost1) + { + turnSpeed = 0.22f; + speed = 18f; + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + else + { + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + } + + 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) + { + damage = 0; + return false; + } + damageTaken += (crit ? (damage * 2) : damage); + double protection = CalamityWorld.death ? 0.01 : 0.015; + if (CalamityWorld.defiled) + { + protection *= 0.75; + } + if (damageTaken >= 5000.0) + { + damage = (int)((double)damage * protection); + } + else + { + damage = (int)((double)damage * 0.1); + } + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage /= 2; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + if (projectile.minion) + { + return; + } + if (projectile.penetrate == -1) //not a minion and penetrate is infinite + { + damage = (int)((double)damage * 0.15); + } + else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 + { + damage = (int)((double)damage * 0.7); + } + else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 + { + projectile.penetrate = 1; + } + } + + public override bool CheckActive() + { + 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"), 150, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 200, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index a6540a3ebe..7ae4ffd1fc 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -1,978 +1,978 @@ -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; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsHead : ModNPC - { - private bool tail = false; - private const int minLength = 100; - private const int maxLength = 101; - private bool halfLife = false; - private bool halfLife2 = false; - private int spawnDoGCountdown = 0; - private float phaseSwitch = 0f; - - 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; - } - 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(5, 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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - if (Main.expertMode) - { - npc.scale = 1.5f; - } - } - - public override void AI() - { - CalamityGlobalNPC.DoGHead = npc.whoAmI; - float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); - if (playerRunAcceleration <= 1f) - { - playerRunAcceleration = 1f; - } - if (Main.raining) - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - Vector2 vector = npc.Center; - 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) - { - npc.TargetClosest(false); - flies = false; - npc.velocity.Y = npc.velocity.Y + 10f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 10f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - 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[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("Warped"), 2); - } - } - phaseSwitch += 1f; - npc.localAI[1] = 0f; - float speed = playerRunAcceleration * 15f; - float turnSpeed = playerRunAcceleration * 0.3f; - float homingSpeed = playerRunAcceleration * 18f; - float homingTurnSpeed = playerRunAcceleration * 0.33f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - phaseSwitch += 9f; - } - else if ((expertMode && speedBoost5) || CalamityWorld.death) - { - homingSpeed = playerRunAcceleration * 25f; - homingTurnSpeed = playerRunAcceleration * 0.52f; - } - else if (speedBoost4) - { - homingSpeed = playerRunAcceleration * 23f; - homingTurnSpeed = playerRunAcceleration * 0.47f; - } - else if (speedBoost3) - { - homingSpeed = playerRunAcceleration * 21.5f; - homingTurnSpeed = playerRunAcceleration * 0.43f; - } - else if (speedBoost2) - { - homingSpeed = playerRunAcceleration * 20.5f; - homingTurnSpeed = playerRunAcceleration * 0.39f; - } - else if (speedBoost1) - { - homingSpeed = playerRunAcceleration * 19f; - homingTurnSpeed = playerRunAcceleration * 0.36f; - } - float num188 = speed; - float 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 > 900f) - { - npc.ai[2] = 1f; - phaseSwitch = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[2] == 1f) - { - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - } - phaseSwitch += 1f; - float speed = playerRunAcceleration * 19f; - float turnSpeed = playerRunAcceleration * 0.28f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - speed = playerRunAcceleration * 80f; - turnSpeed = playerRunAcceleration * 1f; - } - else if ((expertMode && speedBoost5) || CalamityWorld.death) - { - speed = playerRunAcceleration * 26f; - turnSpeed = playerRunAcceleration * 0.45f; - } - else if (speedBoost4) - { - speed = playerRunAcceleration * 24.5f; - turnSpeed = playerRunAcceleration * 0.4f; - } - else if (speedBoost3) - { - speed = playerRunAcceleration * 23f; - turnSpeed = playerRunAcceleration * 0.36f; - } - else if (speedBoost2) - { - speed = playerRunAcceleration * 21.5f; - turnSpeed = playerRunAcceleration * 0.33f; - } - else if (speedBoost1) - { - speed = playerRunAcceleration * 20f; - turnSpeed = playerRunAcceleration * 0.3f; - } - if (!flies) - { - 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 > 900f) - { - npc.ai[2] = 0f; - phaseSwitch = 0f; - 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) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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"), 150, 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); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 400, true); - player.AddBuff(BuffID.Darkness, 400, true); - } - } - } +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; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsHead : ModNPC + { + private bool tail = false; + private const int minLength = 100; + private const int maxLength = 101; + private bool halfLife = false; + private bool halfLife2 = false; + private int spawnDoGCountdown = 0; + private float phaseSwitch = 0f; + + 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; + } + 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(5, 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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + if (Main.expertMode) + { + npc.scale = 1.5f; + } + } + + public override void AI() + { + CalamityGlobalNPC.DoGHead = npc.whoAmI; + float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); + if (playerRunAcceleration <= 1f) + { + playerRunAcceleration = 1f; + } + if (Main.raining) + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + Vector2 vector = npc.Center; + 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) + { + npc.TargetClosest(false); + flies = false; + npc.velocity.Y = npc.velocity.Y + 10f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 10f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + 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[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("Warped"), 2); + } + } + phaseSwitch += 1f; + npc.localAI[1] = 0f; + float speed = playerRunAcceleration * 15f; + float turnSpeed = playerRunAcceleration * 0.3f; + float homingSpeed = playerRunAcceleration * 18f; + float homingTurnSpeed = playerRunAcceleration * 0.33f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + phaseSwitch += 9f; + } + else if ((expertMode && speedBoost5) || CalamityWorld.death) + { + homingSpeed = playerRunAcceleration * 25f; + homingTurnSpeed = playerRunAcceleration * 0.52f; + } + else if (speedBoost4) + { + homingSpeed = playerRunAcceleration * 23f; + homingTurnSpeed = playerRunAcceleration * 0.47f; + } + else if (speedBoost3) + { + homingSpeed = playerRunAcceleration * 21.5f; + homingTurnSpeed = playerRunAcceleration * 0.43f; + } + else if (speedBoost2) + { + homingSpeed = playerRunAcceleration * 20.5f; + homingTurnSpeed = playerRunAcceleration * 0.39f; + } + else if (speedBoost1) + { + homingSpeed = playerRunAcceleration * 19f; + homingTurnSpeed = playerRunAcceleration * 0.36f; + } + float num188 = speed; + float 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 > 900f) + { + npc.ai[2] = 1f; + phaseSwitch = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[2] == 1f) + { + if (Main.netMode != 2) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + } + phaseSwitch += 1f; + float speed = playerRunAcceleration * 19f; + float turnSpeed = playerRunAcceleration * 0.28f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + speed = playerRunAcceleration * 80f; + turnSpeed = playerRunAcceleration * 1f; + } + else if ((expertMode && speedBoost5) || CalamityWorld.death) + { + speed = playerRunAcceleration * 26f; + turnSpeed = playerRunAcceleration * 0.45f; + } + else if (speedBoost4) + { + speed = playerRunAcceleration * 24.5f; + turnSpeed = playerRunAcceleration * 0.4f; + } + else if (speedBoost3) + { + speed = playerRunAcceleration * 23f; + turnSpeed = playerRunAcceleration * 0.36f; + } + else if (speedBoost2) + { + speed = playerRunAcceleration * 21.5f; + turnSpeed = playerRunAcceleration * 0.33f; + } + else if (speedBoost1) + { + speed = playerRunAcceleration * 20f; + turnSpeed = playerRunAcceleration * 0.3f; + } + if (!flies) + { + 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 > 900f) + { + npc.ai[2] = 0f; + phaseSwitch = 0f; + 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) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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"), 150, 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); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 400, true); + player.AddBuff(BuffID.Darkness, 400, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs index 95adeeed84..dc0861f062 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; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsHead2 : ModNPC - { - public bool tail = false; - public bool flies = false; - public const int minLength = 15; - public const int maxLength = 16; - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Thots"); - } - - 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.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; - } - } - - public override void AI() - { - float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); - if (playerRunAcceleration <= 1f) - { - playerRunAcceleration = 1f; - } - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = 600; - npc.dontTakeDamage = false; - } - Vector2 vector = npc.Center; - bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - 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 (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - flies = false; - npc.velocity.Y = npc.velocity.Y + 10f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 10f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - 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; - 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) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - } - - 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? 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 400, true); - player.AddBuff(BuffID.Darkness, 400, true); - } - } - } +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; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsHead2 : ModNPC + { + public bool tail = false; + public bool flies = false; + public const int minLength = 15; + public const int maxLength = 16; + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Thots"); + } + + 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.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; + } + } + + public override void AI() + { + float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); + if (playerRunAcceleration <= 1f) + { + playerRunAcceleration = 1f; + } + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = 600; + npc.dontTakeDamage = false; + } + Vector2 vector = npc.Center; + bool expertMode = Main.expertMode; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) + { + 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 (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + flies = false; + npc.velocity.Y = npc.velocity.Y + 10f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 10f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + 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; + 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) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + } + + 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? 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 400, true); + player.AddBuff(BuffID.Darkness, 400, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 0d6272f44a..075f740d72 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -1,1211 +1,1211 @@ -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; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsHeadS : ModNPC - { - private bool tail = false; - private const int minLength = 120; - private const int maxLength = 121; - private bool halfLife = false; - private int flameTimer = 900; - private int laserShoot = 0; - private float phaseSwitch = 0f; - private float[] shotSpacing = new float[4] { 1000f, 1000f, 1000f, 1000f }; - private const float spacingVar = 100; - private const int totalShots = 20; - private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - private double damageTaken = 0.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 ? 625000 : 550000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 1020000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; - } - npc.takenDamageMultiplier = 1.25f; - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.scale = 1.1f; - npc.boss = true; - npc.value = Item.buyPrice(5, 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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - bossBag = mod.ItemType("DevourerofGodsBag"); - } - - 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 (npc.localAI[3] == 0f) - { - if (Main.netMode != 1) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 720f) - { - npc.localAI[2] = 0f; - npc.localAI[3] = 1f; - npc.netUpdate = true; - } - } - } - else if (npc.localAI[3] == 1f) - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.alpha += 5; - if (npc.alpha == 255) - { - laserShoot = 0; - } - if (npc.alpha >= 255) - { - npc.alpha = 255; - idleCounter--; - if (idleCounter <= 0) - { - npc.localAI[3] = 2f; - idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - npc.netUpdate = true; - } - } - } - else if (npc.localAI[3] == 2f) - { - npc.alpha -= 1; - if (npc.alpha <= 0) - { - if (flameTimer < 270) - { - flameTimer = 270; - } - npc.damage = expertMode ? 480 : 300; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - } - } - else - { - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.dontTakeDamage || npc.localAI[3] > 0f) - { - npc.damage = expertMode ? 480 : 300; - npc.dontTakeDamage = false; - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - } - 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 && (npc.localAI[3] == 1f || npc.GetGlobalNPC(mod).enraged)) - { - laserShoot += 3; - if (laserShoot >= 2400) - { - laserShoot = 0; - } - float speed = (CalamityWorld.bossRushActive ? 4.5f : 4f); - if (laserShoot % (CalamityWorld.bossRushActive ? 210 : (CalamityWorld.death ? 240 : 300)) == 0) //300 600 900 1200 1500 1800 2100 2400 - { - Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); - float targetPosY = Main.player[npc.target].position.Y + (Main.rand.Next(2) == 0 ? 50f : 0f); - int extraLasers = Main.rand.Next(2); - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[0] -= spacingVar; //100 - } - if (extraLasers == 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - for (int x = 0; x < 10; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 170f : 190f); //100 - } - this.shotSpacing[3] = 1000f; - } - this.shotSpacing[0] = 1000f; - } - if (laserShoot % (CalamityWorld.bossRushActive ? 300 : (CalamityWorld.death ? 360 : 450)) == 0) //480 960 1440 1920 2400 - { - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[1] -= spacingVar; //100 - } - this.shotSpacing[1] = 1000f; - } - if (laserShoot % (CalamityWorld.bossRushActive ? 420 : (CalamityWorld.death ? 480 : 600)) == 0) //600 1200 1800 2400 - { - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[2] -= spacingVar; //100 - } - this.shotSpacing[2] = 1000f; - } - } - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) - { - npc.active = false; - } - float fallSpeed = 16f; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - flies = false; - npc.velocity.Y = npc.velocity.Y + 20f; - fallSpeed = 48f; - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - 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.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[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("Warped"), 2); - } - } - phaseSwitch += 1f; - npc.localAI[1] = 0f; - float speed = 15f; - float turnSpeed = 0.4f; - float homingSpeed = 24f; - float homingTurnSpeed = 0.5f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - phaseSwitch += 9f; - } - float num188 = speed; - float 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) ? 600f : 900f)) - { - npc.ai[2] = 1f; - phaseSwitch = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[2] == 1f) - { - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - } - phaseSwitch += 1f; - float turnSpeed = 0.3f; - bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - turnSpeed = 1.5f; - } - else if (increaseSpeed) - { - turnSpeed = 1f; - } - if (!flies) - { - 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) ? 600f : 900f)) - { - npc.ai[2] = 0f; - phaseSwitch = 0f; - 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) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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; - } - double multiplier = 1.0; - if (CalamityWorld.defiled) - { - multiplier = 0.75; - } - damageTaken += (crit ? (damage * 2) : damage); - damage = (int)((double)damage * multiplier); - if (damageTaken >= 50000.0) - { - damage = (int)((double)damage * 0.5); - } - 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/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"), 150, 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); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 400, true); - player.AddBuff(BuffID.Darkness, 400, true); - } - } - } +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; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsHeadS : ModNPC + { + private bool tail = false; + private const int minLength = 120; + private const int maxLength = 121; + private bool halfLife = false; + private int flameTimer = 900; + private int laserShoot = 0; + private float phaseSwitch = 0f; + private float[] shotSpacing = new float[4] { 1000f, 1000f, 1000f, 1000f }; + private const float spacingVar = 100; + private const int totalShots = 20; + private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + private double damageTaken = 0.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 ? 625000 : 550000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 1020000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; + } + npc.takenDamageMultiplier = 1.25f; + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.scale = 1.1f; + npc.boss = true; + npc.value = Item.buyPrice(5, 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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + bossBag = mod.ItemType("DevourerofGodsBag"); + } + + 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 (npc.localAI[3] == 0f) + { + if (Main.netMode != 1) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 720f) + { + npc.localAI[2] = 0f; + npc.localAI[3] = 1f; + npc.netUpdate = true; + } + } + } + else if (npc.localAI[3] == 1f) + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.alpha += 5; + if (npc.alpha == 255) + { + laserShoot = 0; + } + if (npc.alpha >= 255) + { + npc.alpha = 255; + idleCounter--; + if (idleCounter <= 0) + { + npc.localAI[3] = 2f; + idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + npc.netUpdate = true; + } + } + } + else if (npc.localAI[3] == 2f) + { + npc.alpha -= 1; + if (npc.alpha <= 0) + { + if (flameTimer < 270) + { + flameTimer = 270; + } + npc.damage = expertMode ? 480 : 300; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + } + } + else + { + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.dontTakeDamage || npc.localAI[3] > 0f) + { + npc.damage = expertMode ? 480 : 300; + npc.dontTakeDamage = false; + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + } + 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 && (npc.localAI[3] == 1f || npc.GetGlobalNPC(mod).enraged)) + { + laserShoot += 3; + if (laserShoot >= 2400) + { + laserShoot = 0; + } + float speed = (CalamityWorld.bossRushActive ? 4.5f : 4f); + if (laserShoot % (CalamityWorld.bossRushActive ? 210 : (CalamityWorld.death ? 240 : 300)) == 0) //300 600 900 1200 1500 1800 2100 2400 + { + Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); + float targetPosY = Main.player[npc.target].position.Y + (Main.rand.Next(2) == 0 ? 50f : 0f); + int extraLasers = Main.rand.Next(2); + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[0] -= spacingVar; //100 + } + if (extraLasers == 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + for (int x = 0; x < 10; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 170f : 190f); //100 + } + this.shotSpacing[3] = 1000f; + } + this.shotSpacing[0] = 1000f; + } + if (laserShoot % (CalamityWorld.bossRushActive ? 300 : (CalamityWorld.death ? 360 : 450)) == 0) //480 960 1440 1920 2400 + { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[1] -= spacingVar; //100 + } + this.shotSpacing[1] = 1000f; + } + if (laserShoot % (CalamityWorld.bossRushActive ? 420 : (CalamityWorld.death ? 480 : 600)) == 0) //600 1200 1800 2400 + { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[2] -= spacingVar; //100 + } + this.shotSpacing[2] = 1000f; + } + } + } + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) + { + npc.active = false; + } + float fallSpeed = 16f; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + flies = false; + npc.velocity.Y = npc.velocity.Y + 20f; + fallSpeed = 48f; + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + 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.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[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("Warped"), 2); + } + } + phaseSwitch += 1f; + npc.localAI[1] = 0f; + float speed = 15f; + float turnSpeed = 0.4f; + float homingSpeed = 24f; + float homingTurnSpeed = 0.5f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + phaseSwitch += 9f; + } + float num188 = speed; + float 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) ? 600f : 900f)) + { + npc.ai[2] = 1f; + phaseSwitch = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[2] == 1f) + { + if (Main.netMode != 2) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + } + phaseSwitch += 1f; + float turnSpeed = 0.3f; + bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + turnSpeed = 1.5f; + } + else if (increaseSpeed) + { + turnSpeed = 1f; + } + if (!flies) + { + 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) ? 600f : 900f)) + { + npc.ai[2] = 0f; + phaseSwitch = 0f; + 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) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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; + } + double multiplier = 1.0; + if (CalamityWorld.defiled) + { + multiplier = 0.75; + } + damageTaken += (crit ? (damage * 2) : damage); + damage = (int)((double)damage * multiplier); + if (damageTaken >= 50000.0) + { + damage = (int)((double)damage * 0.5); + } + 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/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"), 150, 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); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 400, true); + player.AddBuff(BuffID.Darkness, 400, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index 8357880724..9f7a2c9d6f 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -1,202 +1,202 @@ -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; - -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; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - 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 = 1; - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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"), 50, 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); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 100, true); - player.AddBuff(BuffID.Darkness, 100, true); - } - } - } +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; + +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; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + 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 = 1; + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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"), 50, 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); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 100, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs index ac1baec7d2..d489c2034e 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail2.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.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsTail2 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Thots"); - } - - 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.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() - { - 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 = 200; - 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 ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 50, true); - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 100, true); - player.AddBuff(BuffID.Darkness, 100, true); - } - } - } +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; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsTail2 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Thots"); + } + + 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.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() + { + 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 = 200; + 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 ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 50, true); + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 100, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index 28885e37c4..2bbd9c7b7c 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -1,518 +1,518 @@ -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; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsTailS : ModNPC - { - public float beamPortal = 0f; - public double damageTaken = 0.0; - public int invinceTime = 360; - - 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 ? 625000 : 550000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 1020000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; - } - 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.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; - } - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase - bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase - bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase - bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - npc.active = false; - } - if (Main.netMode != 1) - { - beamPortal += expertMode ? 2f : 1f; - if (beamPortal >= 1800f) - { - beamPortal = 0f; - npc.TargetClosest(true); - float projectileSpeed = 5f; - if (CalamityWorld.death) - { - projectileSpeed = 7f; - } - else if (CalamityWorld.revenge) - { - projectileSpeed = 6.5f; - } - else if (Main.expertMode) - { - projectileSpeed = 6f; - } - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float playerPositionX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X + (float)Main.rand.Next(-20, 21); - float playerPositionY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y + (float)Main.rand.Next(-20, 21); - float playerPosition = (float)Math.Sqrt((double)(playerPositionX * playerPositionX + playerPositionY * playerPositionY)); - playerPosition = projectileSpeed / playerPosition; - playerPositionX *= playerPosition; - playerPositionY *= playerPosition; - playerPositionX += (float)Main.rand.Next(-10, 11) * 0.05f; - playerPositionY += (float)Main.rand.Next(-10, 11) * 0.05f; - int projectileType = mod.ProjectileType("DoGBeamPortal"); - shootFromVector.X += playerPositionX * 5f; - shootFromVector.Y += playerPositionY * 5f; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerPositionX, playerPositionY, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - else if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - npc.damage = expertMode ? 288 : 180; - npc.dontTakeDamage = false; - npc.alpha = 0; - } - } - float fallSpeed = 16f; - float turnSpeed = 0.3f; - float speed = fallSpeed; - if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) - { - if (speedBoost4 || CalamityWorld.death) - { - speed = 26f; - turnSpeed = 0.53f; - } - else if (speedBoost3) - { - speed = 21.5f; - turnSpeed = 0.43f; - } - else if (speedBoost2) - { - speed = 20.5f; - turnSpeed = 0.39f; - } - else if (speedBoost1) - { - speed = 19f; - turnSpeed = 0.36f; - } - } - else - { - turnSpeed = 0.2f; - if (speedBoost4 || CalamityWorld.death) - { - turnSpeed = 0.4f; - speed = 28f; - } - else if (speedBoost3) - { - turnSpeed = 0.29f; - speed = 22f; - } - else if (speedBoost2) - { - turnSpeed = 0.25f; - speed = 20f; - } - else if (speedBoost1) - { - turnSpeed = 0.22f; - speed = 18f; - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - else - { - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - } - - 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) - { - 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; - } - double multiplier = 1.0; - if (CalamityWorld.defiled) - { - multiplier = 0.75; - } - damageTaken += (crit ? (damage * 2) : damage); - damage = (int)((double)damage * multiplier); - if (damageTaken >= 50000.0) - { - damage = (int)((double)damage * 0.5); - } - return true; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || - projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - 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"), 50, 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); - } - if (Main.expertMode) - { - player.AddBuff(BuffID.Frostburn, 100, true); - player.AddBuff(BuffID.Darkness, 100, true); - } - } - } +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; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsTailS : ModNPC + { + public float beamPortal = 0f; + public double damageTaken = 0.0; + public int invinceTime = 360; + + 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 ? 625000 : 550000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 1020000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; + } + 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.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; + } + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase + bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase + bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase + bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) + { + npc.active = false; + } + if (Main.netMode != 1) + { + beamPortal += expertMode ? 2f : 1f; + if (beamPortal >= 1800f) + { + beamPortal = 0f; + npc.TargetClosest(true); + float projectileSpeed = 5f; + if (CalamityWorld.death) + { + projectileSpeed = 7f; + } + else if (CalamityWorld.revenge) + { + projectileSpeed = 6.5f; + } + else if (Main.expertMode) + { + projectileSpeed = 6f; + } + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float playerPositionX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X + (float)Main.rand.Next(-20, 21); + float playerPositionY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y + (float)Main.rand.Next(-20, 21); + float playerPosition = (float)Math.Sqrt((double)(playerPositionX * playerPositionX + playerPositionY * playerPositionY)); + playerPosition = projectileSpeed / playerPosition; + playerPositionX *= playerPosition; + playerPositionY *= playerPosition; + playerPositionX += (float)Main.rand.Next(-10, 11) * 0.05f; + playerPositionY += (float)Main.rand.Next(-10, 11) * 0.05f; + int projectileType = mod.ProjectileType("DoGBeamPortal"); + shootFromVector.X += playerPositionX * 5f; + shootFromVector.Y += playerPositionY * 5f; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerPositionX, playerPositionY, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + else if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + npc.damage = expertMode ? 288 : 180; + npc.dontTakeDamage = false; + npc.alpha = 0; + } + } + float fallSpeed = 16f; + float turnSpeed = 0.3f; + float speed = fallSpeed; + if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) + { + if (speedBoost4 || CalamityWorld.death) + { + speed = 26f; + turnSpeed = 0.53f; + } + else if (speedBoost3) + { + speed = 21.5f; + turnSpeed = 0.43f; + } + else if (speedBoost2) + { + speed = 20.5f; + turnSpeed = 0.39f; + } + else if (speedBoost1) + { + speed = 19f; + turnSpeed = 0.36f; + } + } + else + { + turnSpeed = 0.2f; + if (speedBoost4 || CalamityWorld.death) + { + turnSpeed = 0.4f; + speed = 28f; + } + else if (speedBoost3) + { + turnSpeed = 0.29f; + speed = 22f; + } + else if (speedBoost2) + { + turnSpeed = 0.25f; + speed = 20f; + } + else if (speedBoost1) + { + turnSpeed = 0.22f; + speed = 18f; + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + else + { + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + } + + 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) + { + 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; + } + double multiplier = 1.0; + if (CalamityWorld.defiled) + { + multiplier = 0.75; + } + damageTaken += (crit ? (damage * 2) : damage); + damage = (int)((double)damage * multiplier); + if (damageTaken >= 50000.0) + { + damage = (int)((double)damage * 0.5); + } + return true; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("TerraBulletSplit") || + projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + 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"), 50, 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); + } + if (Main.expertMode) + { + player.AddBuff(BuffID.Frostburn, 100, true); + player.AddBuff(BuffID.Darkness, 100, true); + } + } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs index 6a07a86a4f..5b7e42616c 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(); - } - } +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 diff --git a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs index e5390f15b0..187af65d27 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(); - } - } +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 diff --git a/NPCs/TheDevourerofGods/DoGSky.cs b/NPCs/TheDevourerofGods/DoGSky.cs index 63fc005159..cb9e476031 100644 --- a/NPCs/TheDevourerofGods/DoGSky.cs +++ b/NPCs/TheDevourerofGods/DoGSky.cs @@ -1,110 +1,110 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -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; - } - } - //this.DoGIndex = DoGIndex; - return DoGIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead >= 0) - { - 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; - } - } +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +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; + } + } + //this.DoGIndex = DoGIndex; + return DoGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead >= 0) + { + 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 diff --git a/NPCs/TheDevourerofGods/DoGSkyS.cs b/NPCs/TheDevourerofGods/DoGSkyS.cs index c34130ca30..ff21fb9b9b 100644 --- a/NPCs/TheDevourerofGods/DoGSkyS.cs +++ b/NPCs/TheDevourerofGods/DoGSkyS.cs @@ -1,110 +1,110 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -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; - } - } - //this.DoGIndex = DoGIndex; - return DoGIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead >= 0) - { - 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; - } - } +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +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; + } + } + //this.DoGIndex = DoGIndex; + return DoGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead >= 0) + { + 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 diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 6cc818fdc6..31e3bd56a9 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -1,182 +1,189 @@ -using System.Collections.Generic; -using Terraria; -using Terraria.GameContent.Events; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; - -//REMINDER TO MAKE CRYOGEN SPAWN A DILF ON KILL IF ONE DOES NOT CURRENTLY EXIST -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.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 250; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; - 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."); - - 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++; - } - - 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; + +//REMINDER TO MAKE CRYOGEN SPAWN A DILF ON KILL IF ONE DOES NOT CURRENTLY EXIST +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.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 250; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.5f; + 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 (Main.raining) + { + dialogue.Add("A shame that the radiation makes the rain and snow damaging...this is my favorite weather event."); + } + } + + 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++; + } + + 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 new file mode 100644 index 0000000000..d6f44520a7 --- /dev/null +++ b/NPCs/TownNPCs/FAP.cs @@ -0,0 +1,323 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.Localization; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 250; + 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().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."); + } + + 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) //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.downedStarGod && !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("OddMushroom")); //trips you out and boosts all stats + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0); + nextSlot++;*/ + } + + 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 = 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/FAP_Head.png b/NPCs/TownNPCs/FAP_Head.png new file mode 100644 index 0000000000..0f060eb793 Binary files /dev/null and b/NPCs/TownNPCs/FAP_Head.png differ diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index 99f422b89a..43fe53c7f5 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -1,241 +1,241 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Yharon -{ - public class 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 = 15000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - 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; - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Yharon +{ + public class 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 = 15000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + 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 diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 6c7c623770..d3d08dd992 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -1,104 +1,104 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Yharon -{ - public class 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 = 20000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - 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; - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Yharon +{ + public class 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 = 20000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + 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 diff --git a/NPCs/Yharon/DetonatingFlare3.cs b/NPCs/Yharon/DetonatingFlare3.cs index 41c0a7193d..34ca14cc95 100644 --- a/NPCs/Yharon/DetonatingFlare3.cs +++ b/NPCs/Yharon/DetonatingFlare3.cs @@ -1,239 +1,239 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Yharon -{ - public class DetonatingFlare3 : ModNPC - { - float num = 10f; - float num2 = 0.25f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Angery Flame"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 50; //324 - npc.height = 50; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } - - public override void AI() - { - if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.alpha -= 3; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 30f) - { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 106 : 125; //600 - Vector2 vector173 = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (float)(npc.width + 20) / 2f + npc.Center; - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vectorShoot.X; - float playerY = Main.player[npc.target].position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, 467, damage, 0f, Main.myPlayer, 0f, 0f); - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, Main.DiscoG, 53, 0); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 100; - npc.damage = 0; - } - } +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.Yharon +{ + public class DetonatingFlare3 : ModNPC + { + float num = 10f; + float num2 = 0.25f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angery Flame"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 50; //324 + npc.height = 50; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + npc.alpha = 255; + } + + public override void AI() + { + if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.alpha -= 3; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num4 = (float)((int)(num4 / 8f) * 8); + num5 = (float)((int)(num5 / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + float num7 = num6; + bool flag = false; + if (num6 > 600f) + { + flag = true; + } + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.023f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X = npc.velocity.X + 0.023f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + } + if (Main.player[npc.target].dead) + { + num4 = (float)npc.direction * num / 2f; + num5 = -num / 2f; + } + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 30f) + { + npc.localAI[0] = 0f; + int damage = Main.expertMode ? 106 : 125; //600 + Vector2 vector173 = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (float)(npc.width + 20) / 2f + npc.Center; + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vectorShoot.X; + float playerY = Main.player[npc.target].position.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, 467, damage, 0f, Main.myPlayer, 0f, 0f); + } + int num10 = (int)npc.position.X + npc.width / 2; + int num11 = (int)npc.position.Y + npc.height / 2; + num10 /= 16; + num11 /= 16; + if (!WorldGen.SolidTile(num10, num11)) + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + } + float num12 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num12; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num12; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (flag) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + if (Math.Abs(npc.velocity.X) < 12f) + { + npc.velocity.X = npc.velocity.X * 1.05f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, Main.DiscoG, 53, 0); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 100; + npc.damage = 0; + } + } } \ No newline at end of file diff --git a/NPCs/Yharon/YScreenShader.cs b/NPCs/Yharon/YScreenShader.cs index 2e5c8a81c8..34ea34350e 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(); - } - } +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 diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index 14c32de928..22d38c1b26 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; - } - } +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 diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 9b7c56d9e0..7e465a9f04 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1,2820 +1,2824 @@ -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; - -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 int healCounter = 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; //150 - npc.height = 200; //100 - npc.defense = 200; - npc.lifeMax = CalamityWorld.revenge ? 2625000 : 2375000; - if (CalamityWorld.death) - { - npc.lifeMax = 3125000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 10000000 : 9000000; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(10, 0, 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("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); - if (CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); - } - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - bossBag = mod.ItemType("YharonBag"); - } - - public override void AI() - { - #region StartupOrSwitchToAI2 - dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; - if (Main.raining) - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.localAI[2] == 1f) - { - if ((!CalamityWorld.downedProvidence || !CalamityWorld.downedDoG) && !CalamityWorld.bossRushActive) - { - phaseOneLoot = true; - npc.DeathSound = null; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.alpha < 255) - { - npc.alpha += 5; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - if (npc.timeLeft > 55) - { - npc.timeLeft = 55; - } - if (npc.timeLeft < 5) - { - string key = "Mods.CalamityMod.DargonBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - npc.localAI[2] = 2f; - npc.boss = false; - npc.life = 0; - if (dropLoot) - { - npc.NPCLoot(); - } - npc.active = false; - npc.netUpdate = true; - } - return; - } - if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) - { - phaseOneLoot = true; - 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); - } - npc.localAI[2] = 0f; - 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 (npc.localAI[1] == 0f) - { - npc.localAI[1] = 1f; - 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 ? 6000f : 7000f)); - safeBox.Width = revenge ? 6000 : 7000; - safeBox.Height = revenge ? 12000 : 14000; - 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 - float teleportLocation = 0f; - int teleChoice = Main.rand.Next(2); - if (teleChoice == 0) - { - teleportLocation = revenge ? 500f : 600f; - } - else - { - teleportLocation = revenge ? -500f : -600f; - } - 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) - { - 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) //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 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 - { - 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; - return; - } - } - #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 (num1471 != 0) - { - npc.direction = num1471; - npc.rotation = 0f; - 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; - return; - } - } - 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; - return; - } - } - 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(4, (int)npc.Center.X, (int)npc.Center.Y, 60); - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); - } - int damage = expertMode ? 75 : 90; //700 - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - Projectile.NewProjectile((int)vector173.X, (int)vector173.Y - 70, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - int num1476 = Math.Sign(player.Center.X - vectorCenter.X); - Vector2 dir2 = npc.position - Main.player[npc.target].position; - if (num1476 != 0) - { - npc.direction = num1476; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 6.28318548f; - if (npc.rotation > 6.28318548f) - { - npc.rotation = 0f; - if(dir2.X < 0) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - } - } - 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; - return; - } - } - 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/YharonRoar"), (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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - #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 (num1477 != 0) - { - npc.direction = num1477; - npc.rotation = 0f; - 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; - return; - } - } - 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; - return; - } - } - 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(4, (int)npc.Center.X, (int)npc.Center.Y, 60); - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) - { - Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); - } - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - Projectile.NewProjectile((int)vector173.X, (int)vector173.Y - 100, (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; - return; - } - } - 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/YharonRoar"), (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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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(4, (int)npc.Center.X, (int)npc.Center.Y, 60); - 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, (int)vector173.Y - 100, 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; - return; - } - } - #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 (num1477 != 0) - { - npc.direction = num1477; - npc.rotation = 0f; - 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; - return; - } - } - 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; - return; - } - } - 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(4, (int)npc.Center.X, (int)npc.Center.Y, 60); - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, (Main.rand.Next(2) == 0 ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); - } - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - Projectile.NewProjectile((int)vector.X, (int)vector.Y - 100, (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, (int)vector.Y - 100, (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; - return; - } - } - 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/YharonRoar"), (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; - return; - } - } - 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; - return; - } - } - 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; - return; - } - } - 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(4, (int)npc.Center.X, (int)npc.Center.Y, 60); - 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, (int)vector173.Y - 100, 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; - return; - } - } - 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/YharonRoar"), (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; - return; - } - } - #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) - { - npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value7 = player.Center + new Vector2(npc.ai[1], 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 (num32 != 0) - { - npc.direction = num32; - npc.rotation = 0f; - 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; - return; - } - } - 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; - return; - } - } - 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/YharonRoar"), (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); - npc.rotation -= num1463 * (float)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; - return; - } - } - 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/YharonRoar"), (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) - { - npc.localAI[2] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - #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.66; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.33; - bool tantrum = (double)npc.life <= (double)npc.lifeMax * 0.04; - npc.defense = 100; - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!moveCloser) - { - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); - moveCloser = true; - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DetonatingFlare3"), 0, 0f, 0f, 0f, 0f, 255); - } - string key = "Mods.CalamityMod.FlameText"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (npc.localAI[3] < 900f) - { - npc.localAI[3] += 1f; - int heal = 5; //180 heals 50% and 30% - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; - if (Main.netMode != 1) - { - int fractionHealed = revenge ? 240 : 300; //100000 / 240 * 180 = 75000 healed = 75% heal - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - fractionHealed = 200; //100000 / 200 * 180 = 90000 healed = 90% heal - } - int healAmt = npc.lifeMax / fractionHealed; - 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 = false; - npc.chaseable = true; - } - 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 - { - protectionBoost = false; - if (npc.timeLeft < 3600) - { - npc.timeLeft = 3600; - } - } - int num = -1; - float num2 = 1f; - int num4 = expertMode ? 106 : 125; //600 - float num5 = 10f; - float num6 = revenge ? 0.6f : 0.55f; //0.45 - float scaleFactor = revenge ? 10f : 9f; //7.5 - float num7 = 30f; - float num8 = 30f; - float scaleFactor2 = revenge ? 26f : 24.5f; //23 - float num9 = 600f; - float num10 = 12f; - float num11 = 40f; - float num12 = (CalamityWorld.death && !CalamityWorld.bossRushActive) ? 40f : 80f; - float num13 = num11 + num12; - float num14 = 1500f; - float num15 = 60f; - float scaleFactor3 = 13f; - float amount = 0.0333333351f; - float scaleFactor4 = revenge ? 16f : 14.5f; //12 - 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 num23 = 0.1f; - float scaleFactor5 = revenge ? 38f : 36.5f; //32 - if (npc.GetGlobalNPC(mod).enraged) - { - num6 = 0.65f; - scaleFactor = 11f; - scaleFactor2 = 28f; - scaleFactor4 = 18f; - scaleFactor5 = 40f; - } - float num24 = 90f; - 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 >= num5) - { - 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 >= num7) - { - int num28 = 1; - if (phase3) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - num28 = 2; //charge - break; - case 2: - num28 = 5; //fire circle - break; - case 3: - num28 = 4; //splitting fireballs - break; - case 4: - num28 = 3; //homing fireballs - break; - case 5: - num28 = 6; //tornado - break; - case 6: - case 7: - num28 = 2; //double charge - break; - case 8: - num28 = 5; //fire circle - break; - case 9: - num28 = 4; //splitting fireballs - break; - } - } - else if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; - break; - case 1: - case 2: - num28 = 2; - break; - case 3: - num28 = 5; - break; - case 4: - num28 = 3; - break; - case 5: - case 6: - num28 = 4; - break; - case 7: - case 8: - num28 = 2; - break; - case 9: - num28 = 5; - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; - break; - case 1: - case 2: - num28 = 2; - break; - case 3: - num28 = 3; - break; - case 4: - num28 = 4; - break; - case 5: - case 6: - num28 = 2; - break; - case 7: - num28 = 5; - break; - } - } - npc.ai[0] = (float)num28; - if (tantrum) - { - npc.ai[0] = 2f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - float aiLimit = 8f; - if (phase2) - { - aiLimit = 10f; - } - 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 * scaleFactor2; - break; - } - case 3: //homing 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; - } - } - } - } - else if (npc.ai[0] == 2f) - { - if (npc.ai[1] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - float[] expr_498_cp_0 = npc.ai; - int expr_498_cp_1 = 1; - num26 = expr_498_cp_0[expr_498_cp_1] + 1f; - expr_498_cp_0[expr_498_cp_1] = num26; - if (num26 >= num8) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - else if (npc.ai[0] == 3f) //homing fireball spit - { - npc.ai[1] += 1f; - int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num29; - if (npc.ai[1] < num11) - { - Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -num9, -250f); - Vector2 value = npc.DirectionTo(vector4) * num10; - if (npc.Distance(vector4) < num10) - { - 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] % 10 == 0 && Main.netMode != 1) - { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, - default(Vector2)); - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireballHoming"), num4, 0f, Main.myPlayer, 0f, 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) //splitting fireball spit - { - int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num31; - if (npc.ai[1] < num15) - { - Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -num14, -350f); - Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; - npc.velocity = Vector2.Lerp(npc.velocity, value2, amount); - 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 /* 110f */ + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, - default(Vector2)); - int num34 = (int)(npc.ai[1] - num15 + 1f); - if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != 1) - { - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); //change - } - } - 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) - { - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default(Vector2)); - npc.position.Y = npc.position.Y - num23; - 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/YharonRoar"), (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 (npc.ai[1] % 12 == 0 && Main.netMode != 1) - { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, - default(Vector2)); - int projectileType = (((npc.ai[1] / 2) % 12 == 0) ? mod.ProjectileType("YharonFireball") : mod.ProjectileType("YharonFireballHoming")); - Projectile.NewProjectile(position, npc.velocity, projectileType, num4, 0f, Main.myPlayer, 0f, 0f); - } - if (num26 >= num20) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity /= 2f; - } - } - else if (npc.ai[0] == 6f) //birb 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; - if (NPC.CountNPCS(mod.NPCType("Bumblefuck3")) > 2 || phase2) - { - flag3 = false; - } - if (flag3 && Main.netMode != 1) - { - Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 300f * (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("Bumblefuck3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - for (int num41 = 0; num41 < 2; num41++) - { - NPC.NewNPC((int)npc.Center.X + (Main.rand.Next(2) == 0 ? 800 : -800), (int)npc.Center.Y - 200, mod.NPCType("Bumblefuck3"), 0, 0f, 0f, 0f, 0f, 255); - } - } - npc.ai[1] += 1f; - } - if (npc.ai[1] >= num24) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - Boom(600, num4); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - 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: - 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; - } - 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.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)); - if (npc.localAI[2] == 1f && !phaseOneLoot) - { - SpriteEffects spriteEffects2 = spriteEffects ^ SpriteEffects.FlipHorizontally; - if (npc.localAI[3] < 900f) - { - color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - Main.spriteBatch.Draw(Main.npcTexture[npc.type], - 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 + num66 + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame6), - npc.GetAlpha(color9), - npc.rotation, - vector11, - npc.scale, - spriteEffects2, - 0f); - return false; - } - Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); - float num212 = 1f - (float)npc.life / (float)npc.lifeMax; - num212 *= num212; - 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?(frame6), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - Main.spriteBatch.Draw(Main.npcTexture[npc.type], 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 + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - return false; - } - #endregion - - #region Loot - public override void NPCLoot() - { - if (!dropLoot) - { - return; - } - if (Main.rand.Next(10) == 0 && npc.localAI[2] == 1f) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 10; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - if (npc.localAI[2] == 1f) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(22, 29), true); - } - npc.DropBossBags(); - } - else - { - if (npc.localAI[2] == 1f) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(15, 23), true); - } - 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")); - } - } - } - #endregion - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("SupremeHealingPotion"); - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[npc.target]; - if (player.vortexStealthActive && projectile.ranged) - { - damage /= 2; - crit = false; - } - if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || - projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) - { - damage /= 8; - } - } - - #region DamageFormula - 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)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (newDamage >= 1.0) - { - if (npc.localAI[2] == 1f) - { - float protection = (((npc.ichor || npc.onFire2) ? 0.17f : 0.22f) + - (protectionBoost ? 0.68f : 0f)); //0.85 or 0.9 - if (CalamityWorld.defiled) - { - protection += (1f - protection) * 0.5f; - } - 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 - if (CalamityWorld.defiled) - { - protection += (1f - protection) * 0.5f; - } - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; - } - #endregion - - 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; - } - - #region FindFrame - public override void FindFrame(int frameHeight) - { - if ((npc.localAI[2] != 1f && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || - (npc.localAI[2] == 1f && (npc.ai[0] == 5f || npc.ai[0] < 3f))) //idle - { - int num84 = 4; //5 - if (npc.localAI[2] != 1f && (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 ((npc.localAI[2] != 1f && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || - npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || (npc.localAI[2] == 1f && (npc.ai[0] == 6f))) //Charging or birb spawn - { - npc.frame.Y = frameHeight * 5; //6 - } - if ((npc.localAI[2] != 1f && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || - (npc.localAI[2] == 1f && (npc.ai[0] == 4f || npc.ai[0] == 3f))) //Fireball spit or circle or flamethrower - { - npc.frame.Y = frameHeight * 5; //6 - } - if (npc.localAI[2] != 1f && (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 (npc.localAI[2] != 1f && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) //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 - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - - 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; - } - } - } - - #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 - } +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; + +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 int healCounter = 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; //150 + npc.height = 200; //100 + npc.defense = 200; + npc.lifeMax = CalamityWorld.revenge ? 2625000 : 2375000; + if (CalamityWorld.death) + { + npc.lifeMax = 3125000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 10000000 : 9000000; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(10, 0, 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("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); + if (CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); + } + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + bossBag = mod.ItemType("YharonBag"); + } + + public override void AI() + { + #region StartupOrSwitchToAI2 + dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; + if (Main.raining) + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.localAI[2] == 1f) + { + if ((!CalamityWorld.downedProvidence || !CalamityWorld.downedDoG) && !CalamityWorld.bossRushActive) + { + phaseOneLoot = true; + npc.DeathSound = null; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.alpha < 255) + { + npc.alpha += 5; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + if (npc.timeLeft > 55) + { + npc.timeLeft = 55; + } + if (npc.timeLeft < 5) + { + string key = "Mods.CalamityMod.DargonBossText3"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + npc.localAI[2] = 2f; + npc.boss = false; + npc.life = 0; + if (dropLoot) + { + npc.NPCLoot(); + } + npc.active = false; + npc.netUpdate = true; + } + return; + } + if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) + { + phaseOneLoot = true; + 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); + } + npc.localAI[2] = 0f; + 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 (npc.localAI[1] == 0f) + { + npc.localAI[1] = 1f; + 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 ? 6000f : 7000f)); + safeBox.Width = revenge ? 6000 : 7000; + safeBox.Height = revenge ? 12000 : 14000; + 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 + float teleportLocation = 0f; + int teleChoice = Main.rand.Next(2); + if (teleChoice == 0) + { + teleportLocation = revenge ? 500f : 600f; + } + else + { + teleportLocation = revenge ? -500f : -600f; + } + 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) + { + 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) //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 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 + { + 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; + return; + } + } + #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 (num1471 != 0) + { + npc.direction = num1471; + npc.rotation = 0f; + 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; + return; + } + } + 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; + return; + } + } + 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) + { + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); + } + int damage = expertMode ? 75 : 90; //700 + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Projectile.NewProjectile((int)vector173.X, (int)vector173.Y - 70, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + int num1476 = Math.Sign(player.Center.X - vectorCenter.X); + Vector2 dir2 = npc.position - Main.player[npc.target].position; + if (num1476 != 0) + { + npc.direction = num1476; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 6.28318548f; + if (npc.rotation > 6.28318548f) + { + npc.rotation = 0f; + if(dir2.X < 0) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + #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 (num1477 != 0) + { + npc.direction = num1477; + npc.rotation = 0f; + 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; + return; + } + } + 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; + return; + } + } + 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) + { + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) + { + Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); + } + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Projectile.NewProjectile((int)vector173.X, (int)vector173.Y - 100, (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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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, (int)vector173.Y - 100, 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; + return; + } + } + #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 (num1477 != 0) + { + npc.direction = num1477; + npc.rotation = 0f; + 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; + return; + } + } + 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; + return; + } + } + 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) + { + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + Vector2 vector6 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + NPC.NewNPC((int)vector6.X, (int)vector6.Y - 100, (Main.rand.Next(2) == 0 ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); + } + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Projectile.NewProjectile((int)vector.X, (int)vector.Y - 100, (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, (int)vector.Y - 100, (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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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; + return; + } + } + 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, (int)vector173.Y - 100, 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; + return; + } + } + 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; + return; + } + } + #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) + { + npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value7 = player.Center + new Vector2(npc.ai[1], 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 (num32 != 0) + { + npc.direction = num32; + npc.rotation = 0f; + 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; + return; + } + } + 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; + return; + } + } + 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); + npc.rotation -= num1463 * (float)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; + return; + } + } + 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) + { + npc.localAI[2] = 1f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + #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.66; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.33; + bool tantrum = (double)npc.life <= (double)npc.lifeMax * 0.04; + npc.defense = 100; + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!moveCloser) + { + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); + moveCloser = true; + if ((CalamityWorld.death || CalamityWorld.bossRushActive) && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DetonatingFlare3"), 0, 0f, 0f, 0f, 0f, 255); + } + string key = "Mods.CalamityMod.FlameText"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (npc.localAI[3] < 900f) + { + npc.localAI[3] += 1f; + int heal = 5; //180 heals 50% and 30% + healCounter += 1; + if (healCounter >= heal) + { + healCounter = 0; + if (Main.netMode != 1) + { + int fractionHealed = revenge ? 240 : 300; //100000 / 240 * 180 = 75000 healed = 75% heal + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + fractionHealed = 200; //100000 / 200 * 180 = 90000 healed = 90% heal + } + int healAmt = npc.lifeMax / fractionHealed; + 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 = false; + npc.chaseable = true; + } + 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 + { + protectionBoost = false; + if (npc.timeLeft < 3600) + { + npc.timeLeft = 3600; + } + } + int num = -1; + float num2 = 1f; + int num4 = expertMode ? 106 : 125; //600 + float num5 = 10f; + float num6 = revenge ? 0.6f : 0.55f; //0.45 + float scaleFactor = revenge ? 10f : 9f; //7.5 + float num7 = 30f; + float num8 = 30f; + float scaleFactor2 = revenge ? 26f : 24.5f; //23 + float num9 = 600f; + float num10 = 12f; + float num11 = 40f; + float num12 = (CalamityWorld.death && !CalamityWorld.bossRushActive) ? 40f : 80f; + float num13 = num11 + num12; + float num14 = 1500f; + float num15 = 60f; + float scaleFactor3 = 13f; + float amount = 0.0333333351f; + float scaleFactor4 = revenge ? 16f : 14.5f; //12 + 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 num23 = 0.1f; + float scaleFactor5 = revenge ? 38f : 36.5f; //32 + if (npc.GetGlobalNPC(mod).enraged) + { + num6 = 0.65f; + scaleFactor = 11f; + scaleFactor2 = 28f; + scaleFactor4 = 18f; + scaleFactor5 = 40f; + } + float num24 = 90f; + 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 >= num5) + { + 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 >= num7) + { + int num28 = 1; + if (phase3) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + num28 = 2; //charge + break; + case 2: + num28 = 5; //fire circle + break; + case 3: + num28 = 4; //splitting fireballs + break; + case 4: + num28 = 3; //homing fireballs + break; + case 5: + num28 = 6; //tornado + break; + case 6: + case 7: + num28 = 2; //double charge + break; + case 8: + num28 = 5; //fire circle + break; + case 9: + num28 = 4; //splitting fireballs + break; + } + } + else if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + case 2: + num28 = 2; //charge + break; + case 3: + num28 = 5; //fire circle + break; + case 4: + num28 = 3; //homing fireballs + break; + case 5: + case 6: + num28 = 4; //double splitting fireballs + break; + case 7: + case 8: + num28 = 2; //double charge + break; + case 9: + num28 = 5; //fire circle + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + case 2: + num28 = 2; //double charge + break; + case 3: + num28 = 3; //homing fireballs + break; + case 4: + num28 = 4; //splitting fireballs + break; + case 5: + case 6: + num28 = 2; //double charge + break; + case 7: + num28 = 5; //fire circle + break; + } + } + npc.ai[0] = (float)num28; + if (tantrum) + { + npc.ai[0] = 2f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + float aiLimit = 8f; + if (phase2) + { + aiLimit = 10f; + } + 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 * scaleFactor2; + break; + } + case 3: //homing 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; + } + } + } + } + else if (npc.ai[0] == 2f) + { + if (npc.ai[1] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + float[] expr_498_cp_0 = npc.ai; + int expr_498_cp_1 = 1; + num26 = expr_498_cp_0[expr_498_cp_1] + 1f; + expr_498_cp_0[expr_498_cp_1] = num26; + if (num26 >= num8) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 3f) //homing fireball spit + { + npc.ai[1] += 1f; + int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (float)num29; + if (npc.ai[1] < num11) + { + Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -num9, -250f); + Vector2 value = npc.DirectionTo(vector4) * num10; + if (npc.Distance(vector4) < num10) + { + 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] % 10 == 0 && Main.netMode != 1) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, + default(Vector2)); + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireballHoming"), num4, 0f, Main.myPlayer, 0f, 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) //splitting fireball spit + { + int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (float)num31; + if (npc.ai[1] < num15) + { + Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -num14, -350f); + Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; + npc.velocity = Vector2.Lerp(npc.velocity, value2, amount); + 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 /* 110f */ + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default(Vector2)); + int num34 = (int)(npc.ai[1] - num15 + 1f); + if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != 1) + { + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); //change + } + } + 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) + { + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default(Vector2)); + npc.position.Y = npc.position.Y - num23; + 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 (npc.ai[1] % 12 == 0 && Main.netMode != 1) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, + default(Vector2)); + int projectileType = (((npc.ai[1] / 2) % 12 == 0) ? mod.ProjectileType("YharonFireball") : mod.ProjectileType("YharonFireballHoming")); + Projectile.NewProjectile(position, npc.velocity, projectileType, num4, 0f, Main.myPlayer, 0f, 0f); + } + if (num26 >= num20) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity /= 2f; + } + } + else if (npc.ai[0] == 6f) //birb 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; + if (NPC.CountNPCS(mod.NPCType("Bumblefuck3")) > 4) + { + flag3 = false; + } + if (flag3 && Main.netMode != 1) + { + Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 300f * (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("Bumblefuck3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + for (int num41 = 0; num41 < 2; num41++) + { + NPC.NewNPC((int)npc.Center.X + (Main.rand.Next(2) == 0 ? 800 : -800), (int)npc.Center.Y - 200, mod.NPCType("Bumblefuck3"), 0, 0f, 0f, 0f, 0f, 255); + } + } + npc.ai[1] += 1f; + } + if (npc.ai[1] >= num24) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Boom(600, num4); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + 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: + 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; + } + 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.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)); + if (npc.localAI[2] == 1f && !phaseOneLoot) + { + SpriteEffects spriteEffects2 = spriteEffects ^ SpriteEffects.FlipHorizontally; + if (npc.localAI[3] < 900f) + { + color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + Main.spriteBatch.Draw(Main.npcTexture[npc.type], + 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 + num66 + npc.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(frame6), + npc.GetAlpha(color9), + npc.rotation, + vector11, + npc.scale, + spriteEffects2, + 0f); + return false; + } + Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); + float num212 = 1f - (float)npc.life / (float)npc.lifeMax; + num212 *= num212; + 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?(frame6), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + Main.spriteBatch.Draw(Main.npcTexture[npc.type], 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 + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + return false; + } + #endregion + + #region Loot + public override void NPCLoot() + { + if (!dropLoot) + { + return; + } + if (npc.localAI[2] == 1f) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BossRush")); + } + if (Main.rand.Next(10) == 0 && npc.localAI[2] == 1f) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 10; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + if (npc.localAI[2] == 1f) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(22, 29), true); + } + npc.DropBossBags(); + } + else + { + if (npc.localAI[2] == 1f) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(15, 23), true); + } + 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")); + } + } + } + #endregion + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("SupremeHealingPotion"); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[npc.target]; + if (player.vortexStealthActive && projectile.ranged) + { + damage /= 2; + crit = false; + } + if (((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) || + projectile.type == mod.ProjectileType("TerraBulletSplit") || projectile.type == mod.ProjectileType("TerraArrow2")) + { + damage /= 8; + } + } + + #region DamageFormula + 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)); + if (newDamage < 1.0) + { + newDamage = 1.0; + } + if (newDamage >= 1.0) + { + if (npc.localAI[2] == 1f) + { + float protection = (((npc.ichor || npc.onFire2) ? 0.17f : 0.22f) + + (protectionBoost ? 0.68f : 0f)); //0.85 or 0.9 + if (CalamityWorld.defiled) + { + protection += (1f - protection) * 0.5f; + } + 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 + if (CalamityWorld.defiled) + { + protection += (1f - protection) * 0.5f; + } + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + } + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + return true; + } + #endregion + + 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; + } + + #region FindFrame + public override void FindFrame(int frameHeight) + { + if ((npc.localAI[2] != 1f && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || + (npc.localAI[2] == 1f && (npc.ai[0] == 5f || npc.ai[0] < 3f))) //idle + { + int num84 = 4; //5 + if (npc.localAI[2] != 1f && (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 ((npc.localAI[2] != 1f && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || + npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || (npc.localAI[2] == 1f && (npc.ai[0] == 6f))) //Charging or birb spawn + { + npc.frame.Y = frameHeight * 5; //6 + } + if ((npc.localAI[2] != 1f && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || + (npc.localAI[2] == 1f && (npc.ai[0] == 4f || npc.ai[0] == 3f))) //Fireball spit or circle or flamethrower + { + npc.frame.Y = frameHeight * 5; //6 + } + if (npc.localAI[2] != 1f && (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 (npc.localAI[2] != 1f && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) //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 + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + + 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; + } + } + } + + #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 diff --git a/Projectiles/AMR.cs b/Projectiles/AMR.cs index 6e78a0a50a..aaabd2df4b 100644 --- a/Projectiles/AMR.cs +++ b/Projectiles/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 -{ - 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.1f), 1f, projectile.owner); - } - } - } - target.AddBuff(mod.BuffType("MarkedforDeath"), 600); - if (target.defense > 50) - { - target.defense -= 50; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.1f), 1f, projectile.owner); + } + } + } + target.AddBuff(mod.BuffType("MarkedforDeath"), 600); + if (target.defense > 50) + { + target.defense -= 50; + } + } + } } \ No newline at end of file diff --git a/Projectiles/AMR2.cs b/Projectiles/AMR2.cs index e9b652b6b6..106e859c82 100644 --- a/Projectiles/AMR2.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AbyssBall.cs b/Projectiles/AbyssBall.cs index d1833467d2..3da3309ef0 100644 --- a/Projectiles/AbyssBall.cs +++ b/Projectiles/AbyssBall.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 -{ - 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/AccelerationBullet.cs b/Projectiles/AccelerationBullet.cs index 74c35a80d8..f11a7131da 100644 --- a/Projectiles/AccelerationBullet.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AccretionDisk.cs b/Projectiles/AccretionDisk.cs index fa891c4d6a..186d123fb6 100644 --- a/Projectiles/AccretionDisk.cs +++ b/Projectiles/AccretionDisk.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 -{ - 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.thrown = 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 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(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); - } - } - } - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 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(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); + } + } + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/AccretionDisk2.cs b/Projectiles/AccretionDisk2.cs index 89c9ea4184..e6cfd12911 100644 --- a/Projectiles/AccretionDisk2.cs +++ b/Projectiles/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 -{ - 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.thrown = 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/AccretionDisk2Melee.cs b/Projectiles/AccretionDisk2Melee.cs index b9e35f1868..1389d44be0 100644 --- a/Projectiles/AccretionDisk2Melee.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/AccretionDiskMelee.cs b/Projectiles/AccretionDiskMelee.cs index 0865b4d49b..cc9c8b293f 100644 --- a/Projectiles/AccretionDiskMelee.cs +++ b/Projectiles/AccretionDiskMelee.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 -{ - 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 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(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); - } - } - } - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 1f) / 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(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); + } + } + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/AcidBullet.cs b/Projectiles/AcidBullet.cs index 5a5bd096d9..d19d02598a 100644 --- a/Projectiles/AcidBullet.cs +++ b/Projectiles/AcidBullet.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 -{ - 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); - damage += target.defense; - if (damage > 30) - { - damage = 30; - } - } - - 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + damage += target.defense; + if (damage > 30) + { + damage = 30; + } + } + + 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 diff --git a/Projectiles/AdamantiteThrowingAxeProjectile.cs b/Projectiles/AdamantiteThrowingAxeProjectile.cs index 9ef100c2d2..d0cc61a632 100644 --- a/Projectiles/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 3; - } - - 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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 3; + } + + 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 diff --git a/Projectiles/AegisBeam.cs b/Projectiles/AegisBeam.cs index cd3c772110..eb0f23df9b 100644 --- a/Projectiles/AegisBeam.cs +++ b/Projectiles/AegisBeam.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 -{ - 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; - } - return; - } - - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/AegisBlast.cs b/Projectiles/AegisBlast.cs index 987fe5e2b7..9a14ea9e1e 100644 --- a/Projectiles/AegisBlast.cs +++ b/Projectiles/AegisBlast.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/AegisBlast2.cs b/Projectiles/AegisBlast2.cs index 5656253811..75acd35a6b 100644 --- a/Projectiles/AegisBlast2.cs +++ b/Projectiles/AegisBlast2.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/AegisFlame.cs b/Projectiles/AegisFlame.cs index ab0092725f..3e3ed6755c 100644 --- a/Projectiles/AegisFlame.cs +++ b/Projectiles/AegisFlame.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 -{ - 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; - return; - } - } - - 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.75f), knockback, Main.myPlayer); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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.75f), knockback, Main.myPlayer); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/AetherBeam.cs b/Projectiles/AetherBeam.cs index d66e256083..49ed978f42 100644 --- a/Projectiles/AetherBeam.cs +++ b/Projectiles/AetherBeam.cs @@ -1,136 +1,136 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class AetherBeam : ModProjectile - { - 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.ai[0] = 0f; - projectile.timeLeft /= 2; - projectile.tileCollide = false; - } - 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(); - return; - } - } - } - - 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) - { - 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, 1f, 0f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); - } - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 240); - target.AddBuff(BuffID.Ichor, 400); - target.AddBuff(BuffID.Frostburn, 520); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Poisoned, 720); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class AetherBeam : ModProjectile + { + 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.ai[0] = 0f; + projectile.timeLeft /= 2; + projectile.tileCollide = false; + } + 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(); + return; + } + } + } + + 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) + { + 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, 1f, 0f); + int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 240); + target.AddBuff(BuffID.Ichor, 400); + target.AddBuff(BuffID.Frostburn, 520); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Poisoned, 720); + } + } } \ No newline at end of file diff --git a/Projectiles/AirSpinnerProjectile.cs b/Projectiles/AirSpinnerProjectile.cs index e726bf6de8..6643c824c0 100644 --- a/Projectiles/AirSpinnerProjectile.cs +++ b/Projectiles/AirSpinnerProjectile.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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/Ancient.cs b/Projectiles/Ancient.cs index 549fc0b0cc..6981588361 100644 --- a/Projectiles/Ancient.cs +++ b/Projectiles/Ancient.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 -{ - 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 ((num297 == 32 && 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 ((num297 == 32 && 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; - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 32 && 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 ((num297 == 32 && 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; + return; + } + } } \ No newline at end of file diff --git a/Projectiles/Ancient2.cs b/Projectiles/Ancient2.cs index 2e2c630fca..63117ade70 100644 --- a/Projectiles/Ancient2.cs +++ b/Projectiles/Ancient2.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 -{ - 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 ((num297 == 32 && 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 ((num297 == 32 && 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; - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 32 && 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 ((num297 == 32 && 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; + return; + } + } } \ No newline at end of file diff --git a/Projectiles/AngryChicken.cs b/Projectiles/AngryChicken.cs index 4ac443b48f..595b8457d4 100644 --- a/Projectiles/AngryChicken.cs +++ b/Projectiles/AngryChicken.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 -{ - 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) - { - 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 ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 800f; - float num634 = 1200f; - float num635 = 3000f; - float num636 = 150f; - 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; //0 - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((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; - return; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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 ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 800f; + float num634 = 1200f; + float num635 = 3000f; + float num636 = 150f; + 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; //0 + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((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; + return; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/AortaProjectile.cs b/Projectiles/AortaProjectile.cs index 929fb46569..ff7d3f7924 100644 --- a/Projectiles/AortaProjectile.cs +++ b/Projectiles/AortaProjectile.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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/ApothChloro.cs b/Projectiles/ApothChloro.cs index a42b6623e8..1f6b1c8153 100644 --- a/Projectiles/ApothChloro.cs +++ b/Projectiles/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 -{ - 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 +{ + 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/ApothJaws.cs b/Projectiles/ApothJaws.cs index 732395a533..790520a80d 100644 --- a/Projectiles/ApothJaws.cs +++ b/Projectiles/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 -{ - 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 +{ + 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/ApothMark.cs b/Projectiles/ApothMark.cs index 40c5c73b73..c99858b177 100644 --- a/Projectiles/ApothMark.cs +++ b/Projectiles/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 -{ - 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 +{ + 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/AquaBlast.cs b/Projectiles/AquaBlast.cs index bf6e2893fd..fd77bfd2e4 100644 --- a/Projectiles/AquaBlast.cs +++ b/Projectiles/AquaBlast.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 -{ - 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; - } - return; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/AquaBlastToxic.cs b/Projectiles/AquaBlastToxic.cs index 99abdc52d1..e5c1f8e752 100644 --- a/Projectiles/AquaBlastToxic.cs +++ b/Projectiles/AquaBlastToxic.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 -{ - 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/AquaticStar.cs b/Projectiles/AquaticStar.cs index 8ec5d3db95..8e3dd047b1 100644 --- a/Projectiles/AquaticStar.cs +++ b/Projectiles/AquaticStar.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 -{ - 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) - { - 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; - } - 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) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + 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 diff --git a/Projectiles/Archerfish.cs b/Projectiles/Archerfish.cs index f9130e3fea..e80c21566e 100644 --- a/Projectiles/Archerfish.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ArcticArrow.cs b/Projectiles/ArcticArrow.cs index 67433d37e7..6c8cd0717a 100644 --- a/Projectiles/ArcticArrow.cs +++ b/Projectiles/ArcticArrow.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 -{ - 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.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"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Asteroid.cs b/Projectiles/Asteroid.cs index 6da080a3a7..042bceb333 100644 --- a/Projectiles/Asteroid.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AsteroidMolten.cs b/Projectiles/AsteroidMolten.cs index 8b3bbf2309..c7120c93e8 100644 --- a/Projectiles/AsteroidMolten.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AstralPike.cs b/Projectiles/AstralPike.cs index 061ab590e3..aecb601bb0 100644 --- a/Projectiles/AstralPike.cs +++ b/Projectiles/AstralPike.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 -{ - 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; - } - - 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, 173, 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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, 173, 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; + } + } } \ No newline at end of file diff --git a/Projectiles/AstralRound.cs b/Projectiles/AstralRound.cs index 10d642f91e..86ddbe5962 100644 --- a/Projectiles/AstralRound.cs +++ b/Projectiles/AstralRound.cs @@ -1,151 +1,151 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 87; - } - else - { - randomDust = 86; - } - 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].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 = 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); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 87; + } + else + { + randomDust = 86; + } + 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].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 = 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 diff --git a/Projectiles/AstralShot.cs b/Projectiles/AstralShot.cs index 9dcf4231aa..6d2294bb41 100644 --- a/Projectiles/AstralShot.cs +++ b/Projectiles/AstralShot.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 -{ - 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(); - return; - } - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/AstralStar.cs b/Projectiles/AstralStar.cs index 22f2a1bc92..b69ceb4f09 100644 --- a/Projectiles/AstralStar.cs +++ b/Projectiles/AstralStar.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 -{ - 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() - { - 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, 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); - return; - } - } - } - - 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, 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 < 5; 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; - } - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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, 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); + return; + } + } + } + + 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, 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 < 5; 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; + } + 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 diff --git a/Projectiles/AstralStarMagic.cs b/Projectiles/AstralStarMagic.cs new file mode 100644 index 0000000000..2023300d8c --- /dev/null +++ b/Projectiles/AstralStarMagic.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + if (projectile.ai[0] == 1f) + { + projectile.magic = 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, 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); + return; + } + } + } + + 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, 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 < 5; 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; + } + 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 diff --git a/Projectiles/AstralStarMagic.png b/Projectiles/AstralStarMagic.png new file mode 100644 index 0000000000..bcd3ed059d Binary files /dev/null and b/Projectiles/AstralStarMagic.png differ diff --git a/Projectiles/AstrealArrow.cs b/Projectiles/AstrealArrow.cs index e3546a97db..a91be1a4f5 100644 --- a/Projectiles/AstrealArrow.cs +++ b/Projectiles/AstrealArrow.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 -{ - public class AstrealArrow : ModProjectile - { - public int flameTimer = 120; - - 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; - } - - 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, 5); - 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) - { - if (projectile.owner == Main.myPlayer) - { - int explosion = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, 659, (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explosion].timeLeft = 180; - Main.projectile[explosion].magic = false; - Main.projectile[explosion].ranged = true; - } - flameTimer = 120; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class AstrealArrow : ModProjectile + { + public int flameTimer = 120; + + 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; + } + + 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, 5); + 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) + { + if (projectile.owner == Main.myPlayer) + { + int explosion = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, 659, (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explosion].timeLeft = 180; + Main.projectile[explosion].magic = false; + Main.projectile[explosion].ranged = true; + } + flameTimer = 120; + } + } + + 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 diff --git a/Projectiles/AtaxiaHealOrb.cs b/Projectiles/AtaxiaHealOrb.cs index 84dfb69180..351546dc18 100644 --- a/Projectiles/AtaxiaHealOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AtaxiaOrb.cs b/Projectiles/AtaxiaOrb.cs index cd510eef07..56695966c4 100644 --- a/Projectiles/AtaxiaOrb.cs +++ b/Projectiles/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 -{ - 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.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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/AtlantisSpear.cs b/Projectiles/AtlantisSpear.cs index 9e00a93e8e..68c98dce76 100644 --- a/Projectiles/AtlantisSpear.cs +++ b/Projectiles/AtlantisSpear.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 -{ - 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); - return; - } - } - } - 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(); - return; - } - } - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + } + } + 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(); + return; + } + } + 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 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 diff --git a/Projectiles/AtlantisSpear2.cs b/Projectiles/AtlantisSpear2.cs index e8b23abdb7..1d470b24d7 100644 --- a/Projectiles/AtlantisSpear2.cs +++ b/Projectiles/AtlantisSpear2.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 -{ - 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(); - return; - } - } - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + 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 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 diff --git a/Projectiles/AuraRain.cs b/Projectiles/AuraRain.cs index f73802c415..2eb82025bb 100644 --- a/Projectiles/AuraRain.cs +++ b/Projectiles/AuraRain.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 -{ - 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() - { - for (int num121 = 0; num121 < 2; num121++) - { - 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 * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + for (int num121 = 0; num121 < 2; num121++) + { + 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 * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/AuricOrb.cs b/Projectiles/AuricOrb.cs index 08c10204e2..a1ac15f45d 100644 --- a/Projectiles/AuricOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/AzathothProjectile.cs b/Projectiles/AzathothProjectile.cs index 8794c490af..3d577958e7 100644 --- a/Projectiles/AzathothProjectile.cs +++ b/Projectiles/AzathothProjectile.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 -{ - 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(3) == 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(3) == 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); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/BalefulHarvesterProjectile.cs b/Projectiles/BalefulHarvesterProjectile.cs index 2659811c01..3770cbfa07 100644 --- a/Projectiles/BalefulHarvesterProjectile.cs +++ b/Projectiles/BalefulHarvesterProjectile.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 -{ - public class BalefulHarvesterProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpkin"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - 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 < 3; 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.7f), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - } - 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.OnFire, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BalefulHarvesterProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpkin"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + 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 < 3; 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.7f), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + } + 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.OnFire, 600); + } + } } \ No newline at end of file diff --git a/Projectiles/BallOFugu.cs b/Projectiles/BallOFugu.cs index 65388b5f98..7fc8585f44 100644 --- a/Projectiles/BallOFugu.cs +++ b/Projectiles/BallOFugu.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 -{ - public class BallOFugu : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball O Fugu"); - } - - 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; - } - - 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); - return; - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BallOFugu : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball O Fugu"); + } + + 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; + } + + 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); + return; + } + } + + 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 diff --git a/Projectiles/BallistaGreatArrow.cs b/Projectiles/BallistaGreatArrow.cs index 002bd5b36e..82ee68d88e 100644 --- a/Projectiles/BallistaGreatArrow.cs +++ b/Projectiles/BallistaGreatArrow.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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] = 6; - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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] = 6; + 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 diff --git a/Projectiles/BallisticPoisonBomb.cs b/Projectiles/BallisticPoisonBomb.cs index 4ad3ecafec..cb1a89050d 100644 --- a/Projectiles/BallisticPoisonBomb.cs +++ b/Projectiles/BallisticPoisonBomb.cs @@ -1,204 +1,204 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = true; - projectile.tileCollide = false; - } - - 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 && 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; - return; - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + } + + 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 && 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; + return; + } + + 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 diff --git a/Projectiles/BallisticPoisonBombSpike.cs b/Projectiles/BallisticPoisonBombSpike.cs index 0a549288a7..427f0de4c0 100644 --- a/Projectiles/BallisticPoisonBombSpike.cs +++ b/Projectiles/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 -{ - 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.thrown = 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) - { - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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) + { + 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 diff --git a/Projectiles/BallisticPoisonCloud.cs b/Projectiles/BallisticPoisonCloud.cs index a92d5d580e..ea0548e280 100644 --- a/Projectiles/BallisticPoisonCloud.cs +++ b/Projectiles/BallisticPoisonCloud.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/BallisticPoisonCloud2.cs b/Projectiles/BallisticPoisonCloud2.cs index f511c32af0..5ab24c40f7 100644 --- a/Projectiles/BallisticPoisonCloud2.cs +++ b/Projectiles/BallisticPoisonCloud2.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/BallisticPoisonCloud3.cs b/Projectiles/BallisticPoisonCloud3.cs index e3c03278ed..06347dcb4c 100644 --- a/Projectiles/BallisticPoisonCloud3.cs +++ b/Projectiles/BallisticPoisonCloud3.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/BansheeHook.cs b/Projectiles/BansheeHook.cs index 5870c27db6..163afc51f6 100644 --- a/Projectiles/BansheeHook.cs +++ b/Projectiles/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 -{ - 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/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"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/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"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/BansheeHookBoom.cs b/Projectiles/BansheeHookBoom.cs index 3ca6355504..529f3d5bcc 100644 --- a/Projectiles/BansheeHookBoom.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BansheeHookScythe.cs b/Projectiles/BansheeHookScythe.cs index 6b897c1bb6..dac62486c4 100644 --- a/Projectiles/BansheeHookScythe.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BeamingBolt.cs b/Projectiles/BeamingBolt.cs index 5dc39606f2..f098cf5974 100644 --- a/Projectiles/BeamingBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BeamingBolt2.cs b/Projectiles/BeamingBolt2.cs index 5e33fc771c..38b9bcffc3 100644 --- a/Projectiles/BeamingBolt2.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BeeRPG.cs b/Projectiles/BeeRPG.cs index 5432126533..50c94c97a8 100644 --- a/Projectiles/BeeRPG.cs +++ b/Projectiles/BeeRPG.cs @@ -1,178 +1,178 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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].magic = false; - Main.projectile[num520].ranged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].magic = false; + Main.projectile[num520].ranged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + 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 diff --git a/Projectiles/BeeRPGExplosion.cs b/Projectiles/BeeRPGExplosion.cs index c97c593b9d..8827a86451 100644 --- a/Projectiles/BeeRPGExplosion.cs +++ b/Projectiles/BeeRPGExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/BigBeamofDeath.cs b/Projectiles/BigBeamofDeath.cs index 49ed73d568..7c520b957c 100644 --- a/Projectiles/BigBeamofDeath.cs +++ b/Projectiles/BigBeamofDeath.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 -{ - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/BigBeamofDeath2.cs b/Projectiles/BigBeamofDeath2.cs index 2894e478f5..5ae98d8313 100644 --- a/Projectiles/BigBeamofDeath2.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BigBustyRose.cs b/Projectiles/BigBustyRose.cs index 0cc227048d..3e684cb509 100644 --- a/Projectiles/BigBustyRose.cs +++ b/Projectiles/BigBustyRose.cs @@ -1,242 +1,242 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.bWaifu = false; - } - if (modPlayer.bWaifu) - { - 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 > 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 = 300f; //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; - } - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - /*if (flag25) - { - num647 = num635; - }*/ - if (Vector2.Distance(player.Center, projectile.Center) > 800f) - { - 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 = 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, 1f, 0f); - Main.projectile[num659].timeLeft = 200; - projectile.netUpdate = 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 +{ + 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) + { + 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 > 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 = 300f; //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; + } + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + /*if (flag25) + { + num647 = num635; + }*/ + if (Vector2.Distance(player.Center, projectile.Center) > 800f) + { + 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 = 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, 1f, 0f); + Main.projectile[num659].timeLeft = 200; + projectile.netUpdate = true; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/BigNuke.cs b/Projectiles/BigNuke.cs index 8efa272467..608dda06e2 100644 --- a/Projectiles/BigNuke.cs +++ b/Projectiles/BigNuke.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 -{ - 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; - return; - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/BigNukeExplosion.cs b/Projectiles/BigNukeExplosion.cs index 6a0fd2e20f..ed8e6c5f87 100644 --- a/Projectiles/BigNukeExplosion.cs +++ b/Projectiles/BigNukeExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/BiomeOrb.cs b/Projectiles/BiomeOrb.cs index 6cf7d5eff9..d51d9faa6a 100644 --- a/Projectiles/BiomeOrb.cs +++ b/Projectiles/BiomeOrb.cs @@ -1,140 +1,140 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - 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; - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + 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; + 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 diff --git a/Projectiles/BlackAnurian.cs b/Projectiles/BlackAnurian.cs index 67a706d447..95798e1229 100644 --- a/Projectiles/BlackAnurian.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BlackAnurian.png b/Projectiles/BlackAnurian.png index afc1463b5d..5198e91f04 100644 Binary files a/Projectiles/BlackAnurian.png and b/Projectiles/BlackAnurian.png differ diff --git a/Projectiles/BlackAnurianPlankton.cs b/Projectiles/BlackAnurianPlankton.cs index 65dd920df0..55acb8691d 100644 --- a/Projectiles/BlackAnurianPlankton.cs +++ b/Projectiles/BlackAnurianPlankton.cs @@ -1,121 +1,132 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class BlackAnurianPlankton : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plankton"); - } - - 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() - { - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BlackAnurianPlankton.png b/Projectiles/BlackAnurianPlankton.png index 6ae200c22a..895f209fb8 100644 Binary files a/Projectiles/BlackAnurianPlankton.png and b/Projectiles/BlackAnurianPlankton.png differ diff --git a/Projectiles/BlazingPhantomBlade.cs b/Projectiles/BlazingPhantomBlade.cs index 99b69371f0..90a4133c08 100644 --- a/Projectiles/BlazingPhantomBlade.cs +++ b/Projectiles/BlazingPhantomBlade.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 -{ - 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; - return; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/Blood.cs b/Projectiles/Blood.cs index 0f51f628b0..d85ff8bef1 100644 --- a/Projectiles/Blood.cs +++ b/Projectiles/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 -{ - 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.penetrate = 1; - projectile.timeLeft = 200; - } - - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = 1; + projectile.timeLeft = 200; + } + + 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; + return; + } + } + + 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 diff --git a/Projectiles/BloodBall.cs b/Projectiles/BloodBall.cs index f376be4a9b..bb6e1ee811 100644 --- a/Projectiles/BloodBall.cs +++ b/Projectiles/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 -{ - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodBeam.cs b/Projectiles/BloodBeam.cs index 61badee875..3ccfb7f487 100644 --- a/Projectiles/BloodBeam.cs +++ b/Projectiles/BloodBeam.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 -{ - 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 ((num297 == 5 && 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; - if (num297 == 75) - { - 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; - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 5 && 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; + if (num297 == 75) + { + 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; + return; + } + } } \ No newline at end of file diff --git a/Projectiles/BloodBlast.cs b/Projectiles/BloodBlast.cs index 52e4b77ae8..8ccb831ae1 100644 --- a/Projectiles/BloodBlast.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodBolt.cs b/Projectiles/BloodBolt.cs index c04d7eadce..3213801d7f 100644 --- a/Projectiles/BloodBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodBomb.cs b/Projectiles/BloodBomb.cs index 2b500e99ba..0c4a275db2 100644 --- a/Projectiles/BloodBomb.cs +++ b/Projectiles/BloodBomb.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 -{ - 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; - projectile.ranged = true; - } - - 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; - } - return; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + projectile.ranged = true; + } + + 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; + } + return; + } + + 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 diff --git a/Projectiles/BloodBombExplosion.cs b/Projectiles/BloodBombExplosion.cs index 681fd2b78d..8a12d93c7c 100644 --- a/Projectiles/BloodBombExplosion.cs +++ b/Projectiles/BloodBombExplosion.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 -{ - 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.ranged = true; - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.ranged = true; + 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 diff --git a/Projectiles/BloodClotFriendly.cs b/Projectiles/BloodClotFriendly.cs index 8c08703e2c..fa01c7a6e8 100644 --- a/Projectiles/BloodClotFriendly.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodClotMinion.cs b/Projectiles/BloodClotMinion.cs index ae268729d0..8bf4336a38 100644 --- a/Projectiles/BloodClotMinion.cs +++ b/Projectiles/BloodClotMinion.cs @@ -1,289 +1,289 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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 = 900f; - bool flag19 = false; - int num538 = 500; - if (projectile.ai[1] != 0f) - { - num538 = 1400; - } - 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) - { - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) - { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - if (!flag19) - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) - { - if (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] = 17f; - } - 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; - } - } - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 = 900f; + bool flag19 = false; + int num538 = 500; + if (projectile.ai[1] != 0f) + { + num538 = 1400; + } + 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) + { + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + if (!flag19) + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) + { + if (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] = 17f; + } + 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 diff --git a/Projectiles/BloodOrb.cs b/Projectiles/BloodOrb.cs index 433e591e2c..377bdeeb9b 100644 --- a/Projectiles/BloodOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodRay.cs b/Projectiles/BloodRay.cs index ad2910042c..0f3986755d 100644 --- a/Projectiles/BloodRay.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BloodScythe.cs b/Projectiles/BloodScythe.cs index 2ea1a46862..ced91becb8 100644 --- a/Projectiles/BloodScythe.cs +++ b/Projectiles/BloodScythe.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 -{ - public class BloodScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.scale = 0.7f; - projectile.tileCollide = true; - projectile.penetrate = 1; - } - - 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BloodScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.scale = 0.7f; + projectile.tileCollide = true; + projectile.penetrate = 1; + } + + 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } } \ No newline at end of file diff --git a/Projectiles/BloodfireArrow.cs b/Projectiles/BloodfireArrow.cs index c2566aa607..7b370832d4 100644 --- a/Projectiles/BloodfireArrow.cs +++ b/Projectiles/BloodfireArrow.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 -{ - 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.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) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/BloodfireBullet.cs b/Projectiles/BloodfireBullet.cs index 8de5f837ce..faef54f74d 100644 --- a/Projectiles/BloodfireBullet.cs +++ b/Projectiles/BloodfireBullet.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 -{ - 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) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/BloodflareSoul.cs b/Projectiles/BloodflareSoul.cs index c849438690..2a00f42525 100644 --- a/Projectiles/BloodflareSoul.cs +++ b/Projectiles/BloodflareSoul.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 -{ - 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); - 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; - } - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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) - { - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + 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; + } + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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) + { + 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 diff --git a/Projectiles/BloodyBlade.cs b/Projectiles/BloodyBlade.cs index 49038caed3..29c0c29a6b 100644 --- a/Projectiles/BloodyBlade.cs +++ b/Projectiles/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 -{ - 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] = 7; - target.AddBuff(BuffID.Ichor, 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 +{ + 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] = 7; + target.AddBuff(BuffID.Ichor, 60); + } + } } \ No newline at end of file diff --git a/Projectiles/BlueAura.cs b/Projectiles/BlueAura.cs index 0f82be1711..3e738ee96c 100644 --- a/Projectiles/BlueAura.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BlueBubble.cs b/Projectiles/BlueBubble.cs index ce7acf5be6..1c1e87d72c 100644 --- a/Projectiles/BlueBubble.cs +++ b/Projectiles/BlueBubble.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 -{ - 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; - return; - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/BlueExoArrow.cs b/Projectiles/BlueExoArrow.cs index a07ec91d3e..92ae735b1d 100644 --- a/Projectiles/BlueExoArrow.cs +++ b/Projectiles/BlueExoArrow.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 -{ - 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 = 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(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 = 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 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("BlueExoArrow2"), (int)((double)projectile.damage * 0.7f), 1f, projectile.owner); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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 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("BlueExoArrow2"), (int)((double)projectile.damage * 0.7f), 1f, projectile.owner); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/BlueExoArrow2.cs b/Projectiles/BlueExoArrow2.cs index 02b84de8fb..9066e50d1e 100644 --- a/Projectiles/BlueExoArrow2.cs +++ b/Projectiles/BlueExoArrow2.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 -{ - 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 = 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(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 = 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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 diff --git a/Projectiles/BlushieStaffProj.cs b/Projectiles/BlushieStaffProj.cs index 47d1c2dad0..80fc36969d 100644 --- a/Projectiles/BlushieStaffProj.cs +++ b/Projectiles/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 -{ - 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.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) / 5; - 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; - } - } - } +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 +{ + 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.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) / 5; + 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 diff --git a/Projectiles/Bolt.cs b/Projectiles/Bolt.cs index 1eaf7e32cf..5d74847a81 100644 --- a/Projectiles/Bolt.cs +++ b/Projectiles/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 -{ - 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] == 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, 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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] == 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, 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 diff --git a/Projectiles/BoltArrow.cs b/Projectiles/BoltArrow.cs index 636ee588aa..c8c76135fc 100644 --- a/Projectiles/BoltArrow.cs +++ b/Projectiles/BoltArrow.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BoltExplosion.cs b/Projectiles/BoltExplosion.cs index 96f8bed000..6d0bce97de 100644 --- a/Projectiles/BoltExplosion.cs +++ b/Projectiles/BoltExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 3; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 3; + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index f4cafc7c22..84e092681e 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.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.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.ManaSickness, 60); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); - } - } +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.ManaSickness, 60); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index 5199070113..33a9dc1c01 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.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.Boss -{ - public class AbyssBallVolley2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball Volley V2"); - } - - 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, 60); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); - } - } +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 V2"); + } + + 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, 60); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs index d1557fa181..ea6dd305c4 100644 --- a/Projectiles/Boss/AbyssMine.cs +++ b/Projectiles/Boss/AbyssMine.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 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.ManaSickness, 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } +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.ManaSickness, 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AbyssMine2.cs b/Projectiles/Boss/AbyssMine2.cs index b61528e689..96db73830a 100644 --- a/Projectiles/Boss/AbyssMine2.cs +++ b/Projectiles/Boss/AbyssMine2.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.Boss -{ - public class AbyssMine2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Mine V2"); - } - - 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, 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } +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 V2"); + } + + 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, 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 5564b2b6b1..b4afde88fd 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("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, (Main.rand.Next(2) == 0 ? 173 : 55), 0f, 0f, 100, default(Color), 2f); - 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) //18 - { - 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"), 60); - } - - 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, (Main.rand.Next(2) == 0 ? 173 : 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, (Main.rand.Next(2) == 0 ? 173 : 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, (Main.rand.Next(2) == 0 ? 173 : 55), 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } +using System; +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("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), 2f); + 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) //18 + { + 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"), 60); + } + + 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), 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, mod.DustType("AstralOrange"), 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, 173, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index 0129c36177..1f134722ea 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("Laser"); - 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); - } - } +using System; +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("Laser"); + 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 diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index ddfa50a428..0795c7d5db 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.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.Boss -{ - public class AstralShot2 : 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.timeLeft = 600; - } - - 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(); - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 60); - } - - 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; - } - } +using System; +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("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + 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(); + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 60); + } + + 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 diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 76190d262d..e523b6e451 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -1,157 +1,157 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BigFlare : 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 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(); - return; - } - } - - 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 num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), 0, 4f, Main.myPlayer, 16f, 20f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BigFlare : 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 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(); + return; + } + } + + 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 num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), 0, 4f, Main.myPlayer, 16f, 20f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs index e3ec666525..09a829f6d2 100644 --- a/Projectiles/Boss/BloodClot.cs +++ b/Projectiles/Boss/BloodClot.cs @@ -1,45 +1,45 @@ -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() - { - 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), 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"), 200); - } - } +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() + { + 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), 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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 222c77e519..e9310474fd 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -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"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimDust.cs b/Projectiles/Boss/BrimDust.cs index a3400649b3..eb53d515c6 100644 --- a/Projectiles/Boss/BrimDust.cs +++ b/Projectiles/Boss/BrimDust.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.Boss -{ - public class BrimDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimdust"); - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.975f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - for (int num468 = 0; num468 < 3; 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 void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - - 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 = 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, 235, 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, 235, 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, 235, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimdust"); + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.975f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + for (int num468 = 0; num468 < 3; 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 void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + + 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 = 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, 235, 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, 235, 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, 235, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + 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); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index c9418ca783..655796cbe5 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.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 BrimstoneBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - 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); - 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), 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"), 240); - } - } +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("Ball"); + } + + 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); + 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), 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"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 062ba342f8..ecfcb5818f 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.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.Boss -{ - public class BrimstoneBarrage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone"); - 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, ((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 void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120); - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - target.AddBuff(mod.BuffType("VulnerabilityHex"), 90, 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; - } - } +using System; +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"); + 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, ((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 void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120); + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + target.AddBuff(mod.BuffType("VulnerabilityHex"), 90, 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 diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index c85a0728e4..e405acff8e 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.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.Boss -{ - public class BrimstoneFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if ((num297 == 235 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } +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("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.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if ((num297 == 235 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 87c2ce6ff2..df334895ca 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.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.Boss -{ - public class BrimstoneFireblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireblast"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 120; - cooldownSlot = 1; - } - - public override void AI() - { - 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; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneFireblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireblast"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 120; + cooldownSlot = 1; + } + + public override void AI() + { + 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; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + } + + 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 diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 0863c43715..6859afde90 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.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.Boss -{ - public class BrimstoneGigaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giga Blast"); - } - - 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() - { - 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; - return; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - return; - } - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneGigaBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giga Blast"); + } + + 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() + { + 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; + return; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + return; + } + } + } + + 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 diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 7db0e5fcab..5a806ec381 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.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.Boss -{ - public class BrimstoneHellblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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"), 120); - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - target.AddBuff(mod.BuffType("VulnerabilityHex"), 90, 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneHellblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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"), 120); + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + target.AddBuff(mod.BuffType("VulnerabilityHex"), 90, 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 diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 12d7902850..b5493a688c 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.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 BrimstoneHellblast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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); - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneHellblast2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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); + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 7ab697eafa..2a1d398d27 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.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.Boss -{ - public class BrimstoneHellfireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire"); - } - - 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.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 10; 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("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } +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("Hellfire"); + } + + 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.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 10; 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("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs index 044c288a27..8b86167c78 100644 --- a/Projectiles/Boss/BrimstoneLaser.cs +++ b/Projectiles/Boss/BrimstoneLaser.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.Boss -{ - public class BrimstoneLaser : ModProjectile - { - public int splitTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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"), (int)((double)projectile.damage * 0.75f), 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"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneLaser : ModProjectile + { + public int splitTimer = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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"), (int)((double)projectile.damage * 0.75f), 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs index 8e9b69b88e..82375a64de 100644 --- a/Projectiles/Boss/BrimstoneLaserSplit.cs +++ b/Projectiles/Boss/BrimstoneLaserSplit.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.Boss -{ - public class BrimstoneLaserSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 120; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 210f && 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; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - } - - 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"), 120); - } - } +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("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 120; + } + + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 210f && 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; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + } + + 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index d624f70061..e3e78c2128 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.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.Boss -{ - public class BrimstoneMonster : ModProjectile - { - public float speedAdd = 0f; - public float speedLimit = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 AI() - { - if (NPC.CountNPCS(mod.NPCType("SupremeCalamitas")) < 1) - { - projectile.active = false; - 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; - return; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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 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); - if (CalamityWorld.death) - { - target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, 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.Boss +{ + public class BrimstoneMonster : ModProjectile + { + public float speedAdd = 0f; + public float speedLimit = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 AI() + { + if (NPC.CountNPCS(mod.NPCType("SupremeCalamitas")) < 1) + { + projectile.active = false; + 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; + return; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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 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); + if (CalamityWorld.death) + { + target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index fb57371e28..378be56635 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -1,81 +1,81 @@ -using System; -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 - { - public int x; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - } - - 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); - if (CalamityWorld.death) - { - target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, 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.Boss +{ + public class BrimstoneWave : ModProjectile + { + public int x; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + } + + 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); + if (CalamityWorld.death) + { + target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/CosmicFlameBurst.cs b/Projectiles/Boss/CosmicFlameBurst.cs index f4b4d7898d..11ff553046 100644 --- a/Projectiles/Boss/CosmicFlameBurst.cs +++ b/Projectiles/Boss/CosmicFlameBurst.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.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; - } - 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); - } - } +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; + } + 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); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 829b4614ee..9edbbe9a9f 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.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.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; - } - - 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; - } - int num1009 = 1; - int num1010 = 60; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(projectile.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 173, projectile.velocity.X * 0.5f, projectile.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; - } - } - } - - 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); - } - } - } +using System; +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; + } + + 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; + } + int num1009 = 1; + int num1010 = 60; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(projectile.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 173, projectile.velocity.X * 0.5f, projectile.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; + } + } + } + + 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 diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index c2001d680e..db2f9e4fda 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -1,101 +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 DeusMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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 Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 0, 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, 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); - } - } +using System; +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("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 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 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 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index c4244a9cb4..b2ca13a6ef 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("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); - } - } +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("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 diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 42638e2fba..4422c9473f 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -1,130 +1,130 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGBeamPortal : ModProjectile - { - public int beamTimer = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGBeamPortal : ModProjectile + { + public int beamTimer = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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 diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 7cc68e968b..01361ece12 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,102 +1,102 @@ -using System; -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"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - 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() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - 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(); - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 255, 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; - } - } +using System; +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"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + 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() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + 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(); + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 255, 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 diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 839d7ed67d..7c7cabe99f 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -1,123 +1,123 @@ -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; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - 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 ((num297 == 173 && 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; - if (num297 == 173) - { - 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; - return; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 420); - target.AddBuff(BuffID.Frostburn, 420, true); - target.AddBuff(BuffID.Darkness, 420, true); - } - } +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; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + 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 ((num297 == 173 && 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; + if (num297 == 173) + { + 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; + return; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 420); + target.AddBuff(BuffID.Frostburn, 420, true); + target.AddBuff(BuffID.Darkness, 420, true); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs index c1b513cee3..79734fcd4d 100644 --- a/Projectiles/Boss/DoGNebulaShot.cs +++ b/Projectiles/Boss/DoGNebulaShot.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 DoGNebulaShot : 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 = 4; - projectile.timeLeft = 180; - cooldownSlot = 1; - } - - 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(); - return; - } - } - } - - 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; - } - } +using System; +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("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 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index f5ca21f2a8..6a7b30d34c 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("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; - } - } - } +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("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 diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 15b08fd8b4..a812b6b3dc 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -1,158 +1,158 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -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 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(); - return; - } - } - - 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, 16f, 8f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +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 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(); + return; + } + } + + 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, 16f, 8f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 1783e35e2f..77d8862d98 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.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.Boss -{ - public class FlareBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - return; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - return; - } - } - } - - 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; - } - } - } +using System; +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 FlareBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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; + return; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + return; + } + } + } + + 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 diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 7d284f051f..73600854a1 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.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.Boss -{ - public class FlareDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - 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(); - } - } +using System; +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("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 void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + 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 diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 55d7d3f4c6..adc1ec182d 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FlareDust2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 = 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 (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) - { - projectile.velocity *= 1.05f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - 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; - } - } - } +using System; +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("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 = 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 (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) + { + projectile.velocity *= 1.05f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + 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 diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 36737e08de..755802c78b 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,143 +1,143 @@ -using System; -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 int spawnCount = 0; - - 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 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, 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); - return; - } - } - - public override bool CanDamage() - { - if (projectile.timeLeft > 500) - { - 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; - } - } +using System; +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 int spawnCount = 0; + + 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 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, 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); + return; + } + } + + public override bool CanDamage() + { + if (projectile.timeLeft > 500) + { + 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 diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index ab1b361b22..44bb6ddaaa 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FrostMist : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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.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); - 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 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(BuffID.Frostburn, 150, 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.Boss +{ + public class FrostMist : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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.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); + 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 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(BuffID.Frostburn, 150, true); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/GigaFlare.cs b/Projectiles/Boss/GigaFlare.cs index a954b14abe..9168c779b7 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("Flare"); - 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; - } - } - } +using System; +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("Flare"); + 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 diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 80faaefd78..30fedd4532 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("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"), 500); - } - } +using System; +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("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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 0a96dd24b5..25a2ab12be 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("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"), 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.Boss +{ + public class HolyBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 391434a384..c5ea78385f 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,113 +1,113 @@ -using System; -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 - { - public int flareShootTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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"), 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.Boss +{ + public class HolyBomb : ModProjectile + { + public int flareShootTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index b3d25912ed..1c08ae4feb 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; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolyBurnOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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) - { - 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(); - } - return; - } - - 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); - } - } +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 HolyBurnOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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) + { + 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(); + } + return; + } + + 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 diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 19e1b4a89e..3aca5435d3 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("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); - } - } +using System; +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("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 diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 0dfcbe6768..ade084a034 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("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); - } - } +using System; +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("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 diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 5509af995f..99a1216303 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,119 +1,119 @@ -using System; -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("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; - return; - } - - 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); - } - } +using System; +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("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; + return; + } + + 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 diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 788538d1d9..79b25345d7 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.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.Boss -{ - public class HolyLight : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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(); - } - return; - } - - 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; - } - } - } +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("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(); + } + return; + } + + 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 diff --git a/Projectiles/Boss/HolyShot.cs b/Projectiles/Boss/HolyShot.cs index fabb1eacbd..e420dcadf3 100644 --- a/Projectiles/Boss/HolyShot.cs +++ b/Projectiles/Boss/HolyShot.cs @@ -1,63 +1,63 @@ -using System; -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("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 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); - } - } +using System; +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("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 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); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 7e809a466b..4c91746fe1 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,92 +1,92 @@ -using System; -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("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 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); - } - } +using System; +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("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 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); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 3c71a551d0..28f114fe6e 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.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.Boss -{ - public class IceBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice"); - } - - 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) - { - if (Main.rand.Next(20) == 0) - { - target.AddBuff(47, 60, 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; - } - } +using System; +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"); + } + + 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) + { + if (Main.rand.Next(20) == 0) + { + target.AddBuff(47, 60, true); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 803c54b6bd..48dddd0290 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.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.Boss -{ - public class IceBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - if (Main.rand.Next(6) == 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 = 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(mod.BuffType("GlacialState"), 60); - } - } +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("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; + if (Main.rand.Next(6) == 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 = 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(mod.BuffType("GlacialState"), 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index aebd4c5033..504f59919f 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.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.Boss -{ - public class IceRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice"); - } - - public override void SetDefaults() - { - projectile.aiStyle = 1; - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - } - - 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) - { - if (Main.rand.Next(20) == 0) - { - target.AddBuff(47, 60, true); - } - } - } +using System; +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"); + } + + public override void SetDefaults() + { + projectile.aiStyle = 1; + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + } + + 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) + { + if (Main.rand.Next(20) == 0) + { + target.AddBuff(47, 60, true); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 69fcdb8287..feb028648d 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, 200); - } - } +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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index cbfd03fe2e..629fdfc43b 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,148 +1,148 @@ -using System; -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 int spawnCount = 0; - - 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 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, 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 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; - } - } +using System; +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 int spawnCount = 0; + + 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 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, 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 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 diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index e834e18419..9fb727b973 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -1,141 +1,141 @@ -using System; -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 AI() - { - if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) - { - 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); - } - } +using System; +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 AI() + { + if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) + { + 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 diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index 8cde9b1bb0..971ba26af0 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -1,87 +1,87 @@ -using System; -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("Bomb"); - } - - 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 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; - } - } - } +using System; +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("Bomb"); + } + + 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 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 diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 120cb9dd5b..0fde165cd3 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,132 +1,132 @@ -using System; -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("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 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"), 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.Boss +{ + public class MoltenBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 7206e7798e..a4e4d3efd3 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.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.Boss -{ - public class MoltenBlob : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - cooldownSlot = 1; - } - - 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"), 120); - } - } +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("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; + cooldownSlot = 1; + } + + 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"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 5c2b398c90..93a530ba55 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("Bomb"); - 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; - } - } - } +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("Bomb"); + 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 diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index fefe23364c..c204872532 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("Bomb"); - 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; - } - } - } +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("Bomb"); + 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 diff --git a/Projectiles/Boss/Mushmash.cs b/Projectiles/Boss/Mushmash.cs index ae58cd72b3..1e1fb74f66 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("Mush"); - } - - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; - } - } +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("Mush"); + } + + 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 diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 3949097daa..fe2af03366 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.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.Boss -{ - public class PhantomBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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; - } - } - } +using System; +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("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 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 diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 62d2d38cc5..a1bcd31473 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.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.Boss -{ - public class PhantomBlast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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; - } - } - } +using System; +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("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 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 diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 2d77007612..eb7c2cc939 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("Ghost Mine"); - } - - 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; - } - } - } +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("Ghost Mine"); + } + + 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 diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 01981c94ec..503e6586a4 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.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.Boss -{ - public class PhantomShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 4; - cooldownSlot = 1; - } - - 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 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] > 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); - } - } +using System; +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("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 4; + cooldownSlot = 1; + } + + 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 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] > 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 diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 70770b027a..55c9e5bda6 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.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.Boss -{ - public class PhantomShot2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 5; - cooldownSlot = 1; - } - - 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 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] > 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); - } - } +using System; +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("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 5; + cooldownSlot = 1; + } + + 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 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] > 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 diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 04ed19b5ef..cf7f2b1afd 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("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"), 240); - } - - 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); - } - } +using System; +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("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"), 240); + } + + 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 diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 05b35c0ebe..49c7a68a6f 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("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"), 240); - } - - 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); - } - } - } +using System; +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("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"), 240); + } + + 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 diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index d8b3a9ac9e..7fbf5bb5a0 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.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 ProfanedSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 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); - } - } +using System; +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("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 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); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 1f11bc3f16..ea06849608 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,122 +1,122 @@ -using System; -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 ProvidenceCrystal : ModProjectile - { - public float speedX = -15f; - public float speedY = -3f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence Crystal"); - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.ignoreWater = true; - projectile.timeLeft = 3900; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.penetrate = -1; - cooldownSlot = 1; - } - - 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; - } - } +using System; +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 ProvidenceCrystal : ModProjectile + { + public float speedX = -15f; + public float speedY = -3f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Crystal"); + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.ignoreWater = true; + projectile.timeLeft = 3900; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + } + + 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 diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 14deb86148..fbb097f649 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,187 +1,187 @@ -using System; -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("Crystal"); - } - - 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 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); - } - } +using System; +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("Crystal"); + } + + 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 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 diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 5ae2ea14b1..ef427c4985 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,180 +1,180 @@ -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; -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 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; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); - } - 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; - 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; - int num3; - for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) - { - num807 += array3[num808]; - num3 = num808; - } - num807 /= num805; - float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); - 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]; - 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; - } - } +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; +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 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; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); + } + 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]; //array of 3 elements...initial value of 0...never given any other value...why? + 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) //3 passes + { + num807 += array3[num808]; + num3 = num808; + } + num807 /= num805; //0 divided by 3... + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index ccd134cd78..e072d5cb46 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("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 < 4; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 2f); - 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); - } - } +using System; +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("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 < 4; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 2f); + 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 diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 0867b4a57b..9f9f72d138 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.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.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; - } - - 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(); - } - } +using System; +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; + } + + 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 diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index dff7351868..2a6a979429 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.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.Boss -{ - public class SandBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand"); - } - - 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.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); - 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; - } - } - } +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"); + } + + 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.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); + 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 diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 5f159de9ff..5059018565 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.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 SandPoisonCloud : 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] >= (CalamityWorld.death ? 2100f : 1500f)) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SandPoisonCloud : 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] >= (CalamityWorld.death ? 2100f : 1500f)) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 4c05e38cd3..75e5a40a9a 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("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; - } - } +using System; +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("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 diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 7a16989ec3..f771277af9 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.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.Boss -{ - public class ScavengerLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - } - - 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) - { - 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, 1.2f); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - return; - } - - 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 < 4; 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 < 40; 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ScavengerLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + } + + 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) + { + 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, 1.2f); + Main.dust[num805].noGravity = true; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + return; + } + + 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 < 4; 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 < 40; 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 diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 8e5e11cd97..b65842db84 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.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.Boss -{ - public class ScavengerNuke : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ScavengerNuke : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 96da78dd3d..151e46828c 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.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 ShadeNimbusHostile : 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.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] >= 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; - 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); - } - } - 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; - } - } - } - } +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("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] >= 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; + 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); + } + } + 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 diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index 9017712a92..0f4ffbf595 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.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 ShaderainHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - return; - } - - 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; - } - } +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("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; + return; + } + + 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 diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 2d6e16ed1f..0e78f07437 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.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.Boss -{ - public class SirenSong : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 1800; - } - - 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; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 26); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Confused, 60); - } - } +using System; +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("Song"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 1800; + } + + 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; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 26); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Confused, 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index e3a57eeaa4..f7f9cad68b 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("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; - } - } - } +using System; +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("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 diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index 856a05d448..7f72e8c5f6 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.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.Boss -{ - public class VileClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 61, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - } +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("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() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 61, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index d34fc19bd0..53dfe0ce7b 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -1,96 +1,96 @@ -using System; -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("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 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, 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, 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); - } - } +using System; +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("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 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, 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, 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 diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 2e2f85ed35..a9b58001e5 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.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.Boss -{ - public class YharonFireball : ModProjectile - { - public float speedX = -3f; - public float speedY = -50f; - public float speedX2 = -5f; - public float speedY2 = -75f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.aiStyle = 1; - aiType = 686; - } - - public override 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) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, speedY, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX += 3f; - } - if (CalamityWorld.death) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, speedY2, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX2 += 5f; - } - } - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class YharonFireball : ModProjectile + { + public float speedX = -3f; + public float speedY = -50f; + public float speedX2 = -5f; + public float speedY2 = -75f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.aiStyle = 1; + aiType = 686; + } + + public override 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) + { + for (int x = 0; x < 3; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, speedY, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX += 3f; + } + if (CalamityWorld.death) + { + for (int x = 0; x < 3; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, speedY2, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX2 += 5f; + } + } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index be3ab2a6d2..563a52e68d 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class YharonFireball2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - } - - 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 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class YharonFireball2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + } + + 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 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 diff --git a/Projectiles/Boss/YharonFireballHoming.cs b/Projectiles/Boss/YharonFireballHoming.cs index df2f5691e8..93ef95104f 100644 --- a/Projectiles/Boss/YharonFireballHoming.cs +++ b/Projectiles/Boss/YharonFireballHoming.cs @@ -1,170 +1,170 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class YharonFireballHoming : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= (CalamityWorld.death ? 330f : 110f)) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.ai[1] = -projectile.ai[1]; - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 2f) - { - float speed = 12f; - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 60f) - { - projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); - if (vector70.Y < speed) - { - vector70.Y = speed; - } - float num804 = 0.8f; //0.4 - if (projectile.velocity.X < vector70.X) - { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) - { - projectile.velocity.X = projectile.velocity.X + num804; - } - } - else if (projectile.velocity.X > vector70.X) - { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) - { - projectile.velocity.X = projectile.velocity.X - num804; - } - } - if (projectile.velocity.Y < vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - } - } - else if (projectile.velocity.Y > vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - } - } - } - if (projectile.alpha < 40) - { - int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 55, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 50, default(Color), 1.2f); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 188); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class YharonFireballHoming : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= (CalamityWorld.death ? 330f : 110f)) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 1f; + projectile.ai[1] = -projectile.ai[1]; + projectile.netUpdate = true; + } + projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y = projectile.velocity.Y - 0.08f; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + if (projectile.velocity.Y < -7f) + { + projectile.velocity.Y = -7f; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 2f; + projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); + projectile.netUpdate = true; + } + projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y = projectile.velocity.Y - 0.08f; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + if (projectile.velocity.Y < -7f) + { + projectile.velocity.Y = -7f; + } + } + else if (projectile.ai[0] == 2f) + { + float speed = 12f; + Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (vector70.Length() < 60f) + { + projectile.Kill(); + return; + } + vector70.Normalize(); + vector70 *= 14f; + vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + if (vector70.Y < speed) + { + vector70.Y = speed; + } + float num804 = 0.8f; //0.4 + if (projectile.velocity.X < vector70.X) + { + projectile.velocity.X = projectile.velocity.X + num804; + if (projectile.velocity.X < 0f && vector70.X > 0f) + { + projectile.velocity.X = projectile.velocity.X + num804; + } + } + else if (projectile.velocity.X > vector70.X) + { + projectile.velocity.X = projectile.velocity.X - num804; + if (projectile.velocity.X > 0f && vector70.X < 0f) + { + projectile.velocity.X = projectile.velocity.X - num804; + } + } + if (projectile.velocity.Y < vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + if (projectile.velocity.Y < 0f && vector70.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num804; + } + } + else if (projectile.velocity.Y > vector70.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + if (projectile.velocity.Y > 0f && vector70.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num804; + } + } + } + if (projectile.alpha < 40) + { + int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 55, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 50, default(Color), 1.2f); + Main.dust[num805].noGravity = true; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 188); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } \ No newline at end of file diff --git a/Projectiles/BrackishFlask.cs b/Projectiles/BrackishFlask.cs index 3428962c6c..8457a3f78e 100644 --- a/Projectiles/BrackishFlask.cs +++ b/Projectiles/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 -{ - public class BrackishFlask : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brackish Flask"); - } - - public override void SetDefaults() - { - projectile.width = 25; - projectile.height = 25; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; - aiType = 48; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BrackishFlask : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brackish Flask"); + } + + public override void SetDefaults() + { + projectile.width = 25; + projectile.height = 25; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 180; + aiType = 48; + } + + 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 diff --git a/Projectiles/BrackishWater.cs b/Projectiles/BrackishWater.cs index b325df419c..fc80288203 100644 --- a/Projectiles/BrackishWater.cs +++ b/Projectiles/BrackishWater.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 -{ - 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.thrown = 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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; + } + return; + } + + 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 diff --git a/Projectiles/BrackishWaterBlast.cs b/Projectiles/BrackishWaterBlast.cs index 3a259615f0..189f57fee0 100644 --- a/Projectiles/BrackishWaterBlast.cs +++ b/Projectiles/BrackishWaterBlast.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 -{ - 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.thrown = 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++; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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++; + } + return; + } + + 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 diff --git a/Projectiles/Brimblade.cs b/Projectiles/Brimblade.cs index 89933346b5..73f78dff45 100644 --- a/Projectiles/Brimblade.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - 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.85f), projectile.knockBack * 0.85f, 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + 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.85), 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 diff --git a/Projectiles/Brimblade2.cs b/Projectiles/Brimblade2.cs index 6662bcd48a..3d0374aaf7 100644 --- a/Projectiles/Brimblade2.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + 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 diff --git a/Projectiles/Brimblast.cs b/Projectiles/Brimblast.cs index 02d97a551e..8dd850466f 100644 --- a/Projectiles/Brimblast.cs +++ b/Projectiles/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 -{ - 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.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; - return; - } - } - - 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"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + return; + } + } + + 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"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/Brimlance.cs b/Projectiles/Brimlance.cs index 5822dbb5a4..5ed985349f 100644 --- a/Projectiles/Brimlance.cs +++ b/Projectiles/Brimlance.cs @@ -1,102 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - - 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) - { - int fire = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly"), (int)((double)projectile.damage * 0.75), knockback, Main.myPlayer); - Main.projectile[fire].timeLeft = 60; - Main.projectile[fire].magic = false; - Main.projectile[fire].melee = true; - 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 standFire = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("StandingFire"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - Main.projectile[standFire].melee = true; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/BrimlanceHellfireExplosion.cs b/Projectiles/BrimlanceHellfireExplosion.cs new file mode 100644 index 0000000000..8932c8591a --- /dev/null +++ b/Projectiles/BrimlanceHellfireExplosion.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1000); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimlanceHellfireExplosion.png b/Projectiles/BrimlanceHellfireExplosion.png new file mode 100644 index 0000000000..59d45407ff Binary files /dev/null and b/Projectiles/BrimlanceHellfireExplosion.png differ diff --git a/Projectiles/BrimlanceStandingFire.cs b/Projectiles/BrimlanceStandingFire.cs new file mode 100644 index 0000000000..545630d501 --- /dev/null +++ b/Projectiles/BrimlanceStandingFire.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), 160); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimlanceStandingFire.png b/Projectiles/BrimlanceStandingFire.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/BrimlanceStandingFire.png differ diff --git a/Projectiles/Brimlash.cs b/Projectiles/Brimlash.cs index e0d9c0f7b4..8602cc0e61 100644 --- a/Projectiles/Brimlash.cs +++ b/Projectiles/Brimlash.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 -{ - 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/Brimlash2.cs b/Projectiles/Brimlash2.cs index 002f549b4f..bbeff8006e 100644 --- a/Projectiles/Brimlash2.cs +++ b/Projectiles/Brimlash2.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 -{ - 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; - return; - } - 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; - } - return; - } - - public override void OnHitNPC(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.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + 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; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } } \ No newline at end of file diff --git a/Projectiles/Brimling.cs b/Projectiles/Brimling.cs index 5fbbbeb6af..2ad5078619 100644 --- a/Projectiles/Brimling.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +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 +{ + 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 diff --git a/Projectiles/BrimstoneBall2.cs b/Projectiles/BrimstoneBall2.cs index f54aa33275..cc1a4e0f61 100644 --- a/Projectiles/BrimstoneBall2.cs +++ b/Projectiles/BrimstoneBall2.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 -{ - public class BrimstoneBall2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - 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); - 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 *= 2f; - } - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BrimstoneBall2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + 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); + 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 *= 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 diff --git a/Projectiles/BrimstoneBallFriendly.cs b/Projectiles/BrimstoneBallFriendly.cs index 8e832c4f98..707de011c6 100644 --- a/Projectiles/BrimstoneBallFriendly.cs +++ b/Projectiles/BrimstoneBallFriendly.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 -{ - 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.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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/BrimstoneBeam.cs b/Projectiles/BrimstoneBeam.cs index 83d039708e..f9ee5aa772 100644 --- a/Projectiles/BrimstoneBeam.cs +++ b/Projectiles/BrimstoneBeam.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam2.cs b/Projectiles/BrimstoneBeam2.cs index f9c93d7c62..bf3d71bc7f 100644 --- a/Projectiles/BrimstoneBeam2.cs +++ b/Projectiles/BrimstoneBeam2.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam3.cs b/Projectiles/BrimstoneBeam3.cs index 9f375f2461..729a1a4fcd 100644 --- a/Projectiles/BrimstoneBeam3.cs +++ b/Projectiles/BrimstoneBeam3.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam4.cs b/Projectiles/BrimstoneBeam4.cs index 3d8dccb662..ebe13ae793 100644 --- a/Projectiles/BrimstoneBeam4.cs +++ b/Projectiles/BrimstoneBeam4.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam5.cs b/Projectiles/BrimstoneBeam5.cs index 6fefa39030..1731a5892e 100644 --- a/Projectiles/BrimstoneBeam5.cs +++ b/Projectiles/BrimstoneBeam5.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBolt.cs b/Projectiles/BrimstoneBolt.cs index b3d58dd093..853d77d1e1 100644 --- a/Projectiles/BrimstoneBolt.cs +++ b/Projectiles/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 -{ - 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"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneBoom.cs b/Projectiles/BrimstoneBoom.cs index 7340cf585c..0c826273b6 100644 --- a/Projectiles/BrimstoneBoom.cs +++ b/Projectiles/BrimstoneBoom.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneFireFriendly.cs b/Projectiles/BrimstoneFireFriendly.cs index 4ca49828ba..8267273413 100644 --- a/Projectiles/BrimstoneFireFriendly.cs +++ b/Projectiles/BrimstoneFireFriendly.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 -{ - 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 ((num297 == 235 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 235 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneFireSummon.cs b/Projectiles/BrimstoneFireSummon.cs index 9c44d884b2..051f939911 100644 --- a/Projectiles/BrimstoneFireSummon.cs +++ b/Projectiles/BrimstoneFireSummon.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 -{ - 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 = 0; - projectile.penetrate = -1; - 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.timeLeft > 50) - { - projectile.timeLeft = 50; - } - 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 ((num297 == 235 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.immune[projectile.owner] = 7; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 0; + projectile.penetrate = -1; + 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.timeLeft > 50) + { + projectile.timeLeft = 50; + } + 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 ((num297 == 235 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.immune[projectile.owner] = 7; + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneFireball.cs b/Projectiles/BrimstoneFireball.cs index 2f033d9359..14ca9e7875 100644 --- a/Projectiles/BrimstoneFireball.cs +++ b/Projectiles/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 -{ - 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"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneHellfireballFriendly.cs b/Projectiles/BrimstoneHellfireballFriendly.cs index b41f82e2f9..ac5215b39e 100644 --- a/Projectiles/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/BrimstoneHellfireballFriendly.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 -{ - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - 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"), 1000); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + 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"), 1000); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneHellfireballFriendly2.cs b/Projectiles/BrimstoneHellfireballFriendly2.cs index d8f3cc6db7..cf14afcb1d 100644 --- a/Projectiles/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/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 -{ - 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"), 1000); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 1000); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneHomer.cs b/Projectiles/BrimstoneHomer.cs index ecd2685721..6faf745e33 100644 --- a/Projectiles/BrimstoneHomer.cs +++ b/Projectiles/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 -{ - 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.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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/BrimstoneLaserFriendly.cs b/Projectiles/BrimstoneLaserFriendly.cs index e203bc6f73..fca671c6db 100644 --- a/Projectiles/BrimstoneLaserFriendly.cs +++ b/Projectiles/BrimstoneLaserFriendly.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 -{ - public class BrimstoneLaserFriendly : 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.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 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BrimstoneLaserFriendly : 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.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 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 diff --git a/Projectiles/BrimstoneLaserSummon.cs b/Projectiles/BrimstoneLaserSummon.cs index 1c4c1f5895..f8a56cbbcd 100644 --- a/Projectiles/BrimstoneLaserSummon.cs +++ b/Projectiles/BrimstoneLaserSummon.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 -{ - 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 = 0; - 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]; - 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 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 0; + 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]; + 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 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 diff --git a/Projectiles/BrimstoneShot.cs b/Projectiles/BrimstoneShot.cs index fbac77cac2..fe449bccd6 100644 --- a/Projectiles/BrimstoneShot.cs +++ b/Projectiles/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 -{ - public class BrimstoneShot : ModProjectile - { - public int splitTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BrimstoneShot : ModProjectile + { + public int splitTimer = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 diff --git a/Projectiles/BrimstoneTentacle.cs b/Projectiles/BrimstoneTentacle.cs index 1efc533553..9b2c1fc4f5 100644 --- a/Projectiles/BrimstoneTentacle.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BrinySpout.cs b/Projectiles/BrinySpout.cs index 2ef55148ff..17e176ba79 100644 --- a/Projectiles/BrinySpout.cs +++ b/Projectiles/BrinySpout.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - return; - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + } + + 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 diff --git a/Projectiles/BrinyTyphoonBubble.cs b/Projectiles/BrinyTyphoonBubble.cs index 1cd157a468..7d52e32f98 100644 --- a/Projectiles/BrinyTyphoonBubble.cs +++ b/Projectiles/BrinyTyphoonBubble.cs @@ -1,146 +1,146 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/BrittleStar.cs b/Projectiles/BrittleStar.cs index ca8eec241c..463f65f740 100644 --- a/Projectiles/BrittleStar.cs +++ b/Projectiles/BrittleStar.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 -{ - 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) - { - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 diff --git a/Projectiles/BurningMeteor.cs b/Projectiles/BurningMeteor.cs index bfb121a9bf..4f9df1fe45 100644 --- a/Projectiles/BurningMeteor.cs +++ b/Projectiles/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 -{ - public class BurningMeteor : ModProjectile - { - public 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class BurningMeteor : ModProjectile + { + public 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 diff --git a/Projectiles/BurntSienna.cs b/Projectiles/BurntSienna.cs index 5f42c7c868..22fcec616a 100644 --- a/Projectiles/BurntSienna.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Butcher.cs b/Projectiles/Butcher.cs index 96459f3aa9..ad3c2ee99a 100644 --- a/Projectiles/Butcher.cs +++ b/Projectiles/Butcher.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 -{ - 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.5f; - if (projectile.ai[0] >= 120f) - { - num39++; - spreadMult *= 1.05f; - } - if (projectile.ai[0] >= 240f) - { - num39++; - spreadMult *= 1.1f; - } - if (projectile.ai[0] >= 360f) - { - num39++; - spreadMult *= 1.15f; - } - if (projectile.ai[0] >= 480f) - { - num39++; - spreadMult *= 1.2f; - } - if (projectile.ai[0] >= 600f) - { - num39++; - spreadMult *= 1.25f; - } - if (projectile.ai[0] >= 720f) - { - num39++; - spreadMult *= 1.3f; - } - if (projectile.ai[0] >= 840f) - { - num39++; - spreadMult *= 1.4f; - } - if (projectile.ai[0] >= 960f) //8 - { - num39++; - spreadMult *= 1.5f; - } - 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); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X * spreadMult, vector20.Y * spreadMult, 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.5f; + if (projectile.ai[0] >= 120f) + { + num39++; + spreadMult *= 1.05f; + } + if (projectile.ai[0] >= 240f) + { + num39++; + spreadMult *= 1.1f; + } + if (projectile.ai[0] >= 360f) + { + num39++; + spreadMult *= 1.15f; + } + if (projectile.ai[0] >= 480f) + { + num39++; + spreadMult *= 1.2f; + } + if (projectile.ai[0] >= 600f) + { + num39++; + spreadMult *= 1.25f; + } + if (projectile.ai[0] >= 720f) + { + num39++; + spreadMult *= 1.3f; + } + if (projectile.ai[0] >= 840f) + { + num39++; + spreadMult *= 1.4f; + } + if (projectile.ai[0] >= 960f) //8 + { + num39++; + spreadMult *= 1.5f; + } + 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); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X * spreadMult, vector20.Y * spreadMult, 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 diff --git a/Projectiles/CactusHealOrb.cs b/Projectiles/CactusHealOrb.cs index 1f7b8b325a..e99a624735 100644 --- a/Projectiles/CactusHealOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Calamari.cs b/Projectiles/Calamari.cs index e31c902028..32d8ddb136 100644 --- a/Projectiles/Calamari.cs +++ b/Projectiles/Calamari.cs @@ -1,357 +1,357 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = ownerMinionAttackTargetNPC.whoAmI; - } - } - if (!flag) - { - for (int k = 0; k < 200; k++) - { - 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 < 100f && 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; - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = ownerMinionAttackTargetNPC.whoAmI; + } + } + if (!flag) + { + for (int k = 0; k < 200; k++) + { + 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 < 100f && 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; + 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); + } + } } \ No newline at end of file diff --git a/Projectiles/CalamariInk.cs b/Projectiles/CalamariInk.cs index f28e75c667..7328ad5bd2 100644 --- a/Projectiles/CalamariInk.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Calamitamini.cs b/Projectiles/Calamitamini.cs index ab2c8facb3..e3b525807f 100644 --- a/Projectiles/Calamitamini.cs +++ b/Projectiles/Calamitamini.cs @@ -1,242 +1,242 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Calamitamini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitamini"); - Main.projFrames[projectile.type] = 3; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 20; - 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) - { - 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; - } - 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; - } - 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; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Calamitamini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitamini"); + Main.projFrames[projectile.type] = 3; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 20; + 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) + { + 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; + } + 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; + } + 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; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/CalamityAura.cs b/Projectiles/CalamityAura.cs index 96f8654771..2bbb01eb5d 100644 --- a/Projectiles/CalamityAura.cs +++ b/Projectiles/CalamityAura.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 -{ - 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() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, 0f, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, 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 diff --git a/Projectiles/CalamityAuraType2.cs b/Projectiles/CalamityAuraType2.cs index 40f03d0995..7467b5c091 100644 --- a/Projectiles/CalamityAuraType2.cs +++ b/Projectiles/CalamityAuraType2.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 -{ - 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() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 800); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 800); + } + } } \ No newline at end of file diff --git a/Projectiles/CalamityAuraType3.cs b/Projectiles/CalamityAuraType3.cs index 5963186451..cf3c7b10c6 100644 --- a/Projectiles/CalamityAuraType3.cs +++ b/Projectiles/CalamityAuraType3.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 -{ - 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() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 57, 0f, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 57, 0f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 600); + } + } } \ No newline at end of file diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2b125a0e7e..1f32d8b5f8 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,894 +1,880 @@ -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.TheDevourerofGods; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Projectiles -{ - public class CalamityGlobalProjectile : GlobalProjectile - { - public static float counter = 0; - - #region AI - public override void AI(Projectile projectile) - { - List rangedProjectileExceptionList = new List(6) - { - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - mod.ProjectileType("Phangasm"), - mod.ProjectileType("Contagion"), - mod.ProjectileType("DaemonsFlame"), - mod.ProjectileType("ExoTornado"), - mod.ProjectileType("Drataliornus") - }; - bool shouldAffect = rangedProjectileExceptionList.TrueForAll(x => projectile.type != x); - if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver && projectile.ranged && projectile.friendly && shouldAffect) - { - 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).nanotech && projectile.thrown && projectile.friendly) - { - counter += 1f; - if (counter >= 45f) - { - counter = 0f; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - } - #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) - { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Pure); - } - if (projectile.type == ProjectileID.CorruptSpray) - { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray) - { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } - } - #endregion - - #region ModifyHitNPC - public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - List projectileMinionList = new List(20) - { - 195, - 423, - 433, - 614, - 408, - 389, - 376, - 374, - 664, - 666, - 668, - 680, - 694, - 695, - 696, - 378, - 379, - 309, - 642, - 644 - }; - bool shouldAffect = projectileMinionList.Contains(projectile.type); - if (projectile.owner == Main.myPlayer && CalamityWorld.revenge) - { - if ((projectile.minion || shouldAffect)) - { - Player player = Main.player[projectile.owner]; - if (!player.inventory[player.selectedItem].summon && - (player.inventory[player.selectedItem].melee || - player.inventory[player.selectedItem].ranged || - player.inventory[player.selectedItem].magic || - player.inventory[player.selectedItem].thrown) && - player.inventory[player.selectedItem].hammer == 0 && - player.inventory[player.selectedItem].pick == 0 && - player.inventory[player.selectedItem].axe == 0) - { - if (NPC.downedMoonlord) - { - damage = (int)((double)damage * 0.33); - } - else if (Main.hardMode) - { - damage = (int)((double)damage * 0.66); - } - else - { - damage = (int)((double)damage * 0.9); - } - } - else if (!NPC.downedMoonlord) - { - damage = (int)((double)damage * 1.1); - } - } - } - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).sPower) - { - if (projectile.minion || shouldAffect) - { - damage = (int)((double)damage * 1.1); - } - } - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).rageMode && - Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) - { - if (projectile.minion || shouldAffect) - { - damage = (int)((double)damage * (CalamityWorld.death ? 13.0 : 4.0)); - } - } - else if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).rageMode) - { - if (projectile.minion || shouldAffect) - { - double rageDamageBoost = 0.0 + - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostOne ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0) + //4.8 or 1.2 - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostTwo ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0) + //5.6 or 1.4 - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostThree ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0); //6.4 or 1.6 - double rageDamage = (CalamityWorld.death ? 5.0 : 2.0) + rageDamageBoost; - damage = (int)((double)damage * rageDamage); - } - } - else if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) - { - if (projectile.minion || shouldAffect) - { - damage = (int)((double)damage * ((CalamityWorld.death ? 11.0 : 3.5) * Main.player[projectile.owner].GetModPlayer(mod).adrenalineDmgMult)); - } - } - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).uberBees && - (projectile.type == 566 || projectile.type == 181 || projectile.type == 189)) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TheSwarmer")) - { - damage = damage + Main.rand.Next(10, 21); - } - else - { - damage = damage + Main.rand.Next(70, 101); - projectile.penetrate = 1; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).astralStarRain && crit && - Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown = 120; - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = 92; - } - else - { - projectileType = 12; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, projectile.owner, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - } - } - #endregion - - #region OnHitNPC - public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - if (Main.player[projectile.owner].GetModPlayer(mod).abyssalAmulet) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } - if (Main.player[projectile.owner].GetModPlayer(mod).dsSetBonus) - { - target.AddBuff(mod.BuffType("DemonFlames"), 180); - } - if (Main.player[projectile.owner].GetModPlayer(mod).frostFlare) - { - target.AddBuff(BuffID.Frostburn, 360); - } - if (Main.player[projectile.owner].GetModPlayer(mod).uberBees && - (projectile.type == 566 || projectile.type == 181 || projectile.type == 189)) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - if (Main.player[projectile.owner].GetModPlayer(mod).alchFlask && - (projectile.magic || projectile.thrown || projectile.melee || projectile.minion || projectile.ranged)) - { - target.AddBuff(mod.BuffType("Plague"), 120); - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - Main.projectile[plague].melee = false; - } - if (Main.player[projectile.owner].GetModPlayer(mod).reaverBlast && projectile.melee) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), (int)((double)projectile.damage * 0.2), 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; - 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; - 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 = projectile.height * 4); - 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 *= 4; - projectile.Damage(); - } - if (Main.player[projectile.owner].GetModPlayer(mod).tarraMage) - { - if (Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown <= 0) - { - Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown = 90; - 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; - 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.2), 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.5), 0f, projectile.owner, (float)num6, 0f); - 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; - 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 * 0.8), 0f, projectile.owner, (float)num6, 0f); - 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; - 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 * 1.5), 0f, projectile.owner, (float)num6, 0f); - 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; - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); - } - } - else if (projectile.ranged) - { - if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), (int)((double)projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); - } - } - else if (projectile.thrown) - { - if (Main.player[projectile.owner].GetModPlayer(mod).daedalusSplit) - { - 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; - 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.15), 0.25f, projectile.owner, 0f, 0f); - } - } - 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 = 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.3), 0f, projectile.owner, (float)num6, 0f); - } - } - else if (projectile.minion) - { - 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 * 1.5), 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.3), 0f, projectile.owner, (float)num6, 0f); - } - } - } - } - #endregion - - #region Kill - public override void Kill(Projectile projectile, int timeLeft) - { - 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; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), (int)((double)projectile.damage * 0.33), 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.TheDevourerofGods; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Projectiles +{ + public class CalamityGlobalProjectile : GlobalProjectile + { + public static int counter = 0; + + public static int counter2 = 0; + + #region AI + public override void AI(Projectile projectile) + { + 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).nanotech && projectile.thrown && projectile.friendly) + { + counter++; + if (counter >= 90) + { + 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"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).daedalusSplit && projectile.thrown && 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; + 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); + } + } + } + } + } + #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) + { + CalamityWorld.ConvertFromAstral(i, j, ConvertType.Pure); + } + if (projectile.type == ProjectileID.CorruptSpray) + { + CalamityWorld.ConvertFromAstral(i, j, ConvertType.Corrupt); + } + if (projectile.type == ProjectileID.CrimsonSpray) + { + CalamityWorld.ConvertFromAstral(i, j, ConvertType.Crimson); + } + if (projectile.type == ProjectileID.HallowSpray) + { + CalamityWorld.ConvertFromAstral(i, j, ConvertType.Hallow); + } + } + } + } + #endregion + + #region ModifyHitNPC + public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("VeriumBullet") || projectile.type == ProjectileID.ChlorophyteBullet) + { + damage = (int)((double)damage * 0.8); + } + if (projectile.owner == Main.myPlayer && CalamityWorld.revenge) + { + if ((projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type))) + { + Player player = Main.player[projectile.owner]; + if (!player.inventory[player.selectedItem].summon && + (player.inventory[player.selectedItem].melee || + player.inventory[player.selectedItem].ranged || + player.inventory[player.selectedItem].magic || + player.inventory[player.selectedItem].thrown) && + player.inventory[player.selectedItem].hammer == 0 && + player.inventory[player.selectedItem].pick == 0 && + player.inventory[player.selectedItem].axe == 0) + { + if (NPC.downedMoonlord) + { + damage = (int)((double)damage * 0.33); + } + else if (Main.hardMode) + { + damage = (int)((double)damage * 0.66); + } + else + { + damage = (int)((double)damage * 0.9); + } + } + else if (!NPC.downedMoonlord) + { + damage = (int)((double)damage * 1.1); + } + } + } + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).screwdriver) + { + if (projectile.penetrate > 1 || projectile.penetrate == -1) + { + damage = (int)((double)damage * 1.1); + } + } + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).sPower) + { + if (projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + damage = (int)((double)damage * 1.1); + } + } + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).rageMode && + Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) + { + if (projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + damage = (int)((double)damage * (CalamityWorld.death ? 13.0 : 4.0)); + } + } + else if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).rageMode) + { + if (projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + double rageDamageBoost = 0.0 + + (Main.player[projectile.owner].GetModPlayer(mod).rageBoostOne ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0) + //4.8 or 1.2 + (Main.player[projectile.owner].GetModPlayer(mod).rageBoostTwo ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0) + //5.6 or 1.4 + (Main.player[projectile.owner].GetModPlayer(mod).rageBoostThree ? (CalamityWorld.death ? 0.8 : 0.2) : 0.0); //6.4 or 1.6 + double rageDamage = (CalamityWorld.death ? 5.0 : 2.0) + rageDamageBoost; + damage = (int)((double)damage * rageDamage); + } + } + else if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) + { + if (projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + damage = (int)((double)damage * ((CalamityWorld.death ? 11.0 : 3.5) * Main.player[projectile.owner].GetModPlayer(mod).adrenalineDmgMult)); + } + } + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].GetModPlayer(mod).uberBees && + (projectile.type == 566 || projectile.type == 181 || projectile.type == 189)) + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TheSwarmer")) + { + damage = damage + Main.rand.Next(10, 21); + } + else + { + damage = damage + Main.rand.Next(70, 101); + projectile.penetrate = 1; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).astralStarRain && crit && + Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown = 120; + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 25; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = 92; + } + else + { + projectileType = 12; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, projectile.owner, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + } + } + #endregion + + #region OnHitNPC + public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + if (Main.player[projectile.owner].GetModPlayer(mod).abyssalAmulet) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } + if (Main.player[projectile.owner].GetModPlayer(mod).dsSetBonus) + { + target.AddBuff(mod.BuffType("DemonFlames"), 180); + } + if (Main.player[projectile.owner].GetModPlayer(mod).frostFlare) + { + target.AddBuff(BuffID.Frostburn, 360); + } + if (Main.player[projectile.owner].GetModPlayer(mod).uberBees && + (projectile.type == 566 || projectile.type == 181 || projectile.type == 189)) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + if (Main.player[projectile.owner].GetModPlayer(mod).alchFlask && + (projectile.magic || projectile.thrown || projectile.melee || projectile.minion || projectile.ranged)) + { + target.AddBuff(mod.BuffType("Plague"), 120); + int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Main.projectile[plague].melee = false; + } + if (Main.player[projectile.owner].GetModPlayer(mod).reaverBlast && projectile.melee) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), (int)((double)projectile.damage * 0.2), 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; + 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; + 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 = projectile.height * 4); + 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 *= 4; + projectile.Damage(); + } + if (Main.player[projectile.owner].GetModPlayer(mod).tarraMage) + { + if (Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown <= 0) + { + Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown = 90; + 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; + 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.2), 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.5), 0f, projectile.owner, (float)num6, 0f); + 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; + 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 * 0.8), 0f, projectile.owner, (float)num6, 0f); + 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; + 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 * 1.5), 0f, projectile.owner, (float)num6, 0f); + 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; + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + } + else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + } + } + else if (projectile.ranged) + { + if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), (int)((double)projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); + } + } + else if (projectile.thrown) + { + 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.3), 0f, projectile.owner, (float)num6, 0f); + } + } + else if (projectile.minion) + { + 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 * 1.5), 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.3), 0f, projectile.owner, (float)num6, 0f); + } + } + } + } + #endregion + + #region Kill + public override void Kill(Projectile projectile, int timeLeft) + { + 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; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), (int)((double)projectile.damage * 0.33), 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/Cataclymini.cs b/Projectiles/Cataclymini.cs index 8d5bb161ef..ca739a1072 100644 --- a/Projectiles/Cataclymini.cs +++ b/Projectiles/Cataclymini.cs @@ -1,241 +1,241 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Cataclymini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclymini"); - Main.projFrames[projectile.type] = 3; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - 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) - { - 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; - } - 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; - } - 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; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Cataclymini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclymini"); + Main.projFrames[projectile.type] = 3; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + 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) + { + 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; + } + 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; + } + 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; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/Catastromini.cs b/Projectiles/Catastromini.cs index 30c8c9e766..d3bee430ad 100644 --- a/Projectiles/Catastromini.cs +++ b/Projectiles/Catastromini.cs @@ -1,264 +1,264 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 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) - { - 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; - } - 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; - } - 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; - return; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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) + { + 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; + } + 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; + } + 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; + return; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } } \ No newline at end of file diff --git a/Projectiles/Celestus.cs b/Projectiles/Celestus.cs index 61cc20e863..0ccacec2bd 100644 --- a/Projectiles/Celestus.cs +++ b/Projectiles/Celestus.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 -{ - public class Celestus : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.friendly = true; - projectile.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - 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; - 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 (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Celestus : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.friendly = true; + projectile.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + 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; + 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 (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + 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 diff --git a/Projectiles/Celestus2.cs b/Projectiles/Celestus2.cs index 3f88e43845..abafcedc9b 100644 --- a/Projectiles/Celestus2.cs +++ b/Projectiles/Celestus2.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 -{ - 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.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.timeLeft = 85; - } - - 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) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 4; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + projectile.timeLeft = 85; + } + + 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) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosBlaze.cs b/Projectiles/ChaosBlaze.cs index c4c73256f4..e3cd916f01 100644 --- a/Projectiles/ChaosBlaze.cs +++ b/Projectiles/ChaosBlaze.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 -{ - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosFlame.cs b/Projectiles/ChaosFlame.cs index 4902028a2d..9f9c3526cb 100644 --- a/Projectiles/ChaosFlame.cs +++ b/Projectiles/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 -{ - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosFlameLarge.cs b/Projectiles/ChaosFlameLarge.cs index cb57e3e17c..8a45a4eb28 100644 --- a/Projectiles/ChaosFlameLarge.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ChaosFlameMedium.cs b/Projectiles/ChaosFlameMedium.cs index b9e5c03c76..83df3b27d5 100644 --- a/Projectiles/ChaosFlameMedium.cs +++ b/Projectiles/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 -{ - 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, 380); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 380); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosFlameSmall.cs b/Projectiles/ChaosFlameSmall.cs index 1be2a166b1..ca1692c0a8 100644 --- a/Projectiles/ChaosFlameSmall.cs +++ b/Projectiles/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 -{ - 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, 280); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 280); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosFlare.cs b/Projectiles/ChaosFlare.cs index f7a88b6e51..3bd23fe2e3 100644 --- a/Projectiles/ChaosFlare.cs +++ b/Projectiles/ChaosFlare.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 -{ - 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.ranged = true; - 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; - return; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 200); - target.AddBuff(BuffID.OnFire, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.ranged = true; + 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; + return; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 200); + target.AddBuff(BuffID.OnFire, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosFlare2.cs b/Projectiles/ChaosFlare2.cs index 52bb6e43cb..29943db921 100644 --- a/Projectiles/ChaosFlare2.cs +++ b/Projectiles/ChaosFlare2.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 -{ - 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.thrown = true; - 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; - return; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + 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; + return; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosGeyser.cs b/Projectiles/ChaosGeyser.cs index 7918c8308f..a8b69bc347 100644 --- a/Projectiles/ChaosGeyser.cs +++ b/Projectiles/ChaosGeyser.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 -{ - 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 = -1; - 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; - return; - } - } - - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = -1; + projectile.timeLeft = 60; + 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; + return; + } + } + + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/ChaosSpirit.cs b/Projectiles/ChaosSpirit.cs index a226f6cc3a..d88d617bc9 100644 --- a/Projectiles/ChaosSpirit.cs +++ b/Projectiles/ChaosSpirit.cs @@ -1,159 +1,159 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class ChaosSpirit : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Spirit"); - Main.projFrames[projectile.type] = 9; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - 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.sentry = true; - } - - 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) - { - 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; - } - } - 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; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - 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, (int)((double)190 * player.minionDamage), 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 38f; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ChaosSpirit : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Main.projFrames[projectile.type] = 9; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + 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.sentry = true; + } + + 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) + { + 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; + } + } + 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; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + 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, (int)((double)190 * player.minionDamage), 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 38f; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ChaotrixProjectile.cs b/Projectiles/ChaotrixProjectile.cs index 0102e147a6..1ef335c06f 100644 --- a/Projectiles/ChaotrixProjectile.cs +++ b/Projectiles/ChaotrixProjectile.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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + } + } } \ No newline at end of file diff --git a/Projectiles/ChargedBlast.cs b/Projectiles/ChargedBlast.cs index b11f45ef99..15a2186879 100644 --- a/Projectiles/ChargedBlast.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ChargedBlast2.cs b/Projectiles/ChargedBlast2.cs index 0e6cc3002b..d340abbbd1 100644 --- a/Projectiles/ChargedBlast2.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ChargedBlast3.cs b/Projectiles/ChargedBlast3.cs index 52408681ae..2fac31f958 100644 --- a/Projectiles/ChargedBlast3.cs +++ b/Projectiles/ChargedBlast3.cs @@ -1,211 +1,211 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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(); - 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 = 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, 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, 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, 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + 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 = 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, 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, 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, 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 diff --git a/Projectiles/ChibiiDoggo.cs b/Projectiles/ChibiiDoggo.cs index 5ddfef7a7d..101e6f6543 100644 --- a/Projectiles/ChibiiDoggo.cs +++ b/Projectiles/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 -{ - 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 +{ + 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/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/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); @@ -87,166 +87,166 @@ namespace CalamityMod.Projectiles 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/ChibiiDoggoFly.cs b/Projectiles/ChibiiDoggoFly.cs index bf610365be..c143e89a72 100644 --- a/Projectiles/ChibiiDoggoFly.cs +++ b/Projectiles/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 -{ - 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 +{ + 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/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/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); @@ -77,48 +77,48 @@ namespace CalamityMod.Projectiles 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/Chicken.cs b/Projectiles/Chicken.cs index 71a55012f1..c6bc18bc70 100644 --- a/Projectiles/Chicken.cs +++ b/Projectiles/Chicken.cs @@ -1,124 +1,124 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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; - } - } - - - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/ChickenExplosion.cs b/Projectiles/ChickenExplosion.cs index 1dc7234836..998786c6ed 100644 --- a/Projectiles/ChickenExplosion.cs +++ b/Projectiles/ChickenExplosion.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/Climax.cs b/Projectiles/Climax.cs index 063a5ca5a4..530fb508c9 100644 --- a/Projectiles/Climax.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ClimaxBeam.cs b/Projectiles/ClimaxBeam.cs index f48c23f317..efe368d283 100644 --- a/Projectiles/ClimaxBeam.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/CloudyWaifu.cs b/Projectiles/CloudyWaifu.cs index 030784bad0..da45694866 100644 --- a/Projectiles/CloudyWaifu.cs +++ b/Projectiles/CloudyWaifu.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 -{ - 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) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.cWaifu = false; - } - if (modPlayer.cWaifu) - { - 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, 16, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - 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 = 50f; //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; - 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; - return; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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 ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 500f; //700 + float num634 = 800f; + float num635 = 1200f; + float num636 = 50f; //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; + 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; + return; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/CnidarianProjectile.cs b/Projectiles/CnidarianProjectile.cs index 7a8ed1c9d9..c90a52ea65 100644 --- a/Projectiles/CnidarianProjectile.cs +++ b/Projectiles/CnidarianProjectile.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/CobaltKunaiProjectile.cs b/Projectiles/CobaltKunaiProjectile.cs index 5bdef9fa17..b45158daf4 100644 --- a/Projectiles/CobaltKunaiProjectile.cs +++ b/Projectiles/CobaltKunaiProjectile.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class CobaltKunaiProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - 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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class CobaltKunaiProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.scale = 0.75f; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + 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 diff --git a/Projectiles/Contagion.cs b/Projectiles/Contagion.cs index df80df5f43..3eb5142ab0 100644 --- a/Projectiles/Contagion.cs +++ b/Projectiles/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 -{ - public class Contagion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion"); - } - - public override void SetDefaults() - { - projectile.width = 86; - projectile.height = 36; - 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Contagion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion"); + } + + public override void SetDefaults() + { + projectile.width = 86; + projectile.height = 36; + 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 diff --git a/Projectiles/ContagionArrow.cs b/Projectiles/ContagionArrow.cs index a02d50773d..a2ed4546f2 100644 --- a/Projectiles/ContagionArrow.cs +++ b/Projectiles/ContagionArrow.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 -{ - public class ContagionArrow : ModProjectile - { - public int addBallTimer = 5; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion Arrow"); - 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.extraUpdates = 1; - projectile.ranged = true; - } - - 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; - } - addBallTimer--; - if (addBallTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addBallTimer = 5; - } - 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] <= 3f) - { - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ContagionArrow : ModProjectile + { + public int addBallTimer = 5; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion Arrow"); + 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.extraUpdates = 1; + projectile.ranged = true; + } + + 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; + } + addBallTimer--; + if (addBallTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addBallTimer = 5; + } + 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] <= 3f) + { + 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 diff --git a/Projectiles/ContagionBall.cs b/Projectiles/ContagionBall.cs index a4500f3988..664cf4e95b 100644 --- a/Projectiles/ContagionBall.cs +++ b/Projectiles/ContagionBall.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 -{ - 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); - for (int num621 = 0; num621 < 2; num621++) - { - 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; - } - } - for (int num623 = 0; num623 < 2; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.35f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 1.5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.15f); - Main.dust[num624].velocity *= 1.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"), 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + for (int num621 = 0; num621 < 2; num621++) + { + 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; + } + } + for (int num623 = 0; num623 < 2; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.35f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 1.5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.15f); + Main.dust[num624].velocity *= 1.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"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/CoralSpike.cs b/Projectiles/CoralSpike.cs index 4731fb8448..b5f7e4bf3e 100644 --- a/Projectiles/CoralSpike.cs +++ b/Projectiles/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 -{ - 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 = -1; - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = -1; + 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 diff --git a/Projectiles/CorossiveFlames.cs b/Projectiles/CorossiveFlames.cs index ff507dbcfc..704ea87867 100644 --- a/Projectiles/CorossiveFlames.cs +++ b/Projectiles/CorossiveFlames.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 -{ - 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 ((num297 == 89 && 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 ((num297 == 89 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 89 && 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 ((num297 == 89 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Corroslime.cs b/Projectiles/Corroslime.cs index c20c1e093d..4b8781ea40 100644 --- a/Projectiles/Corroslime.cs +++ b/Projectiles/Corroslime.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 -{ - 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) - { - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 diff --git a/Projectiles/CosmicBlast.cs b/Projectiles/CosmicBlast.cs index e1a9ba29e0..4687d64ea5 100644 --- a/Projectiles/CosmicBlast.cs +++ b/Projectiles/CosmicBlast.cs @@ -1,143 +1,143 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - 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; - return; - } - } - - 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) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + 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; + return; + } + } + + 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) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + + 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 diff --git a/Projectiles/CosmicBlastBig.cs b/Projectiles/CosmicBlastBig.cs index 54cf7038bc..71f7435553 100644 --- a/Projectiles/CosmicBlastBig.cs +++ b/Projectiles/CosmicBlastBig.cs @@ -1,148 +1,148 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - 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; - return; - } - } - - 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) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + 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; + return; + } + } + + 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) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + + 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 diff --git a/Projectiles/CosmicBolt.cs b/Projectiles/CosmicBolt.cs index 05735a899c..9b3c1c9ef9 100644 --- a/Projectiles/CosmicBolt.cs +++ b/Projectiles/CosmicBolt.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 -{ - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/CosmicDischarge.cs b/Projectiles/CosmicDischarge.cs index a7c82637cd..e9063d3825 100644 --- a/Projectiles/CosmicDischarge.cs +++ b/Projectiles/CosmicDischarge.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; -using Terraria.Enums; - -namespace CalamityMod.Projectiles -{ - 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; - } - - 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); - } - } +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 +{ + 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; + } + + 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 diff --git a/Projectiles/CosmicEnergy.cs b/Projectiles/CosmicEnergy.cs index d46acdb388..f143354d2a 100644 --- a/Projectiles/CosmicEnergy.cs +++ b/Projectiles/CosmicEnergy.cs @@ -1,241 +1,243 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class CosmicEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Energy"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[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)); - 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 = 150f; - 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; - 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[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; - bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; - int damageStatSmall = hasSummonerSet ? 1500 : 1000; - int damageStatBig = hasSummonerSet ? 3000 : 2000; - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[2] == 0f) - { - projectile.ai[2] = 1f; - projectile.ai[0] = 100f; - } - 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)damageStatSmall * player.minionDamage), 2f, projectile.owner, 0f, 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"), (int)((double)damageStatBig * player.minionDamage), 3f, projectile.owner, 0f, 0f); - projectile.ai[0] = 100f; - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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)); + 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 = 150f; + 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; + 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[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; + bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; + int damageStatSmall = hasSummonerSet ? 1500 : 1000; + int damageStatBig = hasSummonerSet ? 3000 : 2000; + 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)damageStatSmall * player.minionDamage), 2f, projectile.owner, 0f, 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"), (int)((double)damageStatBig * player.minionDamage), 3f, projectile.owner, 0f, 0f); + projectile.ai[0] = 100f; + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); + } + } } \ No newline at end of file diff --git a/Projectiles/CosmicFire.cs b/Projectiles/CosmicFire.cs index 62e8230724..dc264c8431 100644 --- a/Projectiles/CosmicFire.cs +++ b/Projectiles/CosmicFire.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 -{ - 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 ((num297 == 58 && 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; - if (num297 == 58) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 4; - target.AddBuff(BuffID.CursedInferno, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 58 && 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; + if (num297 == 58) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + target.AddBuff(BuffID.CursedInferno, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/CosmicIceBurst.cs b/Projectiles/CosmicIceBurst.cs index b37b777493..1668fcc40f 100644 --- a/Projectiles/CosmicIceBurst.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/CosmicKunai.cs b/Projectiles/CosmicKunai.cs index 24adfe585a..c8ede802b3 100644 --- a/Projectiles/CosmicKunai.cs +++ b/Projectiles/CosmicKunai.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class CosmicKunai : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } - - public override void SetDefaults() - { - projectile.width = 25; - projectile.height = 25; - projectile.friendly = true; - projectile.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha += 25; - 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; - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class CosmicKunai : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } + + public override void SetDefaults() + { + projectile.width = 25; + projectile.height = 25; + projectile.friendly = true; + projectile.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha += 25; + 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; + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/CosmicOrb.cs b/Projectiles/CosmicOrb.cs index ec495cf172..6dca5a64d6 100644 --- a/Projectiles/CosmicOrb.cs +++ b/Projectiles/CosmicOrb.cs @@ -1,136 +1,136 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - return; - } - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + return; + } + } + } + + 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 diff --git a/Projectiles/CosmicSpiritBomb1.cs b/Projectiles/CosmicSpiritBomb1.cs index 0738e8fa0e..07be86eb42 100644 --- a/Projectiles/CosmicSpiritBomb1.cs +++ b/Projectiles/CosmicSpiritBomb1.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 -{ - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/CosmicSpiritBomb2.cs b/Projectiles/CosmicSpiritBomb2.cs index e3721971d6..13fa23e799 100644 --- a/Projectiles/CosmicSpiritBomb2.cs +++ b/Projectiles/CosmicSpiritBomb2.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 -{ - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/CosmicSpiritBomb3.cs b/Projectiles/CosmicSpiritBomb3.cs index 56c9eb3e64..feb4bef83e 100644 --- a/Projectiles/CosmicSpiritBomb3.cs +++ b/Projectiles/CosmicSpiritBomb3.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 -{ - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/CosmicTentacle.cs b/Projectiles/CosmicTentacle.cs index c6aa13f1e8..88ba357a0b 100644 --- a/Projectiles/CosmicTentacle.cs +++ b/Projectiles/CosmicTentacle.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 -{ - 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++; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } + + 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 diff --git a/Projectiles/Cosmilamp.cs b/Projectiles/Cosmilamp.cs index 0c791e1a9e..aef6cef0dc 100644 --- a/Projectiles/Cosmilamp.cs +++ b/Projectiles/Cosmilamp.cs @@ -1,283 +1,283 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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) - { - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) - { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - if (!flag19) - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) - { - if (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 < 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] = 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; - } - } - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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) + { + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + if (!flag19) + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) + { + if (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 < 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] = 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 diff --git a/Projectiles/Crimslime.cs b/Projectiles/Crimslime.cs index 86cdf41070..b1657582c8 100644 --- a/Projectiles/Crimslime.cs +++ b/Projectiles/Crimslime.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 -{ - 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) - { - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 diff --git a/Projectiles/CrimsonSpike.cs b/Projectiles/CrimsonSpike.cs index 32ee952ddb..9e2ff75ec1 100644 --- a/Projectiles/CrimsonSpike.cs +++ b/Projectiles/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 -{ - 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, 30); - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 30); + } + + 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 diff --git a/Projectiles/Crushax.cs b/Projectiles/Crushax.cs index 8d18cd3201..52eb4a4a6f 100644 --- a/Projectiles/Crushax.cs +++ b/Projectiles/Crushax.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Crushax : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crushax"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.scale = 0.8f; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 300; - aiType = 48; - } - - 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"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Crushax : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crushax"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.scale = 0.8f; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 300; + aiType = 48; + } + + 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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/CrystalDust.cs b/Projectiles/CrystalDust.cs index 3537231d1a..0a465b59a7 100644 --- a/Projectiles/CrystalDust.cs +++ b/Projectiles/CrystalDust.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 -{ - 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() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + 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 diff --git a/Projectiles/CrystalPiercerProjectile.cs b/Projectiles/CrystalPiercerProjectile.cs index 23e17fb44d..f9563d3388 100644 --- a/Projectiles/CrystalPiercerProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - 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, 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 +{ + 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.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + 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, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/Crystalline.cs b/Projectiles/Crystalline.cs index 2624086a66..7d52a45345 100644 --- a/Projectiles/Crystalline.cs +++ b/Projectiles/Crystalline.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 -{ - 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.thrown = true; - projectile.scale = 0.75f; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 120; - aiType = 598; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.scale = 0.75f; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 120; + aiType = 598; + } + + 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 diff --git a/Projectiles/Crystalline2.cs b/Projectiles/Crystalline2.cs index fe9f4e3eeb..c67ead2628 100644 --- a/Projectiles/Crystalline2.cs +++ b/Projectiles/Crystalline2.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 -{ - 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.thrown = true; - projectile.scale = 0.75f; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 30; - aiType = 598; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.scale = 0.75f; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 30; + aiType = 598; + } + + 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 diff --git a/Projectiles/CursedDagger.cs b/Projectiles/CursedDagger.cs index 52774ed534..ee7b60ed13 100644 --- a/Projectiles/CursedDagger.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + 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 diff --git a/Projectiles/CursedRound.cs b/Projectiles/CursedRound.cs index e7e47e0a56..f64456143b 100644 --- a/Projectiles/CursedRound.cs +++ b/Projectiles/CursedRound.cs @@ -1,74 +1,74 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class CursedRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed 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 < 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, 75, 0f, 0f, 0, default(Color), 1.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; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 240); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class CursedRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed 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 < 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, 75, 0f, 0f, 0, default(Color), 1.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; + } + 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 diff --git a/Projectiles/DNA.cs b/Projectiles/DNA.cs index 644bbe92ba..a859c191e1 100644 --- a/Projectiles/DNA.cs +++ b/Projectiles/DNA.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 -{ - public class DNA : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 52; - 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); - return; - } - } - } - 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(); - return; - } - } - 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) - { - target.immune[projectile.owner] = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class DNA : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 52; + 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); + return; + } + } + } + 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(); + return; + } + } + 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) + { + target.immune[projectile.owner] = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/DNA2.cs b/Projectiles/DNA2.cs index 0726317530..e4101d92de 100644 --- a/Projectiles/DNA2.cs +++ b/Projectiles/DNA2.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 -{ - public class DNA2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 52; - 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(); - return; - } - } - 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) - { - target.immune[projectile.owner] = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class DNA2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 52; + 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(); + return; + } + } + 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) + { + target.immune[projectile.owner] = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/DaedalusCrystal.cs b/Projectiles/DaedalusCrystal.cs index fe83f49f07..f22d83b691 100644 --- a/Projectiles/DaedalusCrystal.cs +++ b/Projectiles/DaedalusCrystal.cs @@ -1,156 +1,156 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class DaedalusCrystal : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Crystal"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 40; - 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.sentry = true; - } - - 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) - { - 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; - } - } - 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; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - 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, (int)((double)95 * player.minionDamage), 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 50f; - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class DaedalusCrystal : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 40; + 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.sentry = true; + } + + 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) + { + 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; + } + } + 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; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + 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, (int)((double)95 * player.minionDamage), 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 50f; + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/DaedalusCrystalShot.cs b/Projectiles/DaedalusCrystalShot.cs index c6b52e8d15..0189618f7e 100644 --- a/Projectiles/DaedalusCrystalShot.cs +++ b/Projectiles/DaedalusCrystalShot.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 -{ - 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/DaemonsFlame.cs b/Projectiles/DaemonsFlame.cs index b6d94db067..0c02fe8f78 100644 --- a/Projectiles/DaemonsFlame.cs +++ b/Projectiles/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 -{ - 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DaemonsFlameArrow.cs b/Projectiles/DaemonsFlameArrow.cs index f65bcb71cc..e028ce23ad 100644 --- a/Projectiles/DaemonsFlameArrow.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DankCreeper.cs b/Projectiles/DankCreeper.cs index c647107e5e..a52af05f38 100644 --- a/Projectiles/DankCreeper.cs +++ b/Projectiles/DankCreeper.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 -{ - 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) - { - 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; - } - 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; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Dark.cs b/Projectiles/Dark.cs index 8c53bf47d3..9305eea716 100644 --- a/Projectiles/Dark.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DarkBall.cs b/Projectiles/DarkBall.cs index 81aaf4ab72..6a3e5441b8 100644 --- a/Projectiles/DarkBall.cs +++ b/Projectiles/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 -{ - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DarkEnergySpawn.cs b/Projectiles/DarkEnergySpawn.cs index c723aaf3d0..13e236496b 100644 --- a/Projectiles/DarkEnergySpawn.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DemonBlast.cs b/Projectiles/DemonBlast.cs index 1317db1e89..a306d716c7 100644 --- a/Projectiles/DemonBlast.cs +++ b/Projectiles/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 -{ - 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; - return; - } - } - } - - 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) - { - projectile.Kill(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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) + { + projectile.Kill(); + } + } } \ No newline at end of file diff --git a/Projectiles/DemonBlastType2.cs b/Projectiles/DemonBlastType2.cs index f61d6c5815..f8944fb48e 100644 --- a/Projectiles/DemonBlastType2.cs +++ b/Projectiles/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 -{ - 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; - return; - } - } - } - - 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) - { - projectile.Kill(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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) + { + projectile.Kill(); + } + } } \ No newline at end of file diff --git a/Projectiles/DemonBlastType3.cs b/Projectiles/DemonBlastType3.cs index c9275dc79b..0c40adacf8 100644 --- a/Projectiles/DemonBlastType3.cs +++ b/Projectiles/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 -{ - 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; - return; - } - } - } - - 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) - { - projectile.Kill(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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) + { + projectile.Kill(); + } + } } \ No newline at end of file diff --git a/Projectiles/DemonicPitchfork.cs b/Projectiles/DemonicPitchfork.cs index 42cd465df7..1de20734f5 100644 --- a/Projectiles/DemonicPitchfork.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DepthOrb.cs b/Projectiles/DepthOrb.cs index c22d7d3314..47e0662ea3 100644 --- a/Projectiles/DepthOrb.cs +++ b/Projectiles/DepthOrb.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 -{ - 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 = 300; - 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.65f) / 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), 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) - { - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 300; + 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.65f) / 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), 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) + { + 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 diff --git a/Projectiles/DepthOrb2.cs b/Projectiles/DepthOrb2.cs index 89cff327e7..addb87e8ee 100644 --- a/Projectiles/DepthOrb2.cs +++ b/Projectiles/DepthOrb2.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 -{ - 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; - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + + 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 diff --git a/Projectiles/DiseasedPike.cs b/Projectiles/DiseasedPike.cs index 89d71ecce5..8e80569c71 100644 --- a/Projectiles/DiseasedPike.cs +++ b/Projectiles/DiseasedPike.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 -{ - 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; - } - - 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) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - 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, projectile.velocity.Y, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + 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, projectile.velocity.Y, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/DracoBeam.cs b/Projectiles/DracoBeam.cs index e41e795389..e65b7d51d4 100644 --- a/Projectiles/DracoBeam.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - 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.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + 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.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/DracoBeam2.cs b/Projectiles/DracoBeam2.cs index 5651a4c5b1..80d5d83caa 100644 --- a/Projectiles/DracoBeam2.cs +++ b/Projectiles/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 -{ - public class DracoBeam2 : ModProjectile - { - public int start = 60; - public 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, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - 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.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class DracoBeam2 : ModProjectile + { + public int start = 60; + public 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, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + 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.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/DragonBurst.cs b/Projectiles/DragonBurst.cs index 1f8d86fb1c..d33e2e2156 100644 --- a/Projectiles/DragonBurst.cs +++ b/Projectiles/DragonBurst.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 -{ - 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() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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; - } - if (projectile.velocity.Y > 20f) - { - projectile.velocity.Y = 20f; - return; - } - } - - public override void Kill(int timeLeft) - { - 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].melee = false; - Main.projectile[boom].ranged = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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; + } + if (projectile.velocity.Y > 20f) + { + projectile.velocity.Y = 20f; + return; + } + } + + public override void Kill(int timeLeft) + { + 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].melee = false; + Main.projectile[boom].ranged = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/DragonDust.cs b/Projectiles/DragonDust.cs index dd6f2557d5..6e1b66f440 100644 --- a/Projectiles/DragonDust.cs +++ b/Projectiles/DragonDust.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 -{ - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 0; - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + 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 diff --git a/Projectiles/DragonRage.cs b/Projectiles/DragonRage.cs index d90a01c677..67841f536b 100644 --- a/Projectiles/DragonRage.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 1.4f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 1.4f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + } + + 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 diff --git a/Projectiles/Drataliornus.cs b/Projectiles/Drataliornus.cs index 4f75c5e420..df7b2080e6 100644 --- a/Projectiles/Drataliornus.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DrataliornusExoArrow.cs b/Projectiles/DrataliornusExoArrow.cs index 32cbf3303b..7b3b78d034 100644 --- a/Projectiles/DrataliornusExoArrow.cs +++ b/Projectiles/DrataliornusExoArrow.cs @@ -1,117 +1,117 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + + 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 diff --git a/Projectiles/DrataliornusFlame.cs b/Projectiles/DrataliornusFlame.cs index 663c493563..1fe9b74b9b 100644 --- a/Projectiles/DrataliornusFlame.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Dreadmine.cs b/Projectiles/Dreadmine.cs index cb43d97369..7b3ce6dc76 100644 --- a/Projectiles/Dreadmine.cs +++ b/Projectiles/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 -{ - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/DreadmineTurret.cs b/Projectiles/DreadmineTurret.cs index 57fa263463..bbe67ab959 100644 --- a/Projectiles/DreadmineTurret.cs +++ b/Projectiles/DreadmineTurret.cs @@ -1,123 +1,120 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class DreadmineTurret : ModProjectile - { - public float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dreadmine Turret"); - Main.projFrames[projectile.type] = 2; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - 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 > 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); - return; - } - } - } - } - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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); + return; + } + } + } + } + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/DrewsSandyWaifu.cs b/Projectiles/DrewsSandyWaifu.cs index f17f3742c7..2b6fa7d21f 100644 --- a/Projectiles/DrewsSandyWaifu.cs +++ b/Projectiles/DrewsSandyWaifu.cs @@ -1,290 +1,290 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - 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("DrewsSandyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.sandBoobWaifu) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.dWaifu = false; - } - if (modPlayer.dWaifu) - { - 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, 32, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - 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; - } - } - } - /*bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - }*/ - /*Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - }*/ - /*if (flag25) - { - num647 = num635; - }*/ - if (Vector2.Distance(player.Center, projectile.Center) > 400f) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - /*if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 6f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - {*/ - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 7f; //6 - if (flag26) - { - num650 = 18f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 10f) //200 and 8 - { - num650 = 10f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.22f; - projectile.velocity.Y = -0.12f; - } - //} - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - 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.ai[0] == 0f) - { - int num658 = mod.ProjectileType("CactusHealOrb"); - if (projectile.ai[1] == 0f) - { - 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); - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + 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("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) + { + 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; + } + } + 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; + } + } + } + /*bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + }*/ + /*Vector2 vector46 = projectile.position; + bool flag25 = false; + if (projectile.ai[0] != 1f) + { + projectile.tileCollide = false; + } + if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + { + projectile.tileCollide = false; + } + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + }*/ + /*if (flag25) + { + num647 = num635; + }*/ + if (Vector2.Distance(player.Center, projectile.Center) > 400f) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + /*if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 6f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + {*/ + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 7f; //6 + if (flag26) + { + num650 = 18f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 10f) //200 and 8 + { + num650 = 10f; //8 + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.22f; + projectile.velocity.Y = -0.12f; + } + //} + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + 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.ai[0] == 0f) + { + int num658 = mod.ProjectileType("CactusHealOrb"); + if (projectile.ai[1] == 0f) + { + 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 diff --git a/Projectiles/DustProjectile.cs b/Projectiles/DustProjectile.cs index 585e4300d2..c5887a3227 100644 --- a/Projectiles/DustProjectile.cs +++ b/Projectiles/DustProjectile.cs @@ -1,129 +1,129 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; - if (num297 == 75) - { - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; - if (num297 == 75) - { - 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; - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; + if (num297 == 75) + { + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; + if (num297 == 75) + { + 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; + return; + } + } } \ No newline at end of file diff --git a/Projectiles/DuststormCloud.cs b/Projectiles/DuststormCloud.cs index 4db8869227..c3c2a6259b 100644 --- a/Projectiles/DuststormCloud.cs +++ b/Projectiles/DuststormCloud.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 -{ - 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.thrown = 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 > 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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 > 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/DuststormInABottle.cs b/Projectiles/DuststormInABottle.cs index b0b50227d7..af2ccdbc42 100644 --- a/Projectiles/DuststormInABottle.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; - aiType = 48; - } - - 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)); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 180; + aiType = 48; + } + + 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 diff --git a/Projectiles/Earth.cs b/Projectiles/Earth.cs index 815250a0d6..36ff19894f 100644 --- a/Projectiles/Earth.cs +++ b/Projectiles/Earth.cs @@ -1,156 +1,156 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Earth : ModProjectile - { - public 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); - return; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - } - - 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, 500); - target.AddBuff(BuffID.Frostburn, 500); - target.AddBuff(BuffID.CursedInferno, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Earth : ModProjectile + { + public 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); + return; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + } + + 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, 500); + target.AddBuff(BuffID.Frostburn, 500); + target.AddBuff(BuffID.CursedInferno, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Earth2.cs b/Projectiles/Earth2.cs index c04daa47ad..780e506ad0 100644 --- a/Projectiles/Earth2.cs +++ b/Projectiles/Earth2.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; - -namespace CalamityMod.Projectiles -{ - public class Earth2 : ModProjectile - { - public 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); - return; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f); - } - - 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Earth2 : ModProjectile + { + public 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); + return; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f); + } + + 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Earth3.cs b/Projectiles/Earth3.cs index 0a8d6fdd17..1e249442cc 100644 --- a/Projectiles/Earth3.cs +++ b/Projectiles/Earth3.cs @@ -1,160 +1,160 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Earth3 : ModProjectile - { - public 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); - return; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Earth3 : ModProjectile + { + public 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); + return; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Earth4.cs b/Projectiles/Earth4.cs index 5dfc3328a0..d7400d9d01 100644 --- a/Projectiles/Earth4.cs +++ b/Projectiles/Earth4.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.Projectiles -{ - public class Earth4 : ModProjectile - { - public 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); - return; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("EarthHealOrb"), 0, 0f, projectile.owner, (float)num2, num); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Earth4 : ModProjectile + { + public 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); + return; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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; + 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 diff --git a/Projectiles/EarthHealOrb.cs b/Projectiles/EarthHealOrb.cs index 7ffc5f3ff7..87771780dc 100644 --- a/Projectiles/EarthHealOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/EarthRockBig.cs b/Projectiles/EarthRockBig.cs index 57d3b2f029..6433aec4e5 100644 --- a/Projectiles/EarthRockBig.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/EarthRockSmall.cs b/Projectiles/EarthRockSmall.cs index b88930adf8..7fecd14146 100644 --- a/Projectiles/EarthRockSmall.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/EarthenPike.cs b/Projectiles/EarthenPike.cs index 86f87cabaf..16a65fc0bc 100644 --- a/Projectiles/EarthenPike.cs +++ b/Projectiles/EarthenPike.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 -{ - 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; - } - 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"), 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + 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"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/EidolicWail.cs b/Projectiles/EidolicWail.cs index 0f8aa3dee6..cefe70319c 100644 --- a/Projectiles/EidolicWail.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/EidolicWail.png b/Projectiles/EidolicWail.png index 2739c2b429..e3d171c010 100644 Binary files a/Projectiles/EidolicWail.png and b/Projectiles/EidolicWail.png differ diff --git a/Projectiles/EldritchTentacle.cs b/Projectiles/EldritchTentacle.cs index 72ff7cc7b1..c083219b38 100644 --- a/Projectiles/EldritchTentacle.cs +++ b/Projectiles/EldritchTentacle.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 -{ - 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++; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/ElementBall.cs b/Projectiles/ElementBall.cs index afd53f757a..76cc09a81e 100644 --- a/Projectiles/ElementBall.cs +++ b/Projectiles/ElementBall.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/ElementBallShiv.cs b/Projectiles/ElementBallShiv.cs index d15b84c469..faedb3d0e2 100644 --- a/Projectiles/ElementBallShiv.cs +++ b/Projectiles/ElementBallShiv.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 -{ - 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; - return; - } - } - - 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"), (int)((double)projectile.damage), 1f, projectile.owner); - } - } - target.AddBuff(mod.BuffType("HolyLight"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), (int)((double)projectile.damage), 1f, projectile.owner); + } + } + target.AddBuff(mod.BuffType("HolyLight"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/ElementBolt.cs b/Projectiles/ElementBolt.cs index 14f2baeba5..fff381d2d1 100644 --- a/Projectiles/ElementBolt.cs +++ b/Projectiles/ElementBolt.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 -{ - 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"), (int)((double)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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), (int)((double)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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ElementBolt2.cs b/Projectiles/ElementBolt2.cs index 6d82723e35..7450012f45 100644 --- a/Projectiles/ElementBolt2.cs +++ b/Projectiles/ElementBolt2.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 -{ - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ElementOrb.cs b/Projectiles/ElementOrb.cs index 444425c248..719b88bdd4 100644 --- a/Projectiles/ElementOrb.cs +++ b/Projectiles/ElementOrb.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 -{ - 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); - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ElementOrb2.cs b/Projectiles/ElementOrb2.cs index 5ac75b4857..c39424d1f5 100644 --- a/Projectiles/ElementOrb2.cs +++ b/Projectiles/ElementOrb2.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 -{ - 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); - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ElementRay.cs b/Projectiles/ElementRay.cs index 5ae81539ce..367e838a00 100644 --- a/Projectiles/ElementRay.cs +++ b/Projectiles/ElementRay.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 -{ - 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"), (int)((double)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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), (int)((double)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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ElementTentacle.cs b/Projectiles/ElementTentacle.cs index ab381b1669..ba2b1abffa 100644 --- a/Projectiles/ElementTentacle.cs +++ b/Projectiles/ElementTentacle.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 -{ - 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].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.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].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.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/ElementalAxe.cs b/Projectiles/ElementalAxe.cs index 310718a077..84a0b785bf 100644 --- a/Projectiles/ElementalAxe.cs +++ b/Projectiles/ElementalAxe.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 -{ - 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() - { - 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 = 150f; - 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; - 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; - 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 tex = Main.projectileTexture[projectile.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; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 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 +{ + 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() + { + 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 = 150f; + 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; + 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; + 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 tex = Main.projectileTexture[projectile.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; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/ElysianArrow.cs b/Projectiles/ElysianArrow.cs index e6b531d26a..64f3ed82a4 100644 --- a/Projectiles/ElysianArrow.cs +++ b/Projectiles/ElysianArrow.cs @@ -1,123 +1,123 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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, 244, 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 < 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, 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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, 244, 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 < 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, 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 diff --git a/Projectiles/EmpyreanKnives.cs b/Projectiles/EmpyreanKnives.cs index 5277e8e4ed..d9148e6b55 100644 --- a/Projectiles/EmpyreanKnives.cs +++ b/Projectiles/EmpyreanKnives.cs @@ -1,148 +1,148 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = true; - projectile.melee = false; - } - 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; - return; - } - 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; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.melee = false; + } + 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; + return; + } + 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; + 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 diff --git a/Projectiles/EnhancedNanoRound.cs b/Projectiles/EnhancedNanoRound.cs index 5aac624dd2..61516a70d2 100644 --- a/Projectiles/EnhancedNanoRound.cs +++ b/Projectiles/EnhancedNanoRound.cs @@ -1,99 +1,99 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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("Nanomachine"), (int)((double)projectile.damage), 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(10, 20); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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("Nanomachine"), (int)((double)projectile.damage), 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(10, 20); + 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 diff --git a/Projectiles/EonBeam.cs b/Projectiles/EonBeam.cs index 57c379e780..d737e7d68b 100644 --- a/Projectiles/EonBeam.cs +++ b/Projectiles/EonBeam.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 -{ - 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("HolyLight"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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("HolyLight"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/EonBeamV2.cs b/Projectiles/EonBeamV2.cs index 5a602b47b1..9222e09758 100644 --- a/Projectiles/EonBeamV2.cs +++ b/Projectiles/EonBeamV2.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 -{ - 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("HolyLight"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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("HolyLight"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/EonBeamV3.cs b/Projectiles/EonBeamV3.cs index 26f49b8414..57a576eacb 100644 --- a/Projectiles/EonBeamV3.cs +++ b/Projectiles/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 -{ - 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("HolyLight"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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("HolyLight"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/EonBeamV4.cs b/Projectiles/EonBeamV4.cs index d66229f469..a8b34e5c48 100644 --- a/Projectiles/EonBeamV4.cs +++ b/Projectiles/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 -{ - 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("HolyLight"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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("HolyLight"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/EradicatorMeleeProjectile.cs b/Projectiles/EradicatorMeleeProjectile.cs index 27bbac2e61..f1b40a9ad1 100644 --- a/Projectiles/EradicatorMeleeProjectile.cs +++ b/Projectiles/EradicatorMeleeProjectile.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 -{ - public class EradicatorMeleeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - 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 laser = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[laser].ranged = false; - Main.projectile[laser].melee = true; - } - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class EradicatorMeleeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + 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 laser = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[laser].ranged = false; + Main.projectile[laser].melee = true; + } + } + return; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/EradicatorProjectile.cs b/Projectiles/EradicatorProjectile.cs index e25d168dd2..eb0c88ff5f 100644 --- a/Projectiles/EradicatorProjectile.cs +++ b/Projectiles/EradicatorProjectile.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 -{ - public class EradicatorProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 44; - projectile.friendly = true; - projectile.thrown = 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 laser = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[laser].ranged = false; - Main.projectile[laser].thrown = true; - } - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class EradicatorProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 44; + projectile.friendly = true; + projectile.thrown = 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 laser = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[laser].ranged = false; + Main.projectile[laser].thrown = true; + } + } + return; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/EssenceBeam.cs b/Projectiles/EssenceBeam.cs index 2a10a8294f..c4a0f55f75 100644 --- a/Projectiles/EssenceBeam.cs +++ b/Projectiles/EssenceBeam.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 -{ - 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() - { - 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] > 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); - target.immune[projectile.owner] = 2; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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] > 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); + target.immune[projectile.owner] = 2; + } + } } \ No newline at end of file diff --git a/Projectiles/EssenceBurst.cs b/Projectiles/EssenceBurst.cs index 928df69d92..f7ede1ec56 100644 --- a/Projectiles/EssenceBurst.cs +++ b/Projectiles/EssenceBurst.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 -{ - 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() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/EssenceFire.cs b/Projectiles/EssenceFire.cs index 98f2b93ff1..e8057cdb1d 100644 --- a/Projectiles/EssenceFire.cs +++ b/Projectiles/EssenceFire.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 -{ - 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 ((num297 == 173 && 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; - if (num297 == 173) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); - target.immune[projectile.owner] = 1; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 173 && 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; + if (num297 == 173) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); + target.immune[projectile.owner] = 1; + } + } } \ No newline at end of file diff --git a/Projectiles/EssenceFlame.cs b/Projectiles/EssenceFlame.cs index 3a251595c4..f8b452ecdb 100644 --- a/Projectiles/EssenceFlame.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/EssenceFlame2.cs b/Projectiles/EssenceFlame2.cs index c1ae5207ea..45ca363b7d 100644 --- a/Projectiles/EssenceFlame2.cs +++ b/Projectiles/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 -{ - 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.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; - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + 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 diff --git a/Projectiles/EssenceScythe.cs b/Projectiles/EssenceScythe.cs index 34ff0ee83a..90df67a23d 100644 --- a/Projectiles/EssenceScythe.cs +++ b/Projectiles/EssenceScythe.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 -{ - 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; - return; - } - } - - 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"), 500); - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), 500); + 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 diff --git a/Projectiles/EvergladeSprayProjectile.cs b/Projectiles/EvergladeSprayProjectile.cs index 115c58f958..a166cd55cd 100644 --- a/Projectiles/EvergladeSprayProjectile.cs +++ b/Projectiles/EvergladeSprayProjectile.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 -{ - public class EvergladeSprayProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spray"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - 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; - return; - } - } - - 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, 400); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class EvergladeSprayProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spray"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + 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; + return; + } + } + + 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, 400); + } + } } \ No newline at end of file diff --git a/Projectiles/ExecutionersBlade.cs b/Projectiles/ExecutionersBlade.cs index dd8aca6155..333237272a 100644 --- a/Projectiles/ExecutionersBlade.cs +++ b/Projectiles/ExecutionersBlade.cs @@ -1,106 +1,106 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 240; - aiType = 48; - } - - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 240; + aiType = 48; + } + + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); + } + + 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 diff --git a/Projectiles/ExoFire.cs b/Projectiles/ExoFire.cs index 6f92a4fb99..800ef8fa49 100644 --- a/Projectiles/ExoFire.cs +++ b/Projectiles/ExoFire.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 -{ - 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), 1f); - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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), 1f); + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/ExoMark.cs b/Projectiles/ExoMark.cs index fe0eb043df..e070eebd9d 100644 --- a/Projectiles/ExoMark.cs +++ b/Projectiles/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 -{ - 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.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(); - 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(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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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(); + 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(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 diff --git a/Projectiles/ExoTornado.cs b/Projectiles/ExoTornado.cs index e24082500d..fb230c3562 100644 --- a/Projectiles/ExoTornado.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Exobeam.cs b/Projectiles/Exobeam.cs index 1b67f63b28..0f31f26d0a 100644 --- a/Projectiles/Exobeam.cs +++ b/Projectiles/Exobeam.cs @@ -1,203 +1,203 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - 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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + 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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/Exoboom.cs b/Projectiles/Exoboom.cs index 70614ad64e..8a2dfc48e5 100644 --- a/Projectiles/Exoboom.cs +++ b/Projectiles/Exoboom.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 -{ - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/Exocomet.cs b/Projectiles/Exocomet.cs index d5e38503ad..0ee501da79 100644 --- a/Projectiles/Exocomet.cs +++ b/Projectiles/Exocomet.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 -{ - 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); - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 240); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 240); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + 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 diff --git a/Projectiles/Exoheal.cs b/Projectiles/Exoheal.cs index 5f4bf47276..bb2e66dbbb 100644 --- a/Projectiles/Exoheal.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ExplodingStake.cs b/Projectiles/ExplodingStake.cs index 34bd481ace..fd2391055f 100644 --- a/Projectiles/ExplodingStake.cs +++ b/Projectiles/ExplodingStake.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 -{ - 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].melee = false; - Main.projectile[boom].ranged = 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 +{ + 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].melee = false; + Main.projectile[boom].ranged = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ExsanguinationLanceProjectile.cs b/Projectiles/ExsanguinationLanceProjectile.cs index 6879a1d462..c7a58021e8 100644 --- a/Projectiles/ExsanguinationLanceProjectile.cs +++ b/Projectiles/ExsanguinationLanceProjectile.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 -{ - 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; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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); + } + } } \ No newline at end of file diff --git a/Projectiles/FabBolt.cs b/Projectiles/FabBolt.cs index 9bd5f30a3a..b35d97ac9b 100644 --- a/Projectiles/FabBolt.cs +++ b/Projectiles/FabBolt.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 -{ - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/FabOrb.cs b/Projectiles/FabOrb.cs index 7252408c24..cc72150d7c 100644 --- a/Projectiles/FabOrb.cs +++ b/Projectiles/FabOrb.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 -{ - 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); - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/FabRay.cs b/Projectiles/FabRay.cs index 91b39dfb6a..443ee00570 100644 --- a/Projectiles/FabRay.cs +++ b/Projectiles/FabRay.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 -{ - 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; - } - return; - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/FabsolDust.cs b/Projectiles/FabsolDust.cs index 2dc08c13cf..55a500824a 100644 --- a/Projectiles/FabsolDust.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FatesReveal.cs b/Projectiles/FatesReveal.cs index 3db6d73288..b1d7136a88 100644 --- a/Projectiles/FatesReveal.cs +++ b/Projectiles/FatesReveal.cs @@ -1,179 +1,179 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 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 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; - } - } - int num956 = (int)projectile.ai[0]; - if (num956 >= 0 && Main.player[num956].active && !Main.player[num956].dead) - { - if (projectile.Distance(Main.player[num956].Center) > num950) - { - Vector2 vector118 = projectile.DirectionTo(Main.player[num956].Center); - if (vector118.HasNaNs()) - { - vector118 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - return; - } - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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 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; + } + } + int num956 = (int)projectile.ai[0]; + if (num956 >= 0 && Main.player[num956].active && !Main.player[num956].dead) + { + if (projectile.Distance(Main.player[num956].Center) > num950) + { + Vector2 vector118 = projectile.DirectionTo(Main.player[num956].Center); + if (vector118.HasNaNs()) + { + vector118 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + return; + } + } + } + + 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 diff --git a/Projectiles/FeatherKnifeProjectile.cs b/Projectiles/FeatherKnifeProjectile.cs index 71fcc51a3c..a61b6d6a4a 100644 --- a/Projectiles/FeatherKnifeProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - 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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + 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 diff --git a/Projectiles/FishronRPG.cs b/Projectiles/FishronRPG.cs index 1f5e60472e..d87a44d837 100644 --- a/Projectiles/FishronRPG.cs +++ b/Projectiles/FishronRPG.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 -{ - 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; - return; - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/FlakKraken.cs b/Projectiles/FlakKraken.cs index c904ab5749..1a6c23b8a9 100644 --- a/Projectiles/FlakKraken.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FlakKrakenGun.cs b/Projectiles/FlakKrakenGun.cs index f7ee6e1fb3..e59a5e08bc 100644 --- a/Projectiles/FlakKrakenGun.cs +++ b/Projectiles/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 -{ - 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)); - } - } +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 +{ + 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 diff --git a/Projectiles/FlameBeamTip.cs b/Projectiles/FlameBeamTip.cs index a153704698..4416c23436 100644 --- a/Projectiles/FlameBeamTip.cs +++ b/Projectiles/FlameBeamTip.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 -{ - 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); - return; - } - } - } - 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(); - return; - } - } - 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, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + } + } + 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(); + return; + } + } + 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, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/FlameBeamTip2.cs b/Projectiles/FlameBeamTip2.cs index cfcda72cb3..248beaf88e 100644 --- a/Projectiles/FlameBeamTip2.cs +++ b/Projectiles/FlameBeamTip2.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 -{ - 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(); - return; - } - } - 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, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + 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, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/FlameBlast.cs b/Projectiles/FlameBlast.cs index c776adc02e..c9c4914ca4 100644 --- a/Projectiles/FlameBlast.cs +++ b/Projectiles/FlameBlast.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 -{ - 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; - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + 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 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 diff --git a/Projectiles/FlameBurst.cs b/Projectiles/FlameBurst.cs index 666157e15e..581fabb269 100644 --- a/Projectiles/FlameBurst.cs +++ b/Projectiles/FlameBurst.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 -{ - public class FlameBurst : ModProjectile - { - public 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; - 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 < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class FlameBurst : ModProjectile + { + public 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; + 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 < 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 diff --git a/Projectiles/FlameBurstHostile.cs b/Projectiles/FlameBurstHostile.cs index ce46cb54af..a29652bb75 100644 --- a/Projectiles/FlameBurstHostile.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FlamePillar.cs b/Projectiles/FlamePillar.cs index a4ce846605..96638efcbb 100644 --- a/Projectiles/FlamePillar.cs +++ b/Projectiles/FlamePillar.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 -{ - 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 ((num297 == 127 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 127 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/FlameScytheProjectile.cs b/Projectiles/FlameScytheProjectile.cs index af5199fee8..671b84e653 100644 --- a/Projectiles/FlameScytheProjectile.cs +++ b/Projectiles/FlameScytheProjectile.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = 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); - target.AddBuff(BuffID.Bleeding, 600); - 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].melee = false; - Main.projectile[boom].thrown = 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 +{ + 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.thrown = 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); + target.AddBuff(BuffID.Bleeding, 600); + 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].melee = false; + Main.projectile[boom].thrown = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/FlameScytheProjectileMelee.cs b/Projectiles/FlameScytheProjectileMelee.cs index e43054c07f..4d185a4a78 100644 --- a/Projectiles/FlameScytheProjectileMelee.cs +++ b/Projectiles/FlameScytheProjectileMelee.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 -{ - 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); - target.AddBuff(BuffID.Bleeding, 600); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + target.AddBuff(BuffID.Bleeding, 600); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/FlamingPumpkin.cs b/Projectiles/FlamingPumpkin.cs index ee33350175..58f2ffe6d3 100644 --- a/Projectiles/FlamingPumpkin.cs +++ b/Projectiles/FlamingPumpkin.cs @@ -1,35 +1,35 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Projectiles -{ - 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FlamingStake.cs b/Projectiles/FlamingStake.cs index 3cd0a4c8b9..a2d37976bb 100644 --- a/Projectiles/FlamingStake.cs +++ b/Projectiles/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 -{ - 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, 260); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 260); + } + } } \ No newline at end of file diff --git a/Projectiles/FlareBat.cs b/Projectiles/FlareBat.cs index 641e775d2d..c60cef144d 100644 --- a/Projectiles/FlareBat.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FlareBoltProjectile.cs b/Projectiles/FlareBoltProjectile.cs index 3dfa1ebe68..c3bcf592d7 100644 --- a/Projectiles/FlareBoltProjectile.cs +++ b/Projectiles/FlareBoltProjectile.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 -{ - 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; - return; - } - } - - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/FlareExplosion.cs b/Projectiles/FlareExplosion.cs index bf06f96876..7ad80846d2 100644 --- a/Projectiles/FlareExplosion.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FlareExplosionHuge.cs b/Projectiles/FlareExplosionHuge.cs index 6e7237033a..cfbb0d263e 100644 --- a/Projectiles/FlareExplosionHuge.cs +++ b/Projectiles/FlareExplosionHuge.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 -{ - public class FlareExplosionHuge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - } - - 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 < 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class FlareExplosionHuge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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; + } + + 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 < 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 diff --git a/Projectiles/Flarefrost.cs b/Projectiles/Flarefrost.cs index 0018222079..b5440ee682 100644 --- a/Projectiles/Flarefrost.cs +++ b/Projectiles/Flarefrost.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 -{ - 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; - return; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/Flash.cs b/Projectiles/Flash.cs index cea3735a78..0a7cb0026e 100644 --- a/Projectiles/Flash.cs +++ b/Projectiles/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 -{ - 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.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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 300); + } + } } \ No newline at end of file diff --git a/Projectiles/FlashBullet.cs b/Projectiles/FlashBullet.cs index 076f70a386..ddf5d80537 100644 --- a/Projectiles/FlashBullet.cs +++ b/Projectiles/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 -{ - 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"), 1, 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 1, 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 diff --git a/Projectiles/ForbiddenAxeBlade.cs b/Projectiles/ForbiddenAxeBlade.cs index 6a9e263fb6..c87a6311c9 100644 --- a/Projectiles/ForbiddenAxeBlade.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ForbiddenSunProjectile.cs b/Projectiles/ForbiddenSunProjectile.cs index 3c6035560b..e7979ac6ae 100644 --- a/Projectiles/ForbiddenSunProjectile.cs +++ b/Projectiles/ForbiddenSunProjectile.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 -{ - 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; - } - return; - } - - 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, 750); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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, 750); + } + } } \ No newline at end of file diff --git a/Projectiles/ForbiddenSunburst.cs b/Projectiles/ForbiddenSunburst.cs index 6178bfaf3c..bc0ca41a82 100644 --- a/Projectiles/ForbiddenSunburst.cs +++ b/Projectiles/ForbiddenSunburst.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 -{ - 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(-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.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 750); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(-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.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 750); + } + } } \ No newline at end of file diff --git a/Projectiles/FossilShard.cs b/Projectiles/FossilShard.cs index dbf93f1f78..8809644713 100644 --- a/Projectiles/FossilShard.cs +++ b/Projectiles/FossilShard.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FossilSpike.cs b/Projectiles/FossilSpike.cs index 282693ec8d..498ac1fe99 100644 --- a/Projectiles/FossilSpike.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Fox.cs b/Projectiles/Fox.cs index 10689e4979..b92951069a 100644 --- a/Projectiles/Fox.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FrigidflashBoltProjectile.cs b/Projectiles/FrigidflashBoltProjectile.cs index b8dc4b1f4a..e70b6acccd 100644 --- a/Projectiles/FrigidflashBoltProjectile.cs +++ b/Projectiles/FrigidflashBoltProjectile.cs @@ -1,128 +1,128 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - return; - } - } - - 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, 400); - target.AddBuff(BuffID.Frostburn, 400); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 400); + target.AddBuff(BuffID.Frostburn, 400); + } + } } \ No newline at end of file diff --git a/Projectiles/FrostBoltProjectile.cs b/Projectiles/FrostBoltProjectile.cs index 012c2a97e0..6cb81117c7 100644 --- a/Projectiles/FrostBoltProjectile.cs +++ b/Projectiles/FrostBoltProjectile.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 -{ - 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; - return; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/FrostMistFriendly.cs b/Projectiles/FrostMistFriendly.cs index eb074f2b81..1cce5038c0 100644 --- a/Projectiles/FrostMistFriendly.cs +++ b/Projectiles/FrostMistFriendly.cs @@ -1,119 +1,119 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/FrostsparkBullet.cs b/Projectiles/FrostsparkBullet.cs index 493d62d38d..3f57ac23a7 100644 --- a/Projectiles/FrostsparkBullet.cs +++ b/Projectiles/FrostsparkBullet.cs @@ -1,106 +1,106 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - if (target.buffImmune[mod.BuffType("GlacialState")]) - { - damage += 4; - } - } - - 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.5f), 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + if (target.buffImmune[mod.BuffType("GlacialState")]) + { + damage += 4; + } + } + + 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.5f), 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 diff --git a/Projectiles/FungalClump.cs b/Projectiles/FungalClump.cs index 4cbcbbcf3f..7c1e389116 100644 --- a/Projectiles/FungalClump.cs +++ b/Projectiles/FungalClump.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 -{ - 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) - { - 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.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) - { - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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.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) + { + 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 diff --git a/Projectiles/FungalHeal.cs b/Projectiles/FungalHeal.cs index 0be9213e96..55b758bde6 100644 --- a/Projectiles/FungalHeal.cs +++ b/Projectiles/FungalHeal.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 -{ - 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() - { - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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 diff --git a/Projectiles/FungiOrb.cs b/Projectiles/FungiOrb.cs index ed4cde6341..c87422e7fb 100644 --- a/Projectiles/FungiOrb.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/FungiOrb2.cs b/Projectiles/FungiOrb2.cs index 5727981602..ca266bf486 100644 --- a/Projectiles/FungiOrb2.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GalacticaComet.cs b/Projectiles/GalacticaComet.cs index 4ea21d88ab..36d62553c1 100644 --- a/Projectiles/GalacticaComet.cs +++ b/Projectiles/GalacticaComet.cs @@ -1,139 +1,139 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class GalacticaComet : ModProjectile - { - public 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); - return; - } - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class GalacticaComet : ModProjectile + { + public 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); + return; + } + } + } + + 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 diff --git a/Projectiles/Galaxia.cs b/Projectiles/Galaxia.cs index 16f05ff595..04764e5bbd 100644 --- a/Projectiles/Galaxia.cs +++ b/Projectiles/Galaxia.cs @@ -1,247 +1,247 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - return; - } - } - 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; - return; - } - return; - } - - 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); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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); - 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); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 1200); - player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 1200); - player.AddBuff(BuffID.Spelunker, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); - player.AddBuff(BuffID.Inferno, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Heartreach, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - 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); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + } + 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; + return; + } + return; + } + + 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); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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); + 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); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 1200); + player.AddBuff(BuffID.Dangersense, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 1200); + player.AddBuff(BuffID.Spelunker, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); + player.AddBuff(BuffID.Inferno, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Heartreach, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + 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); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 diff --git a/Projectiles/Galaxia2.cs b/Projectiles/Galaxia2.cs index b34c2e2486..d18b32b7ef 100644 --- a/Projectiles/Galaxia2.cs +++ b/Projectiles/Galaxia2.cs @@ -1,246 +1,246 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - return; - } - } - 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; - return; - } - return; - } - - 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); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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); - 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); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 1200); - player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 1200); - player.AddBuff(BuffID.Spelunker, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); - player.AddBuff(BuffID.Inferno, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Heartreach, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - 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); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + } + 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; + return; + } + return; + } + + 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); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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); + 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); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 1200); + player.AddBuff(BuffID.Dangersense, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 1200); + player.AddBuff(BuffID.Spelunker, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); + player.AddBuff(BuffID.Inferno, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Heartreach, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + 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); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 diff --git a/Projectiles/GalaxyBlast.cs b/Projectiles/GalaxyBlast.cs index 6d114375f9..735c7642b8 100644 --- a/Projectiles/GalaxyBlast.cs +++ b/Projectiles/GalaxyBlast.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 -{ - 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; - return; - } - } - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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 diff --git a/Projectiles/GalaxyBlastType2.cs b/Projectiles/GalaxyBlastType2.cs index 5a9c180c08..57abb1fad3 100644 --- a/Projectiles/GalaxyBlastType2.cs +++ b/Projectiles/GalaxyBlastType2.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 -{ - 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; - return; - } - } - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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 diff --git a/Projectiles/GalaxyBlastType3.cs b/Projectiles/GalaxyBlastType3.cs index 6733952248..81410bf236 100644 --- a/Projectiles/GalaxyBlastType3.cs +++ b/Projectiles/GalaxyBlastType3.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 -{ - 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; - return; - } - } - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + + 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 diff --git a/Projectiles/GammaLaser.cs b/Projectiles/GammaLaser.cs index 84bce7f787..07898a2fea 100644 --- a/Projectiles/GammaLaser.cs +++ b/Projectiles/GammaLaser.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 -{ - 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.AddBuff(BuffID.CursedInferno, 600); - target.immune[projectile.owner] = 1; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.AddBuff(BuffID.CursedInferno, 600); + target.immune[projectile.owner] = 1; + } + } } \ No newline at end of file diff --git a/Projectiles/GelDartProjectile.cs b/Projectiles/GelDartProjectile.cs index 4f38d2f0cb..3f3e00cca6 100644 --- a/Projectiles/GelDartProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 5; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - 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, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 5; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + 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, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/GelWave.cs b/Projectiles/GelWave.cs index 1254c883fe..42f8abff1e 100644 --- a/Projectiles/GelWave.cs +++ b/Projectiles/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 -{ - 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, 200); - projectile.velocity *= 0.5f; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + projectile.velocity *= 0.5f; + } + } } \ No newline at end of file diff --git a/Projectiles/GhastlyBlast.cs b/Projectiles/GhastlyBlast.cs index 7f2280eb71..a37bc408c0 100644 --- a/Projectiles/GhastlyBlast.cs +++ b/Projectiles/GhastlyBlast.cs @@ -1,327 +1,327 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 (flag59) - { - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 (flag59) + { + 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 diff --git a/Projectiles/GhastlyExplosion.cs b/Projectiles/GhastlyExplosion.cs index f5ea1c3906..2ca86d97ce 100644 --- a/Projectiles/GhastlyExplosion.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GhastlyExplosionShard.cs b/Projectiles/GhastlyExplosionShard.cs index 95527e1cb2..28d48d4ad7 100644 --- a/Projectiles/GhastlyExplosionShard.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GhastlySoulLarge.cs b/Projectiles/GhastlySoulLarge.cs index 303d29b1ca..ccb91db6a9 100644 --- a/Projectiles/GhastlySoulLarge.cs +++ b/Projectiles/GhastlySoulLarge.cs @@ -1,164 +1,164 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - 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; - } - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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) - { - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + 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; + } + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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) + { + 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 diff --git a/Projectiles/GhastlySoulMedium.cs b/Projectiles/GhastlySoulMedium.cs index 2c1da7f158..5d10b0c9d4 100644 --- a/Projectiles/GhastlySoulMedium.cs +++ b/Projectiles/GhastlySoulMedium.cs @@ -1,164 +1,164 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - 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; - } - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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) - { - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + 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; + } + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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) + { + 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 diff --git a/Projectiles/GhastlySoulSmall.cs b/Projectiles/GhastlySoulSmall.cs index 00b10c69b6..40f8aafe78 100644 --- a/Projectiles/GhastlySoulSmall.cs +++ b/Projectiles/GhastlySoulSmall.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 -{ - 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); - 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; - } - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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) - { - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + 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; + } + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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) + { + 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 diff --git a/Projectiles/GhastlySubBlast.cs b/Projectiles/GhastlySubBlast.cs index 0837c0c773..baa9c0ec75 100644 --- a/Projectiles/GhastlySubBlast.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GhastlyVisage.cs b/Projectiles/GhastlyVisage.cs index 4cd7a50b9c..603b885050 100644 --- a/Projectiles/GhastlyVisage.cs +++ b/Projectiles/GhastlyVisage.cs @@ -1,157 +1,157 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - bool shoot = true; - 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) - { - shoot = false; - } - else - { - player.statMana -= manaCost; - } - projectile.localAI[1] += 1f; - Main.PlaySound(SoundID.Item117, projectile.position); - } - if (projectile.soundDelay <= 0 && flag16) - { - if (player.statMana < manaCost) - { - shoot = false; - } - else - { - player.statMana -= manaCost; - } - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item117, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && shoot && 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + bool shoot = true; + 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) + { + shoot = false; + } + else + { + player.statMana -= manaCost; + } + projectile.localAI[1] += 1f; + Main.PlaySound(SoundID.Item117, projectile.position); + } + if (projectile.soundDelay <= 0 && flag16) + { + if (player.statMana < manaCost) + { + shoot = false; + } + else + { + player.statMana -= manaCost; + } + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item117, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && shoot && 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 diff --git a/Projectiles/GhostFire.cs b/Projectiles/GhostFire.cs index cd92029e7e..b293599a19 100644 --- a/Projectiles/GhostFire.cs +++ b/Projectiles/GhostFire.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 -{ - 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) - { - 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, 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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, 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/GhostlyBolt.cs b/Projectiles/GhostlyBolt.cs index d65a804763..76db60526c 100644 --- a/Projectiles/GhostlyBolt.cs +++ b/Projectiles/GhostlyBolt.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 -{ - 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.magic = true; - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.magic = true; + 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 diff --git a/Projectiles/GhostlyMine.cs b/Projectiles/GhostlyMine.cs index 7d780a2c39..cfb7ee4afc 100644 --- a/Projectiles/GhostlyMine.cs +++ b/Projectiles/GhostlyMine.cs @@ -1,115 +1,115 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] = projectile.ai[0]; - start = false; - } - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[1] = projectile.ai[0]; + start = false; + } + 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 diff --git a/Projectiles/GhoulishGouger.cs b/Projectiles/GhoulishGouger.cs index cb9a77292c..b22d3cd5a8 100644 --- a/Projectiles/GhoulishGouger.cs +++ b/Projectiles/GhoulishGouger.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 -{ - 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.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - 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; - return; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 4; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + 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; + return; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + } } \ No newline at end of file diff --git a/Projectiles/GigaFlareFriendly.cs b/Projectiles/GigaFlareFriendly.cs index 5ad0e8d610..9ecc3360d8 100644 --- a/Projectiles/GigaFlareFriendly.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GildedProboscis.cs b/Projectiles/GildedProboscis.cs index 0dcc430b08..27bfd408fe 100644 --- a/Projectiles/GildedProboscis.cs +++ b/Projectiles/GildedProboscis.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 -{ - 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; - } - - 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) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 2; - player.HealEffect(2); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 2; + player.HealEffect(2); + } + } } \ No newline at end of file diff --git a/Projectiles/GleamingBolt.cs b/Projectiles/GleamingBolt.cs index 01250f45e8..9762c94c0c 100644 --- a/Projectiles/GleamingBolt.cs +++ b/Projectiles/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 -{ - 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.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("GleamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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("GleamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + } + } } \ No newline at end of file diff --git a/Projectiles/GleamingBolt2.cs b/Projectiles/GleamingBolt2.cs index cd7a6cada4..d815a29cef 100644 --- a/Projectiles/GleamingBolt2.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GodKiller.cs b/Projectiles/GodKiller.cs index e6ebf32e68..44576381dc 100644 --- a/Projectiles/GodKiller.cs +++ b/Projectiles/GodKiller.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 -{ - 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; - return; - } - } - - 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/GodSlayerBlaze.cs b/Projectiles/GodSlayerBlaze.cs index 524f502fc3..73d3b79524 100644 --- a/Projectiles/GodSlayerBlaze.cs +++ b/Projectiles/GodSlayerBlaze.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 -{ - 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.magic = true; - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.magic = true; + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/GodSlayerHealOrb.cs b/Projectiles/GodSlayerHealOrb.cs index 7ffb40a49e..8b67a25ca9 100644 --- a/Projectiles/GodSlayerHealOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/GodSlayerOrb.cs b/Projectiles/GodSlayerOrb.cs index 18a956daf8..c1d14ad558 100644 --- a/Projectiles/GodSlayerOrb.cs +++ b/Projectiles/GodSlayerOrb.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/GodSlayerPhantom.cs b/Projectiles/GodSlayerPhantom.cs index 0a9bd5d2b6..abef749e8a 100644 --- a/Projectiles/GodSlayerPhantom.cs +++ b/Projectiles/GodSlayerPhantom.cs @@ -1,164 +1,164 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.minionSlots = 0f; - 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); - 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; - } - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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) - { - 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"), 600); - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.minionSlots = 0f; + 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); + 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; + } + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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) + { + 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"), 600); + } + + 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 diff --git a/Projectiles/GodSlayerShrapnel.cs b/Projectiles/GodSlayerShrapnel.cs index a31ece90af..d8af61645c 100644 --- a/Projectiles/GodSlayerShrapnel.cs +++ b/Projectiles/GodSlayerShrapnel.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 -{ - 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; - return; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/GodSlayerShrapnelRound.cs b/Projectiles/GodSlayerShrapnelRound.cs index 43957b3e0d..305ac61a16 100644 --- a/Projectiles/GodSlayerShrapnelRound.cs +++ b/Projectiles/GodSlayerShrapnelRound.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 -{ - 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; - projectile.ranged = true; - } - - 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; - } - return; - } - - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + projectile.ranged = true; + } + + 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; + } + return; + } + + 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 diff --git a/Projectiles/GoldenGun.cs b/Projectiles/GoldenGun.cs index 0da6351f67..30c1657f79 100644 --- a/Projectiles/GoldenGun.cs +++ b/Projectiles/GoldenGun.cs @@ -1,139 +1,139 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = 2; - 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); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = 2; + 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 diff --git a/Projectiles/GoldplumeSpearProjectile.cs b/Projectiles/GoldplumeSpearProjectile.cs index fbc164d0dd..6a25fae6b5 100644 --- a/Projectiles/GoldplumeSpearProjectile.cs +++ b/Projectiles/GoldplumeSpearProjectile.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 -{ - 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; - } - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + 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 diff --git a/Projectiles/GoliathExplosion.cs b/Projectiles/GoliathExplosion.cs index 5756279720..33e6824836 100644 --- a/Projectiles/GoliathExplosion.cs +++ b/Projectiles/GoliathExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/GoliathRocket.cs b/Projectiles/GoliathRocket.cs index 21ce0a0bc6..e6d4283664 100644 --- a/Projectiles/GoliathRocket.cs +++ b/Projectiles/GoliathRocket.cs @@ -1,202 +1,202 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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].magic = false; - Main.projectile[num520].ranged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - 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"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].magic = false; + Main.projectile[num520].ranged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + 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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/GraniteEnergy.cs b/Projectiles/GraniteEnergy.cs index 69a8a31088..811b5be192 100644 --- a/Projectiles/GraniteEnergy.cs +++ b/Projectiles/GraniteEnergy.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 -{ - 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) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default(Color), 1f); - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default(Color), 1f); + 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 diff --git a/Projectiles/GranitePulse.cs b/Projectiles/GranitePulse.cs index 066143fc02..0585ac9d60 100644 --- a/Projectiles/GranitePulse.cs +++ b/Projectiles/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 -{ - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 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, 206, 0f, 0f, 100, default(Color), 1f); - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 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, 206, 0f, 0f, 100, default(Color), 1f); - 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); - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 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, 206, 0f, 0f, 100, default(Color), 1f); + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 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, 206, 0f, 0f, 100, default(Color), 1f); + 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 diff --git a/Projectiles/GraySpawn.cs b/Projectiles/GraySpawn.cs index b19cd1eb7d..13ec448b67 100644 --- a/Projectiles/GraySpawn.cs +++ b/Projectiles/GraySpawn.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 -{ - public class GraySpawn : 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("CalamitasRun2")); - projectile.ai[1] = -30; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class GraySpawn : 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("CalamitasRun2")); + projectile.ai[1] = -30; + } + } + } } \ No newline at end of file diff --git a/Projectiles/GreenBall.cs b/Projectiles/GreenBall.cs index 71adfd2ae6..265f569b3f 100644 --- a/Projectiles/GreenBall.cs +++ b/Projectiles/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 -{ - public class GreenBall : ModProjectile - { - public 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.75f), 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class GreenBall : ModProjectile + { + public 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.75f), 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 diff --git a/Projectiles/GreenDust.cs b/Projectiles/GreenDust.cs index 0cfe956c6f..5ceaf6f0c5 100644 --- a/Projectiles/GreenDust.cs +++ b/Projectiles/GreenDust.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/GreenExoArrow.cs b/Projectiles/GreenExoArrow.cs index f2a8b92e21..aaf995c909 100644 --- a/Projectiles/GreenExoArrow.cs +++ b/Projectiles/GreenExoArrow.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 -{ - 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 = 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(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 = 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) - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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) + { + 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 diff --git a/Projectiles/GreenWater.cs b/Projectiles/GreenWater.cs index 362c71872c..dd88119c33 100644 --- a/Projectiles/GreenWater.cs +++ b/Projectiles/GreenWater.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 -{ - 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, ((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 < 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((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 < 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; + } + return; + } + + 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 diff --git a/Projectiles/HealOrbProv.cs b/Projectiles/HealOrbProv.cs index 6ce3945098..0e81d6a48a 100644 --- a/Projectiles/HealOrbProv.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/HeartRapierProjectile.cs b/Projectiles/HeartRapierProjectile.cs index 0c400bbac3..2aa75acfde 100644 --- a/Projectiles/HeartRapierProjectile.cs +++ b/Projectiles/HeartRapierProjectile.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 -{ - 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; - } - - 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) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } + } } \ No newline at end of file diff --git a/Projectiles/HellfireExplosion.cs b/Projectiles/HellfireExplosion.cs index e98461edca..7a363b0376 100644 --- a/Projectiles/HellfireExplosion.cs +++ b/Projectiles/HellfireExplosion.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 -{ - public class HellfireExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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 = 300; - } - - 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++; - } - return; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class HellfireExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 = 300; + } + + 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++; + } + return; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/HellfireExplosionFriendly.cs b/Projectiles/HellfireExplosionFriendly.cs index b1407d3ac1..0973508919 100644 --- a/Projectiles/HellfireExplosionFriendly.cs +++ b/Projectiles/HellfireExplosionFriendly.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 -{ - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1000); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1000); + } + } } \ No newline at end of file diff --git a/Projectiles/HellfireExplosionFriendly2.cs b/Projectiles/HellfireExplosionFriendly2.cs index bc045bf77e..159b196128 100644 --- a/Projectiles/HellfireExplosionFriendly2.cs +++ b/Projectiles/HellfireExplosionFriendly2.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 -{ - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 1000); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 1000); + } + } } \ No newline at end of file diff --git a/Projectiles/HellionFlowerSpearProjectile.cs b/Projectiles/HellionFlowerSpearProjectile.cs index 77f0d7f68d..81f6f30ba7 100644 --- a/Projectiles/HellionFlowerSpearProjectile.cs +++ b/Projectiles/HellionFlowerSpearProjectile.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 -{ - 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/HellionSpike.cs b/Projectiles/HellionSpike.cs index bfb9b06199..567d025d86 100644 --- a/Projectiles/HellionSpike.cs +++ b/Projectiles/HellionSpike.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 -{ - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Herring.cs b/Projectiles/Herring.cs index d032ef42a8..35c05f2004 100644 --- a/Projectiles/Herring.cs +++ b/Projectiles/Herring.cs @@ -1,252 +1,252 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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 ((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; - 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; - return; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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 ((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; + 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; + return; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } } \ No newline at end of file diff --git a/Projectiles/HiveBomb.cs b/Projectiles/HiveBomb.cs index 9153b96954..12eb4b94fb 100644 --- a/Projectiles/HiveBomb.cs +++ b/Projectiles/HiveBomb.cs @@ -1,202 +1,202 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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].magic = false; - Main.projectile[num520].ranged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].magic = false; + Main.projectile[num520].ranged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + 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 diff --git a/Projectiles/HiveBombExplosion.cs b/Projectiles/HiveBombExplosion.cs index 1578a0142c..12242299ec 100644 --- a/Projectiles/HiveBombExplosion.cs +++ b/Projectiles/HiveBombExplosion.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 -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/HiveBombExplosionHostile.cs b/Projectiles/HiveBombExplosionHostile.cs index d6faeeec00..eda0ecb7e1 100644 --- a/Projectiles/HiveBombExplosionHostile.cs +++ b/Projectiles/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 -{ - public class HiveBombExplosionHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class HiveBombExplosionHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 diff --git a/Projectiles/HiveExplosion.cs b/Projectiles/HiveExplosion.cs index 6d683a0cfb..c84dd23448 100644 --- a/Projectiles/HiveExplosion.cs +++ b/Projectiles/HiveExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/HiveMissile.cs b/Projectiles/HiveMissile.cs index aa0333c784..b28e9bc2f9 100644 --- a/Projectiles/HiveMissile.cs +++ b/Projectiles/HiveMissile.cs @@ -1,198 +1,198 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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].magic = false; - Main.projectile[num520].ranged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].magic = false; + Main.projectile[num520].ranged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + 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 diff --git a/Projectiles/HolyColliderHolyFire.cs b/Projectiles/HolyColliderHolyFire.cs new file mode 100644 index 0000000000..a9f6922f77 --- /dev/null +++ b/Projectiles/HolyColliderHolyFire.cs @@ -0,0 +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 +{ + 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 diff --git a/Projectiles/HolyColliderHolyFire.png b/Projectiles/HolyColliderHolyFire.png new file mode 100644 index 0000000000..edcdd5d8b7 Binary files /dev/null and b/Projectiles/HolyColliderHolyFire.png differ diff --git a/Projectiles/HolyEruption.cs b/Projectiles/HolyEruption.cs index a8b713897e..4781bea162 100644 --- a/Projectiles/HolyEruption.cs +++ b/Projectiles/HolyEruption.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 -{ - 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; - return; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/HolyExplosion.cs b/Projectiles/HolyExplosion.cs index dd15acbbf9..38ca432d81 100644 --- a/Projectiles/HolyExplosion.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/HolyExplosionSupreme.cs b/Projectiles/HolyExplosionSupreme.cs index a0a9f0742a..9a591655dd 100644 --- a/Projectiles/HolyExplosionSupreme.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/HolyFireBullet.cs b/Projectiles/HolyFireBullet.cs index c8179d1d56..0a3428b7ec 100644 --- a/Projectiles/HolyFireBullet.cs +++ b/Projectiles/HolyFireBullet.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 -{ - 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; - } - } - if (projectile.velocity.Y > 20f) - { - projectile.velocity.Y = 20f; - return; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, (int)((double)projectile.damage * 0.33), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boom].melee = false; - Main.projectile[boom].ranged = 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } + if (projectile.velocity.Y > 20f) + { + projectile.velocity.Y = 20f; + return; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, (int)((double)projectile.damage * 0.33), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].melee = false; + Main.projectile[boom].ranged = 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 diff --git a/Projectiles/HolyFlame.cs b/Projectiles/HolyFlame.cs index 832151fdbf..265dfeaf54 100644 --- a/Projectiles/HolyFlame.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/HolyFlameBomb.cs b/Projectiles/HolyFlameBomb.cs index 641a79d3bb..db3696f690 100644 --- a/Projectiles/HolyFlameBomb.cs +++ b/Projectiles/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 -{ - 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"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/HolyLaser.cs b/Projectiles/HolyLaser.cs index 46016b3efd..0e5368f18e 100644 --- a/Projectiles/HolyLaser.cs +++ b/Projectiles/HolyLaser.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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].melee = false; - Main.projectile[boom].magic = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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].melee = false; + Main.projectile[boom].magic = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/HorsWaterBlast.cs b/Projectiles/HorsWaterBlast.cs index 5295466de8..2ca6329060 100644 --- a/Projectiles/HorsWaterBlast.cs +++ b/Projectiles/HorsWaterBlast.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 -{ - 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; - } - return; - } - - 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, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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, 240); + } + } } \ No newline at end of file diff --git a/Projectiles/HyperBlade.cs b/Projectiles/HyperBlade.cs index a5373d1e39..e9a0b74d59 100644 --- a/Projectiles/HyperBlade.cs +++ b/Projectiles/HyperBlade.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 -{ - 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) * 0.01f) / 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; - return; - } - } - - 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, 100); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) * 0.01f) / 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; + return; + } + } + + 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, 100); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/HyperiusBullet.cs b/Projectiles/HyperiusBullet.cs index 6805283c47..c2ea646a7d 100644 --- a/Projectiles/HyperiusBullet.cs +++ b/Projectiles/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 -{ - 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 < 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, 235, 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) - { - 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("OMGWTH"), (int)((double)projectile.damage), 1f, projectile.owner); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 < 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, 235, 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) + { + 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("OMGWTH"), (int)((double)projectile.damage), 1f, projectile.owner); + } + } + } } \ No newline at end of file diff --git a/Projectiles/IceBeam.cs b/Projectiles/IceBeam.cs index 2878d7c2e2..5dfcae1d91 100644 --- a/Projectiles/IceBeam.cs +++ b/Projectiles/IceBeam.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 -{ - public class IceBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - 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.coldDamage = true; - projectile.tileCollide = true; - projectile.extraUpdates = 5; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - 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 -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.6f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 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; - } - if (projectile.light > 0f) - { - float num = projectile.light; - float num2 = projectile.light; - float num3 = projectile.light; - num2 *= 0.1f; - num *= 0.5f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha > 200) - { - return Color.Transparent; - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class IceBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + 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.coldDamage = true; + projectile.tileCollide = true; + projectile.extraUpdates = 5; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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 -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.6f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 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; + } + if (projectile.light > 0f) + { + float num = projectile.light; + float num2 = projectile.light; + float num3 = projectile.light; + num2 *= 0.1f; + num *= 0.5f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha > 200) + { + return Color.Transparent; + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/IceBombFriendly.cs b/Projectiles/IceBombFriendly.cs index 3a15bbcef8..4f0c85abb7 100644 --- a/Projectiles/IceBombFriendly.cs +++ b/Projectiles/IceBombFriendly.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 -{ - 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].hostile = false; - Main.projectile[projectile1].friendly = true; - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].hostile = false; - Main.projectile[projectile2].friendly = true; - } - } - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].hostile = false; + Main.projectile[projectile1].friendly = true; + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].hostile = false; + Main.projectile[projectile2].friendly = true; + } + } + 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 diff --git a/Projectiles/IceClasper.cs b/Projectiles/IceClasper.cs index 87ec53c8ee..547ca481e4 100644 --- a/Projectiles/IceClasper.cs +++ b/Projectiles/IceClasper.cs @@ -1,250 +1,250 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class IceClasper : ModProjectile - { - public 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) - { - 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--; - } - 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; - 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; - return; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class IceClasper : ModProjectile + { + public 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) + { + 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--; + } + 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; + 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; + return; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } } \ No newline at end of file diff --git a/Projectiles/IceCluster.cs b/Projectiles/IceCluster.cs index eec657efe8..b11deaaae3 100644 --- a/Projectiles/IceCluster.cs +++ b/Projectiles/IceCluster.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 -{ - 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); - return; - } - 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"), 360); - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + return; + } + 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"), 360); + 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 diff --git a/Projectiles/IceSpike.cs b/Projectiles/IceSpike.cs index c9d9ef03ce..83dba39b6b 100644 --- a/Projectiles/IceSpike.cs +++ b/Projectiles/IceSpike.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 -{ - 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; - return; - } - } - - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/IceStarProjectile.cs b/Projectiles/IceStarProjectile.cs index 4d2ea3b50d..6b0d32bf56 100644 --- a/Projectiles/IceStarProjectile.cs +++ b/Projectiles/IceStarProjectile.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class IceStarProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 280; - aiType = 48; - } - - 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; - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class IceStarProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 280; + aiType = 48; + } + + 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; + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Iceberg.cs b/Projectiles/Iceberg.cs index 85ee31b3d0..4344a80713 100644 --- a/Projectiles/Iceberg.cs +++ b/Projectiles/Iceberg.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 -{ - public class Iceberg : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iceberg"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(mod.BuffType("GlacialState"), 60); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Iceberg : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iceberg"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(mod.BuffType("GlacialState"), 60); + } + } } \ No newline at end of file diff --git a/Projectiles/Icebreaker.cs b/Projectiles/Icebreaker.cs index 1319c56d8f..91c6092192 100644 --- a/Projectiles/Icebreaker.cs +++ b/Projectiles/Icebreaker.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.melee = 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.melee = 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; + } + } } \ No newline at end of file diff --git a/Projectiles/IchorSpear.cs b/Projectiles/IchorSpear.cs index 2f81498616..7487b0e913 100644 --- a/Projectiles/IchorSpear.cs +++ b/Projectiles/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 -{ - public class IchorSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class IchorSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + 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 diff --git a/Projectiles/InfernadoFriendly.cs b/Projectiles/InfernadoFriendly.cs index 462c177a27..ae77e98072 100644 --- a/Projectiles/InfernadoFriendly.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/InfernadoMarkFriendly.cs b/Projectiles/InfernadoMarkFriendly.cs index 190bafb248..cf3799cfc4 100644 --- a/Projectiles/InfernadoMarkFriendly.cs +++ b/Projectiles/InfernadoMarkFriendly.cs @@ -1,140 +1,140 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/InfernalBlade.cs b/Projectiles/InfernalBlade.cs index 7cccbbe456..3c53134390 100644 --- a/Projectiles/InfernalBlade.cs +++ b/Projectiles/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 -{ - 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.75f), 1f, projectile.owner); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.75f), 1f, projectile.owner); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/InfernalBlade2.cs b/Projectiles/InfernalBlade2.cs index c0ea07c24d..74a482353a 100644 --- a/Projectiles/InfernalBlade2.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/InkBomb.cs b/Projectiles/InkBomb.cs index 60b7046549..bc212242a7 100644 --- a/Projectiles/InkBomb.cs +++ b/Projectiles/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 -{ - 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, 240); - target.AddBuff(BuffID.Darkness, 600, true); - projectile.Kill(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 240); + target.AddBuff(BuffID.Darkness, 600, true); + projectile.Kill(); + } + } } \ No newline at end of file diff --git a/Projectiles/InkPoisonCloud.cs b/Projectiles/InkPoisonCloud.cs index 1d43a92f2f..3cbc1b88b7 100644 --- a/Projectiles/InkPoisonCloud.cs +++ b/Projectiles/InkPoisonCloud.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(BuffID.Darkness, 600, true); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.Darkness, 600, true); + } + } } \ No newline at end of file diff --git a/Projectiles/InkPoisonCloud2.cs b/Projectiles/InkPoisonCloud2.cs index f9e84b7f21..301586a355 100644 --- a/Projectiles/InkPoisonCloud2.cs +++ b/Projectiles/InkPoisonCloud2.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(BuffID.Darkness, 600, true); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.Darkness, 600, true); + } + } } \ No newline at end of file diff --git a/Projectiles/InkPoisonCloud3.cs b/Projectiles/InkPoisonCloud3.cs index 117c680036..6c792a3afa 100644 --- a/Projectiles/InkPoisonCloud3.cs +++ b/Projectiles/InkPoisonCloud3.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(BuffID.Darkness, 600, true); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.Darkness, 600, true); + } + } } \ No newline at end of file diff --git a/Projectiles/IonBlast.cs b/Projectiles/IonBlast.cs index 58dffd3a7f..5d46e02669 100644 --- a/Projectiles/IonBlast.cs +++ b/Projectiles/IonBlast.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 -{ - 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(); - return; - } - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/IonExplosion.cs b/Projectiles/IonExplosion.cs index abf49e6006..543cf9c392 100644 --- a/Projectiles/IonExplosion.cs +++ b/Projectiles/IonExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 3; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 3; + } + } } \ No newline at end of file diff --git a/Projectiles/Judgement.cs b/Projectiles/Judgement.cs index d39f9183fd..e5243fe27c 100644 --- a/Projectiles/Judgement.cs +++ b/Projectiles/Judgement.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 -{ - 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; - return; - } - return; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + return; + } + + 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 diff --git a/Projectiles/JudgementBlah.cs b/Projectiles/JudgementBlah.cs index f9b77b8497..b820f85629 100644 --- a/Projectiles/JudgementBlah.cs +++ b/Projectiles/JudgementBlah.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 -{ - public class JudgementBlah : ModProjectile - { - 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; - return; - } - return; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class JudgementBlah : ModProjectile + { + 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; + return; + } + return; + } + + 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 diff --git a/Projectiles/LaceratorProjectile.cs b/Projectiles/LaceratorProjectile.cs index 8f7230a4f5..68fc3c39e0 100644 --- a/Projectiles/LaceratorProjectile.cs +++ b/Projectiles/LaceratorProjectile.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 -{ - 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 AI() - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 476, (int)((double)projectile.damage * 0.66f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 AI() + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 476, (int)((double)projectile.damage * 0.66f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/LaserFountain.cs b/Projectiles/LaserFountain.cs index a3b51c551b..39b601bb2d 100644 --- a/Projectiles/LaserFountain.cs +++ b/Projectiles/LaserFountain.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 -{ - 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) - { - int choice = Main.rand.Next(2); - if (choice == 0) - { - if (projectile.owner == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), 350, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].ranged = false; - Main.projectile[projectile1].melee = true; - Main.projectile[projectile1].aiStyle = 1; - } - } - else - { - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("IceBeam"), 350, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile2].ranged = false; - Main.projectile[projectile2].melee = true; - Main.projectile[projectile2].aiStyle = 1; - } - } - projectile.localAI[0] = 0f; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + int choice = Main.rand.Next(2); + if (choice == 0) + { + if (projectile.owner == Main.myPlayer) + { + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), 350, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].ranged = false; + Main.projectile[projectile1].melee = true; + Main.projectile[projectile1].aiStyle = 1; + } + } + else + { + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("IceBeam"), 350, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile2].ranged = false; + Main.projectile[projectile2].melee = true; + Main.projectile[projectile2].aiStyle = 1; + } + } + projectile.localAI[0] = 0f; + } + } + } } \ No newline at end of file diff --git a/Projectiles/LavaChunk.cs b/Projectiles/LavaChunk.cs index c6b1c743cd..cc6a8b38c4 100644 --- a/Projectiles/LavaChunk.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/LeafArrow.cs b/Projectiles/LeafArrow.cs index 93a5616cfb..5d44b23724 100644 --- a/Projectiles/LeafArrow.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Leech.cs b/Projectiles/Leech.cs index 93dc77d4f8..d110504544 100644 --- a/Projectiles/Leech.cs +++ b/Projectiles/Leech.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 -{ - 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 = 1; - projectile.timeLeft = 200; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 1; + projectile.timeLeft = 200; + } + + 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 diff --git a/Projectiles/Levi.cs b/Projectiles/Levi.cs index be2a98a413..2d14ec9624 100644 --- a/Projectiles/Levi.cs +++ b/Projectiles/Levi.cs @@ -1,151 +1,151 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/LifeScythe.cs b/Projectiles/LifeScythe.cs index dbd34ca3f4..c3d65baba9 100644 --- a/Projectiles/LifeScythe.cs +++ b/Projectiles/LifeScythe.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 -{ - 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); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Light.cs b/Projectiles/Light.cs index 6e1130dcb2..9c30093651 100644 --- a/Projectiles/Light.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Lionfish.cs b/Projectiles/Lionfish.cs index beca31fd89..8c2b8fe26c 100644 --- a/Projectiles/Lionfish.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + } + + 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 diff --git a/Projectiles/LiquidBlade.cs b/Projectiles/LiquidBlade.cs index 3d342a07b7..105e8609e4 100644 --- a/Projectiles/LiquidBlade.cs +++ b/Projectiles/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 -{ - 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.75f), 1f, projectile.owner); - } - target.AddBuff(BuffID.Ichor, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.75f), 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 diff --git a/Projectiles/LiquidBlade2.cs b/Projectiles/LiquidBlade2.cs index b62ab2d420..b94f860a87 100644 --- a/Projectiles/LiquidBlade2.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/LunarBolt.cs b/Projectiles/LunarBolt.cs index c3ae4abd1a..0613541c6d 100644 --- a/Projectiles/LunarBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/LunarBolt2.cs b/Projectiles/LunarBolt2.cs index e368ddc10f..118650224c 100644 --- a/Projectiles/LunarBolt2.cs +++ b/Projectiles/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 -{ - 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.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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/LunicBeam.cs b/Projectiles/LunicBeam.cs index f9f0422340..c72ee4ccf8 100644 --- a/Projectiles/LunicBeam.cs +++ b/Projectiles/LunicBeam.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 -{ - 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 = 2; - 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 < 20f) - { - 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; - 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 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 2; + 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 < 20f) + { + 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; + 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 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 diff --git a/Projectiles/MageHammerBoom.cs b/Projectiles/MageHammerBoom.cs index 6eef7e1886..798471014c 100644 --- a/Projectiles/MageHammerBoom.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MagicIceBeam.cs b/Projectiles/MagicIceBeam.cs new file mode 100644 index 0000000000..9d6f4097ec --- /dev/null +++ b/Projectiles/MagicIceBeam.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MagicIceBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.extraUpdates = 5; + projectile.timeLeft = 200; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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 -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.6f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 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; + } + if (projectile.light > 0f) + { + float num = projectile.light; + float num2 = projectile.light; + float num3 = projectile.light; + num2 *= 0.1f; + num *= 0.5f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha > 200) + { + return Color.Transparent; + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 500); + } + } +} \ No newline at end of file diff --git a/Projectiles/MagicIceBeam.png b/Projectiles/MagicIceBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/MagicIceBeam.png differ diff --git a/Projectiles/MagicNebulaShot.cs b/Projectiles/MagicNebulaShot.cs new file mode 100644 index 0000000000..668ae36cdf --- /dev/null +++ b/Projectiles/MagicNebulaShot.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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, 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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MagicNebulaShot.png b/Projectiles/MagicNebulaShot.png new file mode 100644 index 0000000000..ef1edb7c71 Binary files /dev/null and b/Projectiles/MagicNebulaShot.png differ diff --git a/Projectiles/MagnaBlast.cs b/Projectiles/MagnaBlast.cs index eb10de0187..6d7d3929c9 100644 --- a/Projectiles/MagnaBlast.cs +++ b/Projectiles/MagnaBlast.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; - -namespace CalamityMod.Projectiles -{ - public class MagnaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 32; - projectile.scale = 0.9f; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - if (projectile.scale <= 2.2f) - { - projectile.scale *= 1.05f; - } - 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), 2f); - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MagnaBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 32; + projectile.scale = 0.9f; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + if (projectile.scale <= 2.2f) + { + projectile.scale *= 1.05f; + } + 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), 2f); + 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 diff --git a/Projectiles/MagnaStrike.cs b/Projectiles/MagnaStrike.cs index 82372550d7..aa824a9663 100644 --- a/Projectiles/MagnaStrike.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MagneticBeam.cs b/Projectiles/MagneticBeam.cs index 57b0d35c41..37338d6211 100644 --- a/Projectiles/MagneticBeam.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MagneticOrb.cs b/Projectiles/MagneticOrb.cs index 53d172eea9..c450e3e37a 100644 --- a/Projectiles/MagneticOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Malachite.cs b/Projectiles/Malachite.cs index 7abdd714f6..03bf33451c 100644 --- a/Projectiles/Malachite.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.extraUpdates = 3; - projectile.aiStyle = 93; - aiType = 514; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.extraUpdates = 3; + projectile.aiStyle = 93; + aiType = 514; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + 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 diff --git a/Projectiles/MalachiteBolt.cs b/Projectiles/MalachiteBolt.cs index 962457ae5c..39a20c74c5 100644 --- a/Projectiles/MalachiteBolt.cs +++ b/Projectiles/MalachiteBolt.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 -{ - 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.thrown = true; - projectile.extraUpdates = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), 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 = 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.extraUpdates = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), 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 = 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 diff --git a/Projectiles/ManaBolt.cs b/Projectiles/ManaBolt.cs index d80ce61522..0a843f440c 100644 --- a/Projectiles/ManaBolt.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ManaBoltSmall.cs b/Projectiles/ManaBoltSmall.cs index f03e2e6cbd..29843d926c 100644 --- a/Projectiles/ManaBoltSmall.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ManaBoltSmall2.cs b/Projectiles/ManaBoltSmall2.cs index a51b78697a..5714a72fd0 100644 --- a/Projectiles/ManaBoltSmall2.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MangroveChakramProjectile.cs b/Projectiles/MangroveChakramProjectile.cs index fef5097763..6385b254b5 100644 --- a/Projectiles/MangroveChakramProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/MangroveChakramProjectileMelee.cs b/Projectiles/MangroveChakramProjectileMelee.cs index 7b077859a9..e8432c8c4e 100644 --- a/Projectiles/MangroveChakramProjectileMelee.cs +++ b/Projectiles/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 -{ - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/MarianaProjectile.cs b/Projectiles/MarianaProjectile.cs index 19911fbd3d..ed1a157aad 100644 --- a/Projectiles/MarianaProjectile.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1.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 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1.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 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 diff --git a/Projectiles/MarkRound.cs b/Projectiles/MarkRound.cs index 0d8c6d874d..bfcf08d05b 100644 --- a/Projectiles/MarkRound.cs +++ b/Projectiles/MarkRound.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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(); - return; - } - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/MarniteObliterator.cs b/Projectiles/MarniteObliterator.cs index 39dbfdd646..39040456b3 100644 --- a/Projectiles/MarniteObliterator.cs +++ b/Projectiles/MarniteObliterator.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MarniteSpearProjectile.cs b/Projectiles/MarniteSpearProjectile.cs index 6fa1d7b5b9..71a97b0ea3 100644 --- a/Projectiles/MarniteSpearProjectile.cs +++ b/Projectiles/MarniteSpearProjectile.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 -{ - 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; - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/MechanicalBarracuda.cs b/Projectiles/MechanicalBarracuda.cs index 13c78589d5..a94b5800d6 100644 --- a/Projectiles/MechanicalBarracuda.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MechwormBody.cs b/Projectiles/MechwormBody.cs index 4d48218c0c..32c3944d12 100644 --- a/Projectiles/MechwormBody.cs +++ b/Projectiles/MechwormBody.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class MechwormBody : ModProjectile - { - 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]; - CalamityPlayer modPlayer = player9.GetModPlayer(mod); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active) - { - 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); - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MechwormBody : ModProjectile + { + 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]; + CalamityPlayer modPlayer = player9.GetModPlayer(mod); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active) + { + 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); + return; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/MechwormBody2.cs b/Projectiles/MechwormBody2.cs index 84cc305fba..14949c92e2 100644 --- a/Projectiles/MechwormBody2.cs +++ b/Projectiles/MechwormBody2.cs @@ -1,118 +1,118 @@ -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 -{ - public class MechwormBody2 : ModProjectile - { - 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]; - CalamityPlayer modPlayer = player9.GetModPlayer(mod); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active) - { - 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; - } - } +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 +{ + public class MechwormBody2 : ModProjectile + { + 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]; + CalamityPlayer modPlayer = player9.GetModPlayer(mod); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active) + { + 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 diff --git a/Projectiles/MechwormHead.cs b/Projectiles/MechwormHead.cs index 744e7fc6b2..64374e011c 100644 --- a/Projectiles/MechwormHead.cs +++ b/Projectiles/MechwormHead.cs @@ -1,199 +1,199 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class MechwormHead : ModProjectile - { - public int dust = 3; - - 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() - { - 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--; - } - 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]; - CalamityPlayer modPlayer = player9.GetModPlayer(mod); - player9.AddBuff(mod.BuffType("Mechworm"), 3600); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active) - { - 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; - } - bool flag65 = true; - if (flag65) - { - 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; - 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; - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MechwormHead : ModProjectile + { + public int dust = 3; + + 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() + { + 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--; + } + 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]; + CalamityPlayer modPlayer = player9.GetModPlayer(mod); + player9.AddBuff(mod.BuffType("Mechworm"), 3600); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active) + { + 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; + } + bool flag65 = true; + if (flag65) + { + 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; + 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/MechwormTail.cs b/Projectiles/MechwormTail.cs index 586e18543c..728717be89 100644 --- a/Projectiles/MechwormTail.cs +++ b/Projectiles/MechwormTail.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class MechwormTail : ModProjectile - { - 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]; - CalamityPlayer modPlayer = player9.GetModPlayer(mod); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - if (!player9.active) - { - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MechwormTail : ModProjectile + { + 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]; + CalamityPlayer modPlayer = player9.GetModPlayer(mod); + if ((int)Main.time % 120 == 0) + { + projectile.netUpdate = true; + } + if (!player9.active) + { + 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 diff --git a/Projectiles/MeowFire.cs b/Projectiles/MeowFire.cs index d13888f510..82f25710c6 100644 --- a/Projectiles/MeowFire.cs +++ b/Projectiles/MeowFire.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 -{ - 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 = 60; - } - - 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.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 = 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 ((num297 == 56 && 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; - if (num297 == 56) - { - 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; - return; - } - - 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, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 60; + } + + 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.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 = 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 ((num297 == 56 && 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; + if (num297 == 56) + { + 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; + return; + } + + 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, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/MeowFire2.cs b/Projectiles/MeowFire2.cs index 61f7d7e62c..e268864bbd 100644 --- a/Projectiles/MeowFire2.cs +++ b/Projectiles/MeowFire2.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 -{ - 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 = 60; - } - - 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.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 = 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 ((num297 == 73 && 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; - if (num297 == 73) - { - 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; - return; - } - - 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, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 60; + } + + 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.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 = 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 ((num297 == 73 && 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; + if (num297 == 73) + { + 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; + return; + } + + 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, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/MeteorFist.cs b/Projectiles/MeteorFist.cs index bbbcaf4654..6ee5e86635 100644 --- a/Projectiles/MeteorFist.cs +++ b/Projectiles/MeteorFist.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 -{ - public class MeteorFist : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fist"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = 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 = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 7f; - } - 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), 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; - } - } - 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, 6, 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), 0.5f); - 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, 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 70; num623++) - { - int 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].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), 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), 0.5f); - 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), 0.5f); - 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), 0.5f); - 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), 0.5f); - 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.OnFire, 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MeteorFist : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fist"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.melee = 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 = 20; + projectile.height = 20; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 7f; + } + 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), 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; + } + } + 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, 6, 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), 0.5f); + 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, 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 70; num623++) + { + int 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].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), 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), 0.5f); + 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), 0.5f); + 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), 0.5f); + 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), 0.5f); + 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.OnFire, 120); + } + } } \ No newline at end of file diff --git a/Projectiles/MiniRocket.cs b/Projectiles/MiniRocket.cs index 52b0471b80..f56abf9ab1 100644 --- a/Projectiles/MiniRocket.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/MiniRocketExplosion.cs b/Projectiles/MiniRocketExplosion.cs index 09823d21e9..d3da7cf0c9 100644 --- a/Projectiles/MiniRocketExplosion.cs +++ b/Projectiles/MiniRocketExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/MiniSandShark.cs b/Projectiles/MiniSandShark.cs index e1409ff879..db3cdbaebd 100644 --- a/Projectiles/MiniSandShark.cs +++ b/Projectiles/MiniSandShark.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 -{ - 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 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/MirrorBlast.cs b/Projectiles/MirrorBlast.cs index 487dc8e685..2728e2d764 100644 --- a/Projectiles/MirrorBlast.cs +++ b/Projectiles/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 -{ - public class MirrorBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class MirrorBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + } } \ No newline at end of file diff --git a/Projectiles/MistArrow.cs b/Projectiles/MistArrow.cs index 57d9fd4524..c719647261 100644 --- a/Projectiles/MistArrow.cs +++ b/Projectiles/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 -{ - 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, 200); - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/MoltenAmputator.cs b/Projectiles/MoltenAmputator.cs index 2cf2afc11e..a29c72ff24 100644 --- a/Projectiles/MoltenAmputator.cs +++ b/Projectiles/MoltenAmputator.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 -{ - 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.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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; - int blob = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), (int)((double)projectile.damage * 0.5f), 0f, projectile.owner, 0f, 0f); - Main.projectile[blob].hostile = false; - Main.projectile[blob].friendly = true; - Main.projectile[blob].penetrate = 1; - } - } - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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; + int blob = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), (int)((double)projectile.damage * 0.5f), 0f, projectile.owner, 0f, 0f); + Main.projectile[blob].hostile = false; + Main.projectile[blob].friendly = true; + Main.projectile[blob].penetrate = 1; + } + } + 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 diff --git a/Projectiles/MortarRound.cs b/Projectiles/MortarRound.cs index 298bb69e97..7317681948 100644 --- a/Projectiles/MortarRound.cs +++ b/Projectiles/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 -{ - 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; - } - } +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 +{ + 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 diff --git a/Projectiles/Mourningstar.cs b/Projectiles/Mourningstar.cs index 55e60333fe..2bc684346e 100644 --- a/Projectiles/Mourningstar.cs +++ b/Projectiles/Mourningstar.cs @@ -1,231 +1,231 @@ -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 -{ - 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; - } - - 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; - } - } +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 +{ + 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; + } + + 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 diff --git a/Projectiles/Murasama.cs b/Projectiles/Murasama.cs index 6afb9e3000..4baff68a35 100644 --- a/Projectiles/Murasama.cs +++ b/Projectiles/Murasama.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/Mycoroot.cs b/Projectiles/Mycoroot.cs index 6cd75e5261..d3dd339152 100644 --- a/Projectiles/Mycoroot.cs +++ b/Projectiles/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 -{ - public class Mycoroot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Root"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 1; - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Mycoroot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Root"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 1; + } + + 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 diff --git a/Projectiles/MythrilKnifeProjectile.cs b/Projectiles/MythrilKnifeProjectile.cs index c4b348c1ee..de32fbd973 100644 --- a/Projectiles/MythrilKnifeProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + 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 diff --git a/Projectiles/Nanomachine.cs b/Projectiles/Nanomachine.cs index ec12e277e1..6b309f482c 100644 --- a/Projectiles/Nanomachine.cs +++ b/Projectiles/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 -{ - 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 < 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; - } - 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, 200); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 < 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; + } + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/Nanotech.cs b/Projectiles/Nanotech.cs index 71e6f91773..44403e5d06 100644 --- a/Projectiles/Nanotech.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NapalmArrow.cs b/Projectiles/NapalmArrow.cs index c46b4b5c03..d255873759 100644 --- a/Projectiles/NapalmArrow.cs +++ b/Projectiles/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 -{ - 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.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; - } - 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), 9, 0f, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + } + 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), 9, 0f, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/Nebudust.cs b/Projectiles/Nebudust.cs index 26e7c6248e..535c06c64b 100644 --- a/Projectiles/Nebudust.cs +++ b/Projectiles/Nebudust.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/NebulaDust.cs b/Projectiles/NebulaDust.cs index 8169c41b8c..665415ce7b 100644 --- a/Projectiles/NebulaDust.cs +++ b/Projectiles/NebulaDust.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/NebulaShot.cs b/Projectiles/NebulaShot.cs index a469839db6..05ca1d2fde 100644 --- a/Projectiles/NebulaShot.cs +++ b/Projectiles/NebulaShot.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 -{ - 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; - } - - 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, 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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, 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; + } + } + } } \ No newline at end of file diff --git a/Projectiles/NebulaStar.cs b/Projectiles/NebulaStar.cs index d1f9887d5f..faee1ce63d 100644 --- a/Projectiles/NebulaStar.cs +++ b/Projectiles/NebulaStar.cs @@ -1,193 +1,193 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class NebulaStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - 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; - } - /*if (!Main.player[projectile.owner].sporeSac) - { - num947 += 100f; - }*/ - 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; - return; - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class NebulaStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + 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; + } + /*if (!Main.player[projectile.owner].sporeSac) + { + num947 += 100f; + }*/ + 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; + return; + } + } + + 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); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Nebulash.cs b/Projectiles/Nebulash.cs index 93b550e36c..6bc0d22576 100644 --- a/Projectiles/Nebulash.cs +++ b/Projectiles/Nebulash.cs @@ -1,225 +1,225 @@ -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 -{ - 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; - } - - 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, 173, 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; - } - } +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 +{ + 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; + } + + 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 diff --git a/Projectiles/Needler.cs b/Projectiles/Needler.cs index 405ae2c042..4a6c2bcca8 100644 --- a/Projectiles/Needler.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NeptuneOrb.cs b/Projectiles/NeptuneOrb.cs index 35e341d21e..672fca8878 100644 --- a/Projectiles/NeptuneOrb.cs +++ b/Projectiles/NeptuneOrb.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 -{ - public class NeptuneOrb : ModProjectile - { - public 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; - return; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 30; dust++) - { - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class NeptuneOrb : ModProjectile + { + public 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; + return; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + for (int dust = 0; dust <= 30; dust++) + { + 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 diff --git a/Projectiles/NightBolt.cs b/Projectiles/NightBolt.cs index 2e526d7751..dbdb09b6fc 100644 --- a/Projectiles/NightBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NightOrb.cs b/Projectiles/NightOrb.cs index d6c05299dd..22995cc65c 100644 --- a/Projectiles/NightOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NightRay.cs b/Projectiles/NightRay.cs index 8b986235a8..590b90d514 100644 --- a/Projectiles/NightRay.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NightStabber.cs b/Projectiles/NightStabber.cs index 7bab489687..5691318bb3 100644 --- a/Projectiles/NightStabber.cs +++ b/Projectiles/NightStabber.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 -{ - 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; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/NobodyKnows.cs b/Projectiles/NobodyKnows.cs index cb719916d3..44e153840b 100644 --- a/Projectiles/NobodyKnows.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NuclearFuryProjectile.cs b/Projectiles/NuclearFuryProjectile.cs index 565296438b..a084764886 100644 --- a/Projectiles/NuclearFuryProjectile.cs +++ b/Projectiles/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 -{ - 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; - } - } +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 +{ + 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 diff --git a/Projectiles/Nuke.cs b/Projectiles/Nuke.cs index 85cef64d84..37b298f10f 100644 --- a/Projectiles/Nuke.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NukeExplosion.cs b/Projectiles/NukeExplosion.cs index 587600516e..08456dd8e9 100644 --- a/Projectiles/NukeExplosion.cs +++ b/Projectiles/NukeExplosion.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 -{ - 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.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + } } \ No newline at end of file diff --git a/Projectiles/NullShot.cs b/Projectiles/NullShot.cs index 611a685661..ccdb97f5b6 100644 --- a/Projectiles/NullShot.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/NullShot2.cs b/Projectiles/NullShot2.cs index 4680f0da2e..d0ba55d589 100644 --- a/Projectiles/NullShot2.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/OMGWTH.cs b/Projectiles/OMGWTH.cs index 002f81e0f2..034c894586 100644 --- a/Projectiles/OMGWTH.cs +++ b/Projectiles/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 -{ - 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 < 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, 235, 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 < 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, 235, 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; + } + } } \ No newline at end of file diff --git a/Projectiles/OPHammer.cs b/Projectiles/OPHammer.cs index 7e341ad734..6573f3f231 100644 --- a/Projectiles/OPHammer.cs +++ b/Projectiles/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 -{ - public class OPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.friendly = true; - projectile.thrown = 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; - 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) - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class OPHammer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.friendly = true; + projectile.thrown = 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; + 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) + { + 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 diff --git a/Projectiles/OPHammerMelee.cs b/Projectiles/OPHammerMelee.cs index 99d5245d4c..489ebe03bf 100644 --- a/Projectiles/OPHammerMelee.cs +++ b/Projectiles/OPHammerMelee.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 -{ - public class OPHammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - 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; - 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) - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class OPHammerMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + 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; + 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) + { + 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 diff --git a/Projectiles/Oathblade.cs b/Projectiles/Oathblade.cs index 978a1e278d..b4d76d10f0 100644 --- a/Projectiles/Oathblade.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0f) / 255f, ((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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0f) / 255f, ((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 diff --git a/Projectiles/OceanBeam.cs b/Projectiles/OceanBeam.cs index c4c1232c71..ba81a09227 100644 --- a/Projectiles/OceanBeam.cs +++ b/Projectiles/OceanBeam.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 -{ - 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; - return; - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/OmegaBiomeOrb.cs b/Projectiles/OmegaBiomeOrb.cs index 0b656700ad..560db6da9f 100644 --- a/Projectiles/OmegaBiomeOrb.cs +++ b/Projectiles/OmegaBiomeOrb.cs @@ -1,219 +1,219 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - return; - } - 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; - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + 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; + 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 diff --git a/Projectiles/OnyxExplosion.cs b/Projectiles/OnyxExplosion.cs index 4a06a604a6..562a3bbdd1 100644 --- a/Projectiles/OnyxExplosion.cs +++ b/Projectiles/OnyxExplosion.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.penetrate = -1; - projectile.timeLeft = 3; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = -1; + projectile.timeLeft = 3; + } + } } \ No newline at end of file diff --git a/Projectiles/OnyxSharkBomb.cs b/Projectiles/OnyxSharkBomb.cs index bd50da0155..32326a4813 100644 --- a/Projectiles/OnyxSharkBomb.cs +++ b/Projectiles/OnyxSharkBomb.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 -{ - 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 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.4f), 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.4f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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.4f), 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.4f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/OpalStrike.cs b/Projectiles/OpalStrike.cs index 2840cd5950..5073aa37cf 100644 --- a/Projectiles/OpalStrike.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/OrangeExoArrow.cs b/Projectiles/OrangeExoArrow.cs index 294b2b9bc0..c9c2f256fd 100644 --- a/Projectiles/OrangeExoArrow.cs +++ b/Projectiles/OrangeExoArrow.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; - -namespace CalamityMod.Projectiles -{ - 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 = 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(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 = 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, 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), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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, 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), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } } \ No newline at end of file diff --git a/Projectiles/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/OrichalcumSpikedGemstoneProjectile.cs index 6f0ec20e0c..151665b891 100644 --- a/Projectiles/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.aiStyle = 2; - projectile.penetrate = 6; - projectile.timeLeft = 600; - aiType = 48; - } - - 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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.aiStyle = 2; + projectile.penetrate = 6; + projectile.timeLeft = 600; + aiType = 48; + } + + 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 diff --git a/Projectiles/PalladiumJavelinProjectile.cs b/Projectiles/PalladiumJavelinProjectile.cs index 6fcf5e8b6c..dc8834e59d 100644 --- a/Projectiles/PalladiumJavelinProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + 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 diff --git a/Projectiles/ParticleBeamofDoom.cs b/Projectiles/ParticleBeamofDoom.cs index c931ace2e3..46c8949c9d 100644 --- a/Projectiles/ParticleBeamofDoom.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Permafrost/ArcticBearPaw.cs b/Projectiles/Permafrost/ArcticBearPaw.cs index e0028af2df..0e9988f600 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); - } - } +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 diff --git a/Projectiles/Permafrost/DarkIce.cs b/Projectiles/Permafrost/DarkIce.cs index f39d085ea3..1c50a55db3 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; - } - } - } +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 diff --git a/Projectiles/Permafrost/DarkIceZero.cs b/Projectiles/Permafrost/DarkIceZero.cs index e2012f8fa7..ac3bc53c53 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"), 240); - } - - 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(); - } - } - } +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"), 240); + } + + 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 diff --git a/Projectiles/Permafrost/FrostShardFriendly.cs b/Projectiles/Permafrost/FrostShardFriendly.cs index 786a60cf64..a52090ced0 100644 --- a/Projectiles/Permafrost/FrostShardFriendly.cs +++ b/Projectiles/Permafrost/FrostShardFriendly.cs @@ -1,81 +1,81 @@ -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; - } - - 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; - } - } - } +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; + } + + 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 diff --git a/Projectiles/Permafrost/FrostyFlare.cs b/Projectiles/Permafrost/FrostyFlare.cs index c7c83aef22..1ef0a1a050 100644 --- a/Projectiles/Permafrost/FrostyFlare.cs +++ b/Projectiles/Permafrost/FrostyFlare.cs @@ -1,131 +1,131 @@ -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.thrown = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } - - 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; - Main.projectile[p].thrown = true; - } - - 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; - Main.projectile[p].thrown = true; - } - } - 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; - } - } +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.thrown = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } + + 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; + Main.projectile[p].thrown = true; + } + + 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; + Main.projectile[p].thrown = true; + } + } + 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 diff --git a/Projectiles/Permafrost/IceSentry.cs b/Projectiles/Permafrost/IceSentry.cs index 734bae46c2..0cb0a30d54 100644 --- a/Projectiles/Permafrost/IceSentry.cs +++ b/Projectiles/Permafrost/IceSentry.cs @@ -1,164 +1,159 @@ -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 - { - 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() - { - 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; - int damage = projectile.damage; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - } -} +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 + { + 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() + { + 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; + int damage = projectile.damage; + 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; + } + } + } + } +} diff --git a/Projectiles/Permafrost/Icicle.cs b/Projectiles/Permafrost/Icicle.cs index 1db5978862..bfd2cce87b 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; - } - } - } +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 diff --git a/Projectiles/Permafrost/IcicleArrow.cs b/Projectiles/Permafrost/IcicleArrow.cs index d4f45af644..bd093e979f 100644 --- a/Projectiles/Permafrost/IcicleArrow.cs +++ b/Projectiles/Permafrost/IcicleArrow.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.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); - //crystal bullet shards - 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); - } - } - } - } +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); + //crystal bullet shards + 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 diff --git a/Projectiles/Permafrost/IcyBullet.cs b/Projectiles/Permafrost/IcyBullet.cs index ee26ace66c..f1e8d255ff 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 / 3, 0f, projectile.owner); - } - } - } - } +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 / 3, 0f, projectile.owner); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/Permafrost/Snowball.cs b/Projectiles/Permafrost/Snowball.cs index 509dd27865..e50787ebcf 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 - } - } +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 diff --git a/Projectiles/Permafrost/TridentIcicle.cs b/Projectiles/Permafrost/TridentIcicle.cs index b4f5c7ff09..02fb6dcb5e 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; - } - } - } +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 diff --git a/Projectiles/Phangasm.cs b/Projectiles/Phangasm.cs index c89dbd5eef..9dc046a821 100644 --- a/Projectiles/Phangasm.cs +++ b/Projectiles/Phangasm.cs @@ -1,137 +1,133 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Phangasm : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phangasm"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 74; - 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] >= 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; - } - 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Phangasm : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phangasm"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 74; + 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 diff --git a/Projectiles/PhantasmalFury.cs b/Projectiles/PhantasmalFury.cs index 8f6b8c5bf3..168a1265e4 100644 --- a/Projectiles/PhantasmalFury.cs +++ b/Projectiles/PhantasmalFury.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 -{ - 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; - } - return; - } - - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/Phantom.cs b/Projectiles/Phantom.cs index 96ee0f32ce..1e06331144 100644 --- a/Projectiles/Phantom.cs +++ b/Projectiles/Phantom.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 -{ - 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; - return; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/PhantomGuy.cs b/Projectiles/PhantomGuy.cs index 262d44f7f7..f0ef906e06 100644 --- a/Projectiles/PhantomGuy.cs +++ b/Projectiles/PhantomGuy.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 -{ - public class PhantomGuy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - Main.projPet[projectile.type] = true; - 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) - { - 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; - } - float num633 = 700f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 150f; - 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; - 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 = 14f; //12 - 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 = 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class PhantomGuy : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + Main.projPet[projectile.type] = true; + 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) + { + 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; + } + float num633 = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 150f; + 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; + 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 = 14f; //12 + 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 = 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); + } + } } \ No newline at end of file diff --git a/Projectiles/PhoenixFire.cs b/Projectiles/PhoenixFire.cs index e64acc6744..bb22f92325 100644 --- a/Projectiles/PhoenixFire.cs +++ b/Projectiles/PhoenixFire.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 -{ - public class PhoenixFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class PhoenixFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/PhoenixFireFriendly.cs b/Projectiles/PhoenixFireFriendly.cs index 0d70b89aaa..0d1bb95cc7 100644 --- a/Projectiles/PhoenixFireFriendly.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/PhoenixHeal.cs b/Projectiles/PhoenixHeal.cs index c9b56f2953..33b66ab853 100644 --- a/Projectiles/PhoenixHeal.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/PlagueArrow.cs b/Projectiles/PlagueArrow.cs index 2040c8b09d..90415769ac 100644 --- a/Projectiles/PlagueArrow.cs +++ b/Projectiles/PlagueArrow.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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].magic = false; - Main.projectile[num520].ranged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].magic = false; + Main.projectile[num520].ranged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/PlagueDust.cs b/Projectiles/PlagueDust.cs index 5209037a10..b496b2a167 100644 --- a/Projectiles/PlagueDust.cs +++ b/Projectiles/PlagueDust.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 -{ - public class PlagueDust : 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.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.4f) / 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 = 89; - if (Main.rand.Next(1) == 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 ((num297 == 89 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class PlagueDust : 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.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.4f) / 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 = 89; + if (Main.rand.Next(1) == 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 ((num297 == 89 && 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; + if (num297 == 75) + { + 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; + return; + } + + 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 diff --git a/Projectiles/PlagueExplosion.cs b/Projectiles/PlagueExplosion.cs index 30c4fc63b7..9c0d228b3a 100644 --- a/Projectiles/PlagueExplosion.cs +++ b/Projectiles/PlagueExplosion.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 -{ - public class PlagueExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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++; - } - return; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class PlagueExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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++; + } + return; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/PlagueExplosionFriendly.cs b/Projectiles/PlagueExplosionFriendly.cs index 5e61b1af2d..d64b96394d 100644 --- a/Projectiles/PlagueExplosionFriendly.cs +++ b/Projectiles/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 -{ - 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.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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/PlagueFang.cs b/Projectiles/PlagueFang.cs index c26ed2e053..c95c39fbb3 100644 --- a/Projectiles/PlagueFang.cs +++ b/Projectiles/PlagueFang.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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"), 320); - target.immune[projectile.owner] = 2; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 320); + target.immune[projectile.owner] = 2; + } + } } \ No newline at end of file diff --git a/Projectiles/PlagueSeeker.cs b/Projectiles/PlagueSeeker.cs index d84507b565..4594bd5cf1 100644 --- a/Projectiles/PlagueSeeker.cs +++ b/Projectiles/PlagueSeeker.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 -{ - 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 = 150; - } - - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 150; + } + + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } } \ No newline at end of file diff --git a/Projectiles/PlasmaBall.cs b/Projectiles/PlasmaBall.cs index 3cfa332d78..c504780e4f 100644 --- a/Projectiles/PlasmaBall.cs +++ b/Projectiles/PlasmaBall.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 400); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 400); + } + } } \ No newline at end of file diff --git a/Projectiles/PlasmaBlast.cs b/Projectiles/PlasmaBlast.cs index 6cf7fc8f28..c055e10170 100644 --- a/Projectiles/PlasmaBlast.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +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 +{ + 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 diff --git a/Projectiles/PlasmaBolt.cs b/Projectiles/PlasmaBolt.cs index 648b8c25af..d6fc21388a 100644 --- a/Projectiles/PlasmaBolt.cs +++ b/Projectiles/PlasmaBolt.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 -{ - 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.light = 0.05f; - } - - public override void AI() - { - 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.5f; - dust.noLight = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.light = 0.05f; + } + + public override void AI() + { + 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.5f; + dust.noLight = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/PlasmaExplosion.cs b/Projectiles/PlasmaExplosion.cs index 59ac6cfa61..ee3fc27272 100644 --- a/Projectiles/PlasmaExplosion.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/PlasmaRay.cs b/Projectiles/PlasmaRay.cs index 8536f16140..60bae4851c 100644 --- a/Projectiles/PlasmaRay.cs +++ b/Projectiles/PlasmaRay.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 -{ - 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; - } - return; - } - } - - 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.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("PlasmaRay2"), (int)((double)projectile.damage * 1.75f), 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, 120); - target.AddBuff(BuffID.Ichor, 90); - target.AddBuff(BuffID.Frostburn, 260); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Poisoned, 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + 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.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("PlasmaRay2"), (int)((double)projectile.damage * 1.75f), 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, 120); + target.AddBuff(BuffID.Ichor, 90); + target.AddBuff(BuffID.Frostburn, 260); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Poisoned, 360); + } + } } \ No newline at end of file diff --git a/Projectiles/PlasmaRay2.cs b/Projectiles/PlasmaRay2.cs index 295f166734..bb2f79454a 100644 --- a/Projectiles/PlasmaRay2.cs +++ b/Projectiles/PlasmaRay2.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 -{ - 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; - } - return; - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + 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 diff --git a/Projectiles/PlasmaShot.cs b/Projectiles/PlasmaShot.cs index a658d3fde8..319e40f4f3 100644 --- a/Projectiles/PlasmaShot.cs +++ b/Projectiles/PlasmaShot.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 -{ - 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.light = 0.25f; - } - - public override void AI() - { - 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.8f; - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.light = 0.25f; + } + + public override void AI() + { + 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.8f; + 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 diff --git a/Projectiles/PoisonousSeawater.cs b/Projectiles/PoisonousSeawater.cs index db9158e19a..c2fc8d1a26 100644 --- a/Projectiles/PoisonousSeawater.cs +++ b/Projectiles/PoisonousSeawater.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 -{ - 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; - } - - 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 < 3; 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 < 3; 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 diff --git a/Projectiles/ProBolt.cs b/Projectiles/ProBolt.cs index 9e1bb1de30..114c8f6af6 100644 --- a/Projectiles/ProBolt.cs +++ b/Projectiles/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 -{ - 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 - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ProfanedEnergy.cs b/Projectiles/ProfanedEnergy.cs index 4fa1274c5b..cda21cbb14 100644 --- a/Projectiles/ProfanedEnergy.cs +++ b/Projectiles/ProfanedEnergy.cs @@ -1,143 +1,148 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class ProfanedEnergy : ModProjectile - { - public float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - 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) - { - 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 (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; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - 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 = 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, 170, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 8f; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ProfanedEnergy : ModProjectile + { + public float count = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); + Main.projFrames[projectile.type] = 4; + } + + 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) + { + 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 (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; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + 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 = 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, 170, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 8f; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ProfanedTrident.cs b/Projectiles/ProfanedTrident.cs index 885c99b8dc..550021e518 100644 --- a/Projectiles/ProfanedTrident.cs +++ b/Projectiles/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 -{ - public class ProfanedTrident : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trident"); - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.thrown = 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; - return; - } - } - - 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("GoliathExplosion"), 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 = 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ProfanedTrident : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident"); + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.thrown = 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; + return; + } + } + + 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("GoliathExplosion"), 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 = 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 diff --git a/Projectiles/Purge.cs b/Projectiles/Purge.cs index df6724256e..3839344b50 100644 --- a/Projectiles/Purge.cs +++ b/Projectiles/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 -{ - 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/PurgeLaser.cs b/Projectiles/PurgeLaser.cs index 9aacb3109a..966f1d82ef 100644 --- a/Projectiles/PurgeLaser.cs +++ b/Projectiles/PurgeLaser.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 -{ - 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(); - return; - } - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/Pwnagehammer.cs b/Projectiles/Pwnagehammer.cs index aa103c2990..397a2c3f1d 100644 --- a/Projectiles/Pwnagehammer.cs +++ b/Projectiles/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 -{ - 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.thrown = 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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 diff --git a/Projectiles/PwnagehammerMelee.cs b/Projectiles/PwnagehammerMelee.cs index 69a1781455..657a2af7df 100644 --- a/Projectiles/PwnagehammerMelee.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/QuagmireProjectile.cs b/Projectiles/QuagmireProjectile.cs index 3bbcbf107f..48554416d1 100644 --- a/Projectiles/QuagmireProjectile.cs +++ b/Projectiles/QuagmireProjectile.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 -{ - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.65f), projectile.knockBack, projectile.owner, 0f, 0f); - } - if (Main.rand.Next(30) == 0) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - if (Main.rand.Next(50) == 0) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.85f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.65f), projectile.knockBack, projectile.owner, 0f, 0f); + } + if (Main.rand.Next(30) == 0) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + if (Main.rand.Next(50) == 0) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.85f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/RainBolt.cs b/Projectiles/RainBolt.cs index f893828f4f..907e3b0086 100644 --- a/Projectiles/RainBolt.cs +++ b/Projectiles/RainBolt.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 -{ - 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; - return; - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/RainHeal.cs b/Projectiles/RainHeal.cs index 2aa42acc34..390835faa3 100644 --- a/Projectiles/RainHeal.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/RainbowBlast.cs b/Projectiles/RainbowBlast.cs index 142fb63f42..f9414c3b70 100644 --- a/Projectiles/RainbowBlast.cs +++ b/Projectiles/RainbowBlast.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 -{ - 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; - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/RainbowBoom.cs b/Projectiles/RainbowBoom.cs index 1d25349b48..ec3922999b 100644 --- a/Projectiles/RainbowBoom.cs +++ b/Projectiles/RainbowBoom.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 -{ - 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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/Razorwind.cs b/Projectiles/Razorwind.cs index 71237c8fa0..797dc86810 100644 --- a/Projectiles/Razorwind.cs +++ b/Projectiles/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 -{ - 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; - } - } +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 +{ + 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 diff --git a/Projectiles/ReaverBlast.cs b/Projectiles/ReaverBlast.cs index 583d35a442..632ff07023 100644 --- a/Projectiles/ReaverBlast.cs +++ b/Projectiles/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 -{ - 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, 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 120); + } + } } \ No newline at end of file diff --git a/Projectiles/ReaverOrb.cs b/Projectiles/ReaverOrb.cs index aef2b7a14e..733a686376 100644 --- a/Projectiles/ReaverOrb.cs +++ b/Projectiles/ReaverOrb.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 -{ - public class ReaverOrb : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Orb"); - Main.projPet[projectile.type] = true; - 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.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 50; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.sentry = true; - } - - 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) - { - 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; - } - } - 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 num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 600f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - 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), (int)(80f * player.minionDamage), 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; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ReaverOrb : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + Main.projPet[projectile.type] = true; + 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.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.alpha = 50; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.sentry = true; + } + + 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) + { + 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; + } + } + 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 num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 600f; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + 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), (int)(80f * player.minionDamage), 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; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/RedBall.cs b/Projectiles/RedBall.cs index d6696de790..5e535ab4a9 100644 --- a/Projectiles/RedBall.cs +++ b/Projectiles/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 -{ - public class RedBall : ModProjectile - { - public 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.75f), 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class RedBall : ModProjectile + { + public 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.75f), 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 diff --git a/Projectiles/RedDevil.cs b/Projectiles/RedDevil.cs index 8275317d9c..a8114accb0 100644 --- a/Projectiles/RedDevil.cs +++ b/Projectiles/RedDevil.cs @@ -1,263 +1,263 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class RedDevil : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Devil"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - 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; - } - - 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; - } - 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, 10000, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = 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 +{ + public class RedDevil : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Devil"); + Main.projFrames[projectile.type] = 5; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + 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; + } + + 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; + } + 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, 10000, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/RedDust.cs b/Projectiles/RedDust.cs index 78db5cf509..b2b7ffc587 100644 --- a/Projectiles/RedDust.cs +++ b/Projectiles/RedDust.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/RedSpawn.cs b/Projectiles/RedSpawn.cs index aafb7d65b9..3f5383d164 100644 --- a/Projectiles/RedSpawn.cs +++ b/Projectiles/RedSpawn.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 -{ - public class RedSpawn : 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("CalamitasRun")); - projectile.ai[1] = -30; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class RedSpawn : 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("CalamitasRun")); + projectile.ai[1] = -30; + } + } + } } \ No newline at end of file diff --git a/Projectiles/RotBallProjectile.cs b/Projectiles/RotBallProjectile.cs index e1ce3338b1..cb6312e8de 100644 --- a/Projectiles/RotBallProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/RougeSlashLarge.cs b/Projectiles/RougeSlashLarge.cs index ff7bc386da..336d206613 100644 --- a/Projectiles/RougeSlashLarge.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/RougeSlashMedium.cs b/Projectiles/RougeSlashMedium.cs index 3b4ff433a2..467f34f961 100644 --- a/Projectiles/RougeSlashMedium.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/RougeSlashSmall.cs b/Projectiles/RougeSlashSmall.cs index 04f81c4ab1..6f446433cb 100644 --- a/Projectiles/RougeSlashSmall.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/RoyalHeal.cs b/Projectiles/RoyalHeal.cs index 3bf32ac16a..063e73112e 100644 --- a/Projectiles/RoyalHeal.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/RoyalKnife.cs b/Projectiles/RoyalKnife.cs index c3691823bf..0074a6552f 100644 --- a/Projectiles/RoyalKnife.cs +++ b/Projectiles/RoyalKnife.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 -{ - 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.thrown = 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; - return; - } - 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"), 500); - if (target.type == NPCID.TargetDummy) - { - return; - } - 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; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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; + return; + } + 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"), 500); + if (target.type == NPCID.TargetDummy) + { + return; + } + 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; + 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 diff --git a/Projectiles/RoyalKnifeMelee.cs b/Projectiles/RoyalKnifeMelee.cs index 06100f057e..a9912acd4b 100644 --- a/Projectiles/RoyalKnifeMelee.cs +++ b/Projectiles/RoyalKnifeMelee.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 -{ - 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; - return; - } - 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"), 500); - if (target.type == NPCID.TargetDummy) - { - return; - } - 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; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + 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"), 500); + if (target.type == NPCID.TargetDummy) + { + return; + } + 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; + 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 diff --git a/Projectiles/RubberMortarRound.cs b/Projectiles/RubberMortarRound.cs index c9dda6b837..311d8febf3 100644 --- a/Projectiles/RubberMortarRound.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } - } +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 +{ + 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 diff --git a/Projectiles/SHIV.cs b/Projectiles/SHIV.cs index 1c8e20366f..3a820d3275 100644 --- a/Projectiles/SHIV.cs +++ b/Projectiles/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 -{ - 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"), 500); - target.AddBuff(mod.BuffType("GlacialState"), 500); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); - target.AddBuff(mod.BuffType("Plague"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/SHPB.cs b/Projectiles/SHPB.cs index a4980edad5..dd10e1620c 100644 --- a/Projectiles/SHPB.cs +++ b/Projectiles/SHPB.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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(); - } - return; - } - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + } + return; + } + } + + 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 diff --git a/Projectiles/SHPExplosion.cs b/Projectiles/SHPExplosion.cs index 961bdca53b..80209bcf34 100644 --- a/Projectiles/SHPExplosion.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SHPL.cs b/Projectiles/SHPL.cs index 3ed4ad6db6..8b9d840cc1 100644 --- a/Projectiles/SHPL.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SandBlade.cs b/Projectiles/SandBlade.cs index c0b39d03c5..c233a275c9 100644 --- a/Projectiles/SandBlade.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SandBolt.cs b/Projectiles/SandBolt.cs index f070999e08..1f105b1ced 100644 --- a/Projectiles/SandBolt.cs +++ b/Projectiles/SandBolt.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SandFire.cs b/Projectiles/SandFire.cs index deff91b43b..44730ab46d 100644 --- a/Projectiles/SandFire.cs +++ b/Projectiles/SandFire.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 -{ - 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; - return; - } - } - - 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"), 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), 100); + } + } } \ No newline at end of file diff --git a/Projectiles/SandMark.cs b/Projectiles/SandMark.cs index 631aca34f7..ac09d1b7f5 100644 --- a/Projectiles/SandMark.cs +++ b/Projectiles/SandMark.cs @@ -1,166 +1,166 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/SandTornado.cs b/Projectiles/SandTornado.cs index eefaa1ea18..8c048f17b3 100644 --- a/Projectiles/SandTornado.cs +++ b/Projectiles/SandTornado.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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Sandnado.cs b/Projectiles/Sandnado.cs index 8c9d8183a9..92ac640bd3 100644 --- a/Projectiles/Sandnado.cs +++ b/Projectiles/Sandnado.cs @@ -1,299 +1,299 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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); - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = ownerMinionAttackTargetNPC.whoAmI; - } - } - if (!flag) - { - for (int k = 0; k < 200; k++) - { - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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); + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = ownerMinionAttackTargetNPC.whoAmI; + } + } + if (!flag) + { + for (int k = 0; k < 200; k++) + { + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/SandstormBullet.cs b/Projectiles/SandstormBullet.cs index 5a4aaf2c49..5b905dda43 100644 --- a/Projectiles/SandstormBullet.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SandyWaifu.cs b/Projectiles/SandyWaifu.cs index 90d6af7164..b9b4abe700 100644 --- a/Projectiles/SandyWaifu.cs +++ b/Projectiles/SandyWaifu.cs @@ -1,304 +1,262 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sWaifu = false; - } - if (modPlayer.sWaifu) - { - 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, 32, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - 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; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - 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; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - 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] > 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; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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 ((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; + } + 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 diff --git a/Projectiles/SandyWaifuShark.cs b/Projectiles/SandyWaifuShark.cs index d3ee83bfa5..cbc6e60930 100644 --- a/Projectiles/SandyWaifuShark.cs +++ b/Projectiles/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 -{ - public class SandyWaifuShark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shark"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 120; - projectile.height = 40; - 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 > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SandyWaifuShark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shark"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 120; + projectile.height = 40; + 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 > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + 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 diff --git a/Projectiles/SanguineFlare.cs b/Projectiles/SanguineFlare.cs index 6fc6320850..f10347c2d5 100644 --- a/Projectiles/SanguineFlare.cs +++ b/Projectiles/SanguineFlare.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 -{ - public class SanguineFlare : ModProjectile - { - public int x; - public double speed = 10; - - 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() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - x++; - speed += 0.1; - projectile.velocity.Y = (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) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SanguineFlare : ModProjectile + { + public int x; + public double speed = 10; + + 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() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + x++; + speed += 0.1; + projectile.velocity.Y = (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) + { + 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 diff --git a/Projectiles/SausageMaker.cs b/Projectiles/SausageMaker.cs index b502d4bd7f..7c8cf91e29 100644 --- a/Projectiles/SausageMaker.cs +++ b/Projectiles/SausageMaker.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 -{ - 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; - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ScourgeoftheCosmos.cs b/Projectiles/ScourgeoftheCosmos.cs index cefc3755b5..782227f7fc 100644 --- a/Projectiles/ScourgeoftheCosmos.cs +++ b/Projectiles/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 -{ - public class ScourgeoftheCosmos : ModProjectile - { - public 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.thrown = true; - projectile.melee = false; - } - if (projectile.alpha <= 200) - { - int num3; - for (int num20 = 0; num20 < 2; num20 = num3 + 1) - { - int dustType = (Main.rand.Next(2) == 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] >= 20f) - { - 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.thrown) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), 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(2) == 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(2) == 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.thrown) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ScourgeoftheCosmos : ModProjectile + { + public 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.thrown = true; + projectile.melee = false; + } + if (projectile.alpha <= 200) + { + int num3; + for (int num20 = 0; num20 < 2; num20 = num3 + 1) + { + int dustType = (Main.rand.Next(2) == 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.thrown) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), 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(2) == 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(2) == 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.thrown) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), (float)((int)((double)projectile.knockBack * 0.35)), Main.myPlayer, 0f, 0f); + } + num3 = num627; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ScourgeoftheCosmosMini.cs b/Projectiles/ScourgeoftheCosmosMini.cs index dba0591091..7e5a1cf6cc 100644 --- a/Projectiles/ScourgeoftheCosmosMini.cs +++ b/Projectiles/ScourgeoftheCosmosMini.cs @@ -1,174 +1,174 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class ScourgeoftheCosmosMini : ModProjectile - { - public 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.thrown = true; - projectile.melee = false; - } - 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(2) == 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; - 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; - } - } - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ScourgeoftheCosmosMini : ModProjectile + { + public 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.thrown = true; + projectile.melee = false; + } + 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(2) == 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; + 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; + } + } + } + + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/ScourgeoftheDesert.cs b/Projectiles/ScourgeoftheDesert.cs index 50120d48a6..6edf50f6a4 100644 --- a/Projectiles/ScourgeoftheDesert.cs +++ b/Projectiles/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 -{ - public class ScourgeoftheDesert : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.thrown = true; - projectile.aiStyle = 113; - aiType = 598; - projectile.penetrate = 3; - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class ScourgeoftheDesert : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.thrown = true; + projectile.aiStyle = 113; + aiType = 598; + projectile.penetrate = 3; + } + + 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 diff --git a/Projectiles/SeaDragonRocket.cs b/Projectiles/SeaDragonRocket.cs index cbdd43a8f4..9b513aeee1 100644 --- a/Projectiles/SeaDragonRocket.cs +++ b/Projectiles/SeaDragonRocket.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 -{ - 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; - return; - } - } - - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/SeaDragonRocket.png b/Projectiles/SeaDragonRocket.png index d653d4d1ac..2c1206e1ee 100644 Binary files a/Projectiles/SeaDragonRocket.png and b/Projectiles/SeaDragonRocket.png differ diff --git a/Projectiles/Seashell.cs b/Projectiles/Seashell.cs index 0a64a75cfa..93f1d3f677 100644 --- a/Projectiles/Seashell.cs +++ b/Projectiles/Seashell.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SeashellBoomerangProjectile.cs b/Projectiles/SeashellBoomerangProjectile.cs index 25d613f238..7e8df28c0c 100644 --- a/Projectiles/SeashellBoomerangProjectile.cs +++ b/Projectiles/SeashellBoomerangProjectile.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 600; + 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 diff --git a/Projectiles/SeashellBoomerangProjectileMelee.cs b/Projectiles/SeashellBoomerangProjectileMelee.cs index f1be931bec..3c25addca9 100644 --- a/Projectiles/SeashellBoomerangProjectileMelee.cs +++ b/Projectiles/SeashellBoomerangProjectileMelee.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 600; - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 600; + 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 diff --git a/Projectiles/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/SeethingDischargeBrimstoneBarrage.cs new file mode 100644 index 0000000000..41c49cc86b --- /dev/null +++ b/Projectiles/SeethingDischargeBrimstoneBarrage.cs @@ -0,0 +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 +{ + 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 diff --git a/Projectiles/SeethingDischargeBrimstoneBarrage.png b/Projectiles/SeethingDischargeBrimstoneBarrage.png new file mode 100644 index 0000000000..ed87c1d91e Binary files /dev/null and b/Projectiles/SeethingDischargeBrimstoneBarrage.png differ diff --git a/Projectiles/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/SeethingDischargeBrimstoneHellblast.cs new file mode 100644 index 0000000000..0eb92dc71e --- /dev/null +++ b/Projectiles/SeethingDischargeBrimstoneHellblast.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SeethingDischargeBrimstoneHellblast.png b/Projectiles/SeethingDischargeBrimstoneHellblast.png new file mode 100644 index 0000000000..f9de3e2ae9 Binary files /dev/null and b/Projectiles/SeethingDischargeBrimstoneHellblast.png differ diff --git a/Projectiles/ShadeFire.cs b/Projectiles/ShadeFire.cs index 3e2f74cbe4..287c314f65 100644 --- a/Projectiles/ShadeFire.cs +++ b/Projectiles/ShadeFire.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 -{ - 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 ((num297 == 14 && 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; - if (num297 == 14) - { - 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; - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 14 && 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; + if (num297 == 14) + { + 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; + return; + } + } } \ No newline at end of file diff --git a/Projectiles/ShadeNimbus.cs b/Projectiles/ShadeNimbus.cs index 1a1f54abc2..d27b82d341 100644 --- a/Projectiles/ShadeNimbus.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ShadeNimbusCloud.cs b/Projectiles/ShadeNimbusCloud.cs index 7fc4f8c3ce..0fc5d2d855 100644 --- a/Projectiles/ShadeNimbusCloud.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ShadecrystalProjectile.cs b/Projectiles/ShadecrystalProjectile.cs index 5a15a5e0f4..4879b0fa50 100644 --- a/Projectiles/ShadecrystalProjectile.cs +++ b/Projectiles/ShadecrystalProjectile.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 -{ - 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(); - return; - } - } - } - - 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, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/Shaderain.cs b/Projectiles/Shaderain.cs index 0245135f83..af248b3d8c 100644 --- a/Projectiles/Shaderain.cs +++ b/Projectiles/Shaderain.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 -{ - 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; - return; - } - - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + + 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 diff --git a/Projectiles/Shadowbolt.cs b/Projectiles/Shadowbolt.cs index bfcb6ee942..6a6fafe133 100644 --- a/Projectiles/Shadowbolt.cs +++ b/Projectiles/Shadowbolt.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 -{ - 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.25f); - 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.1f); - } - - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.25f); + 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.1f); + } + + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/ShiftingSands.cs b/Projectiles/ShiftingSands.cs index 5193231e7a..260471a8f4 100644 --- a/Projectiles/ShiftingSands.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/ShimmersparkProjectile.cs b/Projectiles/ShimmersparkProjectile.cs index 9ad18eb591..d438474dbc 100644 --- a/Projectiles/ShimmersparkProjectile.cs +++ b/Projectiles/ShimmersparkProjectile.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 -{ - 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 star = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].ranged = false; - Main.projectile[star].melee = true; - } - } - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 star = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].ranged = false; + Main.projectile[star].melee = true; + } + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/Shockblast.cs b/Projectiles/Shockblast.cs index f34587e257..c9bb21d204 100644 --- a/Projectiles/Shockblast.cs +++ b/Projectiles/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 -{ - 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.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++; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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++; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/ShockblastRound.cs b/Projectiles/ShockblastRound.cs index 617b07e315..3b0823ea7f 100644 --- a/Projectiles/ShockblastRound.cs +++ b/Projectiles/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 -{ - 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; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("TransfusionTrail"), 0, 0f, projectile.owner, (float)num2, num); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + 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 diff --git a/Projectiles/ShortBeam.cs b/Projectiles/ShortBeam.cs index 4c324244e6..ebc08ec44b 100644 --- a/Projectiles/ShortBeam.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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 diff --git a/Projectiles/ShortNightBeam.cs b/Projectiles/ShortNightBeam.cs index 50e4e86475..5f0b251c50 100644 --- a/Projectiles/ShortNightBeam.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.1f) / 255f, ((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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.1f) / 255f, ((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 diff --git a/Projectiles/ShortTerraBeam.cs b/Projectiles/ShortTerraBeam.cs index 25d55effae..a52b495270 100644 --- a/Projectiles/ShortTerraBeam.cs +++ b/Projectiles/ShortTerraBeam.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 -{ - 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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) - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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) + { + 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 diff --git a/Projectiles/Shroom.cs b/Projectiles/Shroom.cs index a4ef1b545e..a809cc713f 100644 --- a/Projectiles/Shroom.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Sickness.cs b/Projectiles/Sickness.cs index f84ab596af..14d64dc03a 100644 --- a/Projectiles/Sickness.cs +++ b/Projectiles/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 -{ - 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.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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 120); + } + } } \ No newline at end of file diff --git a/Projectiles/SicknessRound.cs b/Projectiles/SicknessRound.cs index d968ef05cb..f032aef467 100644 --- a/Projectiles/SicknessRound.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SicknessRound2.cs b/Projectiles/SicknessRound2.cs index 9c208a7c9a..2b6e80398d 100644 --- a/Projectiles/SicknessRound2.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SilvaCrystal.cs b/Projectiles/SilvaCrystal.cs index 53d4df0bd9..1271c18036 100644 --- a/Projectiles/SilvaCrystal.cs +++ b/Projectiles/SilvaCrystal.cs @@ -1,217 +1,217 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class SilvaCrystal : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.sentry = true; - projectile.penetrate = -1; - } - - public override void AI() - { - 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; - NPC ownerMinionAttackTargetNPC6 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC6 != null && ownerMinionAttackTargetNPC6.CanBeChasedBy(projectile, false)) - { - float num1076 = projectile.Distance(ownerMinionAttackTargetNPC6.Center); - if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, ownerMinionAttackTargetNPC6.Center, 0, 0)) - { - num1075 = num1076; - num1074 = ownerMinionAttackTargetNPC6.whoAmI; - } - } - if (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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SilvaCrystal : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Crystal"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.sentry = true; + projectile.penetrate = -1; + } + + public override void AI() + { + 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; + NPC ownerMinionAttackTargetNPC6 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC6 != null && ownerMinionAttackTargetNPC6.CanBeChasedBy(projectile, false)) + { + float num1076 = projectile.Distance(ownerMinionAttackTargetNPC6.Center); + if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, ownerMinionAttackTargetNPC6.Center, 0, 0)) + { + num1075 = num1076; + num1074 = ownerMinionAttackTargetNPC6.whoAmI; + } + } + if (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; + } + } } \ No newline at end of file diff --git a/Projectiles/SilvaCrystalExplosion.cs b/Projectiles/SilvaCrystalExplosion.cs index cdf8e0a4d4..abb078c052 100644 --- a/Projectiles/SilvaCrystalExplosion.cs +++ b/Projectiles/SilvaCrystalExplosion.cs @@ -1,235 +1,235 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/SilvaOrb.cs b/Projectiles/SilvaOrb.cs index f3d8a06fad..4d4c073eb7 100644 --- a/Projectiles/SilvaOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SirenLure.cs b/Projectiles/SirenLure.cs index 8e5832997b..d77c507147 100644 --- a/Projectiles/SirenLure.cs +++ b/Projectiles/SirenLure.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 -{ - public class SirenLure : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Lure"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 120; - projectile.height = 120; - 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.sentry = true; - } - - 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) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.slWaifu = false; - } - if (modPlayer.slWaifu) - { - projectile.timeLeft = 2; - } - } - 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, 33, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - dust--; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - 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; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - 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); - int damage = NPC.downedMoonlord ? 200 : 80; - float damageMult = CalamityWorld.downedDoG ? 2f : 1f; - 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, (int)((float)damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 12f; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SirenLure : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Lure"); + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 120; + projectile.height = 120; + 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.sentry = true; + } + + 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) + { + 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--; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 1.5f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + 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; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + 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); + int damage = NPC.downedMoonlord ? 200 : 80; + float damageMult = CalamityWorld.downedDoG ? 2f : 1f; + 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, (int)((float)damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 12f; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SirenSongFriendly.cs b/Projectiles/SirenSongFriendly.cs index 750cd33e23..fcb1774b93 100644 --- a/Projectiles/SirenSongFriendly.cs +++ b/Projectiles/SirenSongFriendly.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 -{ - 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; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 26); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 26); + } + } + } } \ No newline at end of file diff --git a/Projectiles/SirenYoung.cs b/Projectiles/SirenYoung.cs index 68275a95b4..0a2755f183 100644 --- a/Projectiles/SirenYoung.cs +++ b/Projectiles/SirenYoung.cs @@ -1,207 +1,207 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class SirenYoung : ModProjectile - { - 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() - { - 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 - } - 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; - } - float num23 = 0.2f; - float num24 = 5f; - projectile.tileCollide = false; - Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; - float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; - if (Main.player[projectile.owner].controlLeft) - { - num25 -= 120f; - } - else if (Main.player[projectile.owner].controlRight) - { - num25 += 120f; - } - if (Main.player[projectile.owner].controlDown) - { - num26 += 120f; - } - else - { - if (Main.player[projectile.owner].controlUp) - { - num26 -= 120f; - } - num26 -= 60f; - } - float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); - if (num27 > 1000f) - { - projectile.position.X = projectile.position.X + num25; - projectile.position.Y = projectile.position.Y + num26; - } - if (projectile.localAI[0] == 1f) - { - if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) - { - projectile.localAI[0] = 0f; - } - num24 = 12f; - if (num27 < num24) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - } - else - { - num27 = num24 / num27; - projectile.velocity.X = num25 * num27; - projectile.velocity.Y = num26 * num27; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - return; - } - if (num27 > 200f) - { - projectile.localAI[0] = 1f; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - if (num27 < 10f) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - projectile.rotation = projectile.velocity.X * 0.05f; - if (num27 < num24) - { - projectile.position += projectile.velocity; - projectile.velocity *= 0f; - num23 = 0f; - } - projectile.direction = -Main.player[projectile.owner].direction; - } - num27 = num24 / num27; - num25 *= num27; - num26 *= num27; - if (projectile.velocity.X < num25) - { - projectile.velocity.X = projectile.velocity.X + num23; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.X > num25) - { - projectile.velocity.X = projectile.velocity.X - num23; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.Y < num26) - { - projectile.velocity.Y = projectile.velocity.Y + num23; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.Y > num26) - { - projectile.velocity.Y = projectile.velocity.Y - num23; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = projectile.velocity.X * 0.05f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SirenYoung : ModProjectile + { + 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() + { + 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 + } + 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; + } + float num23 = 0.2f; + float num24 = 5f; + projectile.tileCollide = false; + Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; + float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; + if (Main.player[projectile.owner].controlLeft) + { + num25 -= 120f; + } + else if (Main.player[projectile.owner].controlRight) + { + num25 += 120f; + } + if (Main.player[projectile.owner].controlDown) + { + num26 += 120f; + } + else + { + if (Main.player[projectile.owner].controlUp) + { + num26 -= 120f; + } + num26 -= 60f; + } + float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); + if (num27 > 1000f) + { + projectile.position.X = projectile.position.X + num25; + projectile.position.Y = projectile.position.Y + num26; + } + if (projectile.localAI[0] == 1f) + { + if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) + { + projectile.localAI[0] = 0f; + } + num24 = 12f; + if (num27 < num24) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + } + else + { + num27 = num24 / num27; + projectile.velocity.X = num25 * num27; + projectile.velocity.Y = num26 * num27; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + return; + } + return; + } + if (num27 > 200f) + { + projectile.localAI[0] = 1f; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + if (num27 < 10f) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + projectile.rotation = projectile.velocity.X * 0.05f; + if (num27 < num24) + { + projectile.position += projectile.velocity; + projectile.velocity *= 0f; + num23 = 0f; + } + projectile.direction = -Main.player[projectile.owner].direction; + } + num27 = num24 / num27; + num25 *= num27; + num26 *= num27; + if (projectile.velocity.X < num25) + { + projectile.velocity.X = projectile.velocity.X + num23; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.X > num25) + { + projectile.velocity.X = projectile.velocity.X - num23; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.Y < num26) + { + projectile.velocity.Y = projectile.velocity.Y + num23; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.Y > num26) + { + projectile.velocity.Y = projectile.velocity.Y - num23; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = projectile.velocity.X * 0.05f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/SirensSong.cs b/Projectiles/SirensSong.cs index c9714e56d6..5e7d2d0549 100644 --- a/Projectiles/SirensSong.cs +++ b/Projectiles/SirensSong.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 -{ - 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; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(BuffID.Confused, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + } + } + + 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 diff --git a/Projectiles/SkyFlare.cs b/Projectiles/SkyFlare.cs index e0a13e7f84..472a09a1fb 100644 --- a/Projectiles/SkyFlare.cs +++ b/Projectiles/SkyFlare.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 -{ - public class SkyFlare : ModProjectile - { - public int blowTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SkyFlare : ModProjectile + { + public int blowTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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 diff --git a/Projectiles/SkyFlareFriendly.cs b/Projectiles/SkyFlareFriendly.cs index b6b948a187..af74a42bdb 100644 --- a/Projectiles/SkyFlareFriendly.cs +++ b/Projectiles/SkyFlareFriendly.cs @@ -1,173 +1,173 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.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), 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 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 < 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 < 70; 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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), 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 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 < 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 < 70; 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 diff --git a/Projectiles/SlagRound.cs b/Projectiles/SlagRound.cs index e6b9d6e0b8..96e6ef3eb9 100644 --- a/Projectiles/SlagRound.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SlashRound.cs b/Projectiles/SlashRound.cs index 5c100d5a54..49686579a5 100644 --- a/Projectiles/SlashRound.cs +++ b/Projectiles/SlashRound.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 -{ - 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) - { - if (Main.rand.Next(10) == 0) - { - target.AddBuff(mod.BuffType("Shred"), 360); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + if (Main.rand.Next(10) == 0) + { + target.AddBuff(mod.BuffType("Shred"), 360); + } + } + } } \ No newline at end of file diff --git a/Projectiles/SlimeBolt.cs b/Projectiles/SlimeBolt.cs index 2d10731510..d6f3642330 100644 --- a/Projectiles/SlimeBolt.cs +++ b/Projectiles/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 -{ - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/SlimeGod.cs b/Projectiles/SlimeGod.cs index c9ab2ae164..4fddde1e41 100644 --- a/Projectiles/SlimeGod.cs +++ b/Projectiles/SlimeGod.cs @@ -1,96 +1,96 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 diff --git a/Projectiles/SlimeGodAlt.cs b/Projectiles/SlimeGodAlt.cs index 90013935c4..bc20d5c726 100644 --- a/Projectiles/SlimeGodAlt.cs +++ b/Projectiles/SlimeGodAlt.cs @@ -1,96 +1,96 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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) - { - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + 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; + } + 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 diff --git a/Projectiles/Snowflake.cs b/Projectiles/Snowflake.cs index 772ed9eb8e..df5a795dd0 100644 --- a/Projectiles/Snowflake.cs +++ b/Projectiles/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 -{ - 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, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/SolarBeam.cs b/Projectiles/SolarBeam.cs index c00fcd3356..8d5403d3a1 100644 --- a/Projectiles/SolarBeam.cs +++ b/Projectiles/SolarBeam.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 -{ - 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; - } - return; - } - } - - public override void Kill(int timeLeft) - { - 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].melee = false; - Main.projectile[boom].minion = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void Kill(int timeLeft) + { + 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].melee = false; + Main.projectile[boom].minion = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/SolarBeam2.cs b/Projectiles/SolarBeam2.cs index 74e41a7bac..d3c9b06af0 100644 --- a/Projectiles/SolarBeam2.cs +++ b/Projectiles/SolarBeam2.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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 4; - 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].melee = false; - Main.projectile[boom].magic = true; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + 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].melee = false; + Main.projectile[boom].magic = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/SolarFlare.cs b/Projectiles/SolarFlare.cs index fc1d2f47ff..f8341e44dd 100644 --- a/Projectiles/SolarFlare.cs +++ b/Projectiles/SolarFlare.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 -{ - 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.penetrate = 1; - projectile.alpha = 150; - projectile.melee = true; - projectile.timeLeft = 120; - } - - public override void AI() - { - 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"), 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.penetrate = 1; + projectile.alpha = 150; + projectile.melee = true; + projectile.timeLeft = 120; + } + + public override void AI() + { + 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"), 200); + } + } } \ No newline at end of file diff --git a/Projectiles/SolarFlareYoyo.cs b/Projectiles/SolarFlareYoyo.cs index 4c1ad2eae3..f6f761de65 100644 --- a/Projectiles/SolarFlareYoyo.cs +++ b/Projectiles/SolarFlareYoyo.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 -{ - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/SolarGod.cs b/Projectiles/SolarGod.cs index 432d820128..310a9bd40d 100644 --- a/Projectiles/SolarGod.cs +++ b/Projectiles/SolarGod.cs @@ -1,123 +1,123 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class SolarGod : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar God"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[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) - { - 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 (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; - 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; //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 = 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"), (int)(60f * player.minionDamage), projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 50f; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SolarGod : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar God"); + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[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) + { + 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 (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; + 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; //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 = 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"), (int)(60f * player.minionDamage), projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 50f; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SolarPixie.cs b/Projectiles/SolarPixie.cs index 7bbccb2fe0..f99cbf59d3 100644 --- a/Projectiles/SolarPixie.cs +++ b/Projectiles/SolarPixie.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 -{ - public class SolarPixie : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Pixie"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[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) - { - 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 (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; - 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; //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 = 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, (int)(6f * player.minionDamage), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[beam].magic = false; - Main.projectile[beam].minion = true; - projectile.ai[0] = 50f; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SolarPixie : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Pixie"); + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[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) + { + 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 (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; + 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; //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 = 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, (int)(6f * player.minionDamage), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[beam].magic = false; + Main.projectile[beam].minion = true; + projectile.ai[0] = 50f; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SolsticeBeam.cs b/Projectiles/SolsticeBeam.cs index 9a213b4508..e311099699 100644 --- a/Projectiles/SolsticeBeam.cs +++ b/Projectiles/SolsticeBeam.cs @@ -1,208 +1,208 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - 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; - if (CalamityWorld.spring) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 74, - 157, - 107 - }); - } - else if (CalamityWorld.summer) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - } - else if (CalamityWorld.fall) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - } - else if (CalamityWorld.winter) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - } - 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; - if (CalamityWorld.spring) - { - red = 0; - green = 250; - blue = 0; - } - else if (CalamityWorld.summer) - { - red = 250; - green = 250; - blue = 0; - } - else if (CalamityWorld.fall) - { - red = 250; - green = 150; - blue = 50; - } - else if (CalamityWorld.winter) - { - red = 100; - green = 150; - blue = 250; - } - 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; - if (CalamityWorld.spring) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 245, - 157, - 107 - }); - } - else if (CalamityWorld.summer) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - } - else if (CalamityWorld.fall) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - } - else if (CalamityWorld.winter) - { - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - } - 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) - { - 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 Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + 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; + if (CalamityWorld.spring) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 74, + 157, + 107 + }); + } + else if (CalamityWorld.summer) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + } + else if (CalamityWorld.fall) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + } + else if (CalamityWorld.winter) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + } + 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; + if (CalamityWorld.spring) + { + red = 0; + green = 250; + blue = 0; + } + else if (CalamityWorld.summer) + { + red = 250; + green = 250; + blue = 0; + } + else if (CalamityWorld.fall) + { + red = 250; + green = 150; + blue = 50; + } + else if (CalamityWorld.winter) + { + red = 100; + green = 150; + blue = 250; + } + 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; + if (CalamityWorld.spring) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 245, + 157, + 107 + }); + } + else if (CalamityWorld.summer) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + } + else if (CalamityWorld.fall) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + } + else if (CalamityWorld.winter) + { + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + } + 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) + { + if (Main.dayTime) + { + target.AddBuff(BuffID.Daybreak, 300); + } + else + { + target.AddBuff(mod.BuffType("Nightwither"), 300); + } + } + } } \ No newline at end of file diff --git a/Projectiles/SoulPiercer.cs b/Projectiles/SoulPiercer.cs index 953c2b3dfd..45594071fc 100644 --- a/Projectiles/SoulPiercer.cs +++ b/Projectiles/SoulPiercer.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 -{ - 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 = 180; - } - - public override void AI() - { - if (Main.rand.Next(5) == 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("SoulPiercerOrb"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - 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), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 180; + } + + public override void AI() + { + if (Main.rand.Next(5) == 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("SoulPiercerOrb"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + 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), 1f); + 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 diff --git a/Projectiles/SoulPiercerBolt.cs b/Projectiles/SoulPiercerBolt.cs index 1fb200e2fa..7a227c379b 100644 --- a/Projectiles/SoulPiercerBolt.cs +++ b/Projectiles/SoulPiercerBolt.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 -{ - 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 = 60; - projectile.magic = true; - } - - public override void AI() - { - 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, 173, 0f, 0f, 0, default(Color), 1f); - 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; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 60; + projectile.magic = true; + } + + public override void AI() + { + 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, 173, 0f, 0f, 0, default(Color), 1f); + 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; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/SoulPiercerOrb.cs b/Projectiles/SoulPiercerOrb.cs index 570e112443..342ed03b57 100644 --- a/Projectiles/SoulPiercerOrb.cs +++ b/Projectiles/SoulPiercerOrb.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 -{ - public class SoulPiercerOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piercer"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.scale = 0.75f; - 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 (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; - } - 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 = 600f; - 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("SoulPiercerBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SoulPiercerOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercer"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.scale = 0.75f; + 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 (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; + } + 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 = 600f; + 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("SoulPiercerBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SoulScythe.cs b/Projectiles/SoulScythe.cs index 4fdbefff63..4416e60a78 100644 --- a/Projectiles/SoulScythe.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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, 200); - target.AddBuff(mod.BuffType("Plague"), 200); - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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, 200); + target.AddBuff(mod.BuffType("Plague"), 200); + 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 diff --git a/Projectiles/Spark.cs b/Projectiles/Spark.cs index 7867bf8101..f262158970 100644 --- a/Projectiles/Spark.cs +++ b/Projectiles/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 -{ - 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 = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.1f; - } - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.velocity.X = projectile.velocity.X * -0.5f; - } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) - { - projectile.velocity.X = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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; - return; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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; + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/SparkInfernal.cs b/Projectiles/SparkInfernal.cs index 21d960b6a8..7a846d0e33 100644 --- a/Projectiles/SparkInfernal.cs +++ b/Projectiles/SparkInfernal.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SpatialLanceProjectile.cs b/Projectiles/SpatialLanceProjectile.cs index c40ef17c32..e66b96e4c3 100644 --- a/Projectiles/SpatialLanceProjectile.cs +++ b/Projectiles/SpatialLanceProjectile.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 -{ - 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, 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"), 300); - target.AddBuff(mod.BuffType("GlacialState"), 300); - target.AddBuff(mod.BuffType("Plague"), 300); - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, 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"), 300); + target.AddBuff(mod.BuffType("GlacialState"), 300); + target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } } \ No newline at end of file diff --git a/Projectiles/SpatialSpear.cs b/Projectiles/SpatialSpear.cs index f6ae8e460c..46ce08f4e3 100644 --- a/Projectiles/SpatialSpear.cs +++ b/Projectiles/SpatialSpear.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 -{ - public class SpatialSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - 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("SpatialSpear2"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpatialSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + 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("SpatialSpear2"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SpatialSpear2.cs b/Projectiles/SpatialSpear2.cs index 3f7629faab..ee3a06de16 100644 --- a/Projectiles/SpatialSpear2.cs +++ b/Projectiles/SpatialSpear2.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 -{ - public class SpatialSpear2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - 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, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); - target.AddBuff(mod.BuffType("GlacialState"), 60); - target.AddBuff(mod.BuffType("Plague"), 60); - target.AddBuff(mod.BuffType("HolyLight"), 60); - 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("SpatialSpear3"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpatialSpear2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + 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, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); + target.AddBuff(mod.BuffType("GlacialState"), 60); + target.AddBuff(mod.BuffType("Plague"), 60); + target.AddBuff(mod.BuffType("HolyLight"), 60); + 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("SpatialSpear3"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SpatialSpear3.cs b/Projectiles/SpatialSpear3.cs index 6e44df2735..510f026d81 100644 --- a/Projectiles/SpatialSpear3.cs +++ b/Projectiles/SpatialSpear3.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 -{ - public class SpatialSpear3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 30); - target.AddBuff(mod.BuffType("GlacialState"), 30); - target.AddBuff(mod.BuffType("Plague"), 30); - target.AddBuff(mod.BuffType("HolyLight"), 30); - 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("SpatialSpear4"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpatialSpear3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 30); + target.AddBuff(mod.BuffType("GlacialState"), 30); + target.AddBuff(mod.BuffType("Plague"), 30); + target.AddBuff(mod.BuffType("HolyLight"), 30); + 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("SpatialSpear4"), (int)((double)projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/SpatialSpear4.cs b/Projectiles/SpatialSpear4.cs index 2880feecb5..393d8ef0c8 100644 --- a/Projectiles/SpatialSpear4.cs +++ b/Projectiles/SpatialSpear4.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 -{ - public class SpatialSpear4 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 30; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpatialSpear4 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 30; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + } + } } \ No newline at end of file diff --git a/Projectiles/SpearofPaleolith.cs b/Projectiles/SpearofPaleolith.cs index c93d975550..884a9a431d 100644 --- a/Projectiles/SpearofPaleolith.cs +++ b/Projectiles/SpearofPaleolith.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 -{ - public class SpearofPaleolith : ModProjectile - { - public int shardRainTimer = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - 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) - { - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[shard].ranged = false; - Main.projectile[shard].thrown = true; - } - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpearofPaleolith : ModProjectile + { + public int shardRainTimer = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + 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) + { + int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[shard].ranged = false; + Main.projectile[shard].thrown = true; + } + 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 diff --git a/Projectiles/SpiritFlameCurse.cs b/Projectiles/SpiritFlameCurse.cs index 4b430d61ce..82edc40025 100644 --- a/Projectiles/SpiritFlameCurse.cs +++ b/Projectiles/SpiritFlameCurse.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 -{ - public class SpiritFlameCurse : 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.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 > 3) - { - 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class SpiritFlameCurse : 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.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 > 3) + { + 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/SporeBomb.cs b/Projectiles/SporeBomb.cs index dd76c4adda..ca281877c3 100644 --- a/Projectiles/SporeBomb.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Spyker.cs b/Projectiles/Spyker.cs index 91a6011681..d3190e1f6d 100644 --- a/Projectiles/Spyker.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/StandingFire.cs b/Projectiles/StandingFire.cs index 381ff9667e..d3bd8cf189 100644 --- a/Projectiles/StandingFire.cs +++ b/Projectiles/StandingFire.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 -{ - 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; - return; - } - } - - 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"), 160); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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"), 160); + } + } } \ No newline at end of file diff --git a/Projectiles/StarCrystal.cs b/Projectiles/StarCrystal.cs index eac3c4ec9e..7c2a0e32bb 100644 --- a/Projectiles/StarCrystal.cs +++ b/Projectiles/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 -{ - 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), (float)((int)((double)projectile.knockBack * 0.15)), Main.myPlayer, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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), (float)((int)((double)projectile.knockBack * 0.15)), 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 diff --git a/Projectiles/Starblast.cs b/Projectiles/Starblast.cs index e04c05e86d..6c36b3f03c 100644 --- a/Projectiles/Starblast.cs +++ b/Projectiles/Starblast.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 -{ - 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(); - return; - } - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + 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 diff --git a/Projectiles/StarfleetMK2.cs b/Projectiles/StarfleetMK2.cs index 59ece50642..5b906a5448 100644 --- a/Projectiles/StarfleetMK2.cs +++ b/Projectiles/StarfleetMK2.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 -{ - public class StarfleetMK2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starmada"); - } - - public override void SetDefaults() - { - projectile.width = 98; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); - Player player = Main.player[projectile.owner]; - projectile.ai[1]--; - if (projectile.ai[0] >= 0f) - { - projectile.ai[0] += 1f; - switch ((int)projectile.ai[0]) - { - case 90: - case 180: - case 270: - case 360: - case 450: projectile.localAI[0] += 1f; break; - case 540: - projectile.localAI[0] += 1f; - projectile.ai[0] = -1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; - vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 221, 0f, 0f, 0, default(Color), 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - break; - } - } - int baseUseTime = 27; - int modifier = 2; - bool timeToFire = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; - timeToFire = true; - } - bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canFire) - { - projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.position); - } - player.phantasmTime = 2; - if (timeToFire && Main.myPlayer == projectile.owner) - { - if (canFire) - { - int type = 12; - float scaleFactor = 16f; - int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float knockBack = player.inventory[player.selectedItem].knockBack; - player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); - for (int i = 0; i < 5; i++) - { - knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); - Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.velocity = Main.screenPosition - playerPosition; - projectile.velocity.X += Main.mouseX; - projectile.velocity.Y += Main.mouseY; - if (player.gravDir == -1f) - projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); - switch (Main.rand.Next(5)) - { - case 0: type = mod.ProjectileType("PlasmaBlast"); break; - case 1: type = mod.ProjectileType("AstralStar"); break; - case 2: type = mod.ProjectileType("GalacticaComet"); break; - case 3: break; - case 4: type = 9; break; - } - int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].ranged = true; - Main.projectile[star].magic = false; - Main.projectile[star].melee = false; - Main.projectile[star].netUpdate = true; - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += 3.14159274f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); - } - - public override bool CanDamage() - { - return false; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class StarfleetMK2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starmada"); + } + + public override void SetDefaults() + { + projectile.width = 98; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); + Player player = Main.player[projectile.owner]; + projectile.ai[1]--; + if (projectile.ai[0] >= 0f) + { + projectile.ai[0] += 1f; + switch ((int)projectile.ai[0]) + { + case 90: + case 180: + case 270: + case 360: + case 450: projectile.localAI[0] += 1f; break; + case 540: + projectile.localAI[0] += 1f; + projectile.ai[0] = -1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; + vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 221, 0f, 0f, 0, default(Color), 4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + break; + } + } + int baseUseTime = 27; + int modifier = 2; + bool timeToFire = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + timeToFire = true; + } + bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.soundDelay <= 0 && canFire) + { + projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; + if (projectile.ai[0] != 1f) + Main.PlaySound(SoundID.Item92, projectile.position); + } + player.phantasmTime = 2; + if (timeToFire && Main.myPlayer == projectile.owner) + { + if (canFire) + { + int type = 12; + float scaleFactor = 16f; + int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float knockBack = player.inventory[player.selectedItem].knockBack; + player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + for (int i = 0; i < 5; i++) + { + knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.velocity = Main.screenPosition - playerPosition; + projectile.velocity.X += Main.mouseX; + projectile.velocity.Y += Main.mouseY; + if (player.gravDir == -1f) + projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; + projectile.velocity.Normalize(); + float variation = (1f + projectile.localAI[0]) * 3f; + Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); + Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + switch (Main.rand.Next(5)) + { + case 0: type = mod.ProjectileType("PlasmaBlast"); break; + case 1: type = mod.ProjectileType("AstralStar"); break; + case 2: type = mod.ProjectileType("GalacticaComet"); break; + case 3: break; + case 4: type = 9; break; + } + int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].penetrate = 1; + Main.projectile[star].timeLeft = 300; + Main.projectile[star].ranged = true; + Main.projectile[star].magic = false; + Main.projectile[star].melee = false; + Main.projectile[star].netUpdate = true; + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (projectile.spriteDirection == -1) + projectile.rotation += 3.14159274f; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + } + + public override bool CanDamage() + { + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/StarnightBeam.cs b/Projectiles/StarnightBeam.cs index 497a25f6c7..3935e1df93 100644 --- a/Projectiles/StarnightBeam.cs +++ b/Projectiles/StarnightBeam.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 -{ - 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 = 1; - projectile.timeLeft = 600; - aiType = 156; - } - - 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 (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) - { - 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.Frostburn, 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 +{ + 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 = 1; + projectile.timeLeft = 600; + aiType = 156; + } + + 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 (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) + { + 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.Frostburn, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/StarnightLanceProjectile.cs b/Projectiles/StarnightLanceProjectile.cs index 5c1c017b48..e7ad4f37f7 100644 --- a/Projectiles/StarnightLanceProjectile.cs +++ b/Projectiles/StarnightLanceProjectile.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 -{ - 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("StarnightBeam"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.95f; - } - - if(Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Frostburn, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("StarnightBeam"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.95f; + } + + if(Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if(projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Frostburn, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/StickyFeather.cs b/Projectiles/StickyFeather.cs index bfd4754bd3..c8a05915ff 100644 --- a/Projectiles/StickyFeather.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/StickyFeatherAero.cs b/Projectiles/StickyFeatherAero.cs index 8967e0b8dd..15b1b968cb 100644 --- a/Projectiles/StickyFeatherAero.cs +++ b/Projectiles/StickyFeatherAero.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 -{ - 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; - return; - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/StormBeam.cs b/Projectiles/StormBeam.cs index 8a7f353cb3..a90b7ff53a 100644 --- a/Projectiles/StormBeam.cs +++ b/Projectiles/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 -{ - 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, ((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); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((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); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/StormBolt.cs b/Projectiles/StormBolt.cs index 9138162631..b9c89fd769 100644 --- a/Projectiles/StormBolt.cs +++ b/Projectiles/StormBolt.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/StormMark.cs b/Projectiles/StormMark.cs index a4b29c1a46..dca92c30a5 100644 --- a/Projectiles/StormMark.cs +++ b/Projectiles/StormMark.cs @@ -1,161 +1,161 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - - 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(); - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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(); + 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 diff --git a/Projectiles/StormMarkHostile.cs b/Projectiles/StormMarkHostile.cs index c0aee8cbbe..52a6fc64ce 100644 --- a/Projectiles/StormMarkHostile.cs +++ b/Projectiles/StormMarkHostile.cs @@ -1,164 +1,164 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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(); - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + 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 diff --git a/Projectiles/StormMarkSummon.cs b/Projectiles/StormMarkSummon.cs index 3c97524237..6d94d7e10f 100644 --- a/Projectiles/StormMarkSummon.cs +++ b/Projectiles/StormMarkSummon.cs @@ -1,166 +1,166 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/StormRuler.cs b/Projectiles/StormRuler.cs index 7a1f3d6158..aa19761659 100644 --- a/Projectiles/StormRuler.cs +++ b/Projectiles/StormRuler.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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() - { - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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 diff --git a/Projectiles/StormSurge.cs b/Projectiles/StormSurge.cs index f627bce999..2d7b2f9860 100644 --- a/Projectiles/StormSurge.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/StreamGouge.cs b/Projectiles/StreamGouge.cs index d16b1d7ce1..ae82f37f2b 100644 --- a/Projectiles/StreamGouge.cs +++ b/Projectiles/StreamGouge.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 -{ - 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 * 1f, projectile.velocity.Y * 1f, mod.ProjectileType("EssenceBeam"), (int)((double)projectile.damage * 2f), 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 * 1f, projectile.velocity.Y * 1f, mod.ProjectileType("EssenceBeam"), (int)((double)projectile.damage * 2f), 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/SulphuricAcidCannon.cs b/Projectiles/SulphuricAcidCannon.cs index 82e1780ff2..361603124d 100644 --- a/Projectiles/SulphuricAcidCannon.cs +++ b/Projectiles/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 -{ - 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.Poisoned, 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.Poisoned, 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 diff --git a/Projectiles/SulphuricAcidCannon2.cs b/Projectiles/SulphuricAcidCannon2.cs index 5f5c784d76..fffe53f79b 100644 --- a/Projectiles/SulphuricAcidCannon2.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SulphuricAcidMist.cs b/Projectiles/SulphuricAcidMist.cs index ad84893b17..a2ae2b3396 100644 --- a/Projectiles/SulphuricAcidMist.cs +++ b/Projectiles/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 -{ - 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.Poisoned, 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.Poisoned, 120); + } + } } \ No newline at end of file diff --git a/Projectiles/SulphuricAcidMist2.cs b/Projectiles/SulphuricAcidMist2.cs index 199f51ceb1..6fd529ad4e 100644 --- a/Projectiles/SulphuricAcidMist2.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SunlightBlade.cs b/Projectiles/SunlightBlade.cs index 8f1ceba901..51046494b9 100644 --- a/Projectiles/SunlightBlade.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.01f) / 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("HolyLight"), 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.01f) / 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("HolyLight"), 300); + } + } } \ No newline at end of file diff --git a/Projectiles/SuperballBullet.cs b/Projectiles/SuperballBullet.cs index 7cda9ec0b9..1737523ad9 100644 --- a/Projectiles/SuperballBullet.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/SupremeDustFlakProjectile.cs b/Projectiles/SupremeDustFlakProjectile.cs index f2f1c95ab9..6c65c201e0 100644 --- a/Projectiles/SupremeDustFlakProjectile.cs +++ b/Projectiles/SupremeDustFlakProjectile.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 -{ - 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.timeLeft > 150) - { - projectile.timeLeft = 150; - } - 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; - if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; - if (num297 == 75) - { - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; - if (num297 == 75) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.timeLeft > 150) + { + projectile.timeLeft = 150; + } + 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; + if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; + if (num297 == 75) + { + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + if (Main.rand.Next(1) == 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 ((num297 == 32 && 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; + if (num297 == 75) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } } \ No newline at end of file diff --git a/Projectiles/SupremeDustProjectile.cs b/Projectiles/SupremeDustProjectile.cs index 596b7d6035..b0a014da10 100644 --- a/Projectiles/SupremeDustProjectile.cs +++ b/Projectiles/SupremeDustProjectile.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 -{ - 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.timeLeft > 200) - { - projectile.timeLeft = 200; - } - 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 ((num297 == 32 && 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; - if (num297 == 75) - { - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - 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 ((num297 == 32 && 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; - if (num297 == 75) - { - Main.dust[num399].velocity += projectile.velocity; - if (!Main.dust[num399].noGravity) - { - Main.dust[num399].velocity *= 0.5f; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - return; - } - - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.timeLeft > 200) + { + projectile.timeLeft = 200; + } + 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 ((num297 == 32 && 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; + if (num297 == 75) + { + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + 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 ((num297 == 32 && 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; + if (num297 == 75) + { + Main.dust[num399].velocity += projectile.velocity; + if (!Main.dust[num399].noGravity) + { + Main.dust[num399].velocity *= 0.5f; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + return; + } + + 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 diff --git a/Projectiles/T1000.cs b/Projectiles/T1000.cs index 10b2589c27..b01018bee8 100644 --- a/Projectiles/T1000.cs +++ b/Projectiles/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 -{ - 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)); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/T1000Laser.cs b/Projectiles/T1000Laser.cs index b3b150cb57..cfc90a08fe 100644 --- a/Projectiles/T1000Laser.cs +++ b/Projectiles/T1000Laser.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 -{ - 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(); - return; - } - } - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + } + + 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 diff --git a/Projectiles/TarraEnergy.cs b/Projectiles/TarraEnergy.cs index 54b203540f..f12c8f391c 100644 --- a/Projectiles/TarraEnergy.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TarragonThrowingDartProjectile.cs b/Projectiles/TarragonThrowingDartProjectile.cs index f436d27097..d7ebc71565 100644 --- a/Projectiles/TarragonThrowingDartProjectile.cs +++ b/Projectiles/TarragonThrowingDartProjectile.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 -{ - 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.thrown = true; - projectile.penetrate = 3; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - 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; - target.AddBuff(BuffID.CursedInferno, 200); - target.AddBuff(BuffID.OnFire, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 3; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + 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; + target.AddBuff(BuffID.CursedInferno, 200); + target.AddBuff(BuffID.OnFire, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/TealExoArrow.cs b/Projectiles/TealExoArrow.cs index 91998b1f27..8222ff013b 100644 --- a/Projectiles/TealExoArrow.cs +++ b/Projectiles/TealExoArrow.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 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(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 = 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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 diff --git a/Projectiles/TearsofHeavenProjectile.cs b/Projectiles/TearsofHeavenProjectile.cs index 280fd36494..77ff24a4d4 100644 --- a/Projectiles/TearsofHeavenProjectile.cs +++ b/Projectiles/TearsofHeavenProjectile.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(mod.BuffType("HolyLight"), 1000); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(mod.BuffType("HolyLight"), 1000); + } + } } \ No newline at end of file diff --git a/Projectiles/TelluricGlare.cs b/Projectiles/TelluricGlare.cs index 8be3035d7a..1b0fec02a5 100644 --- a/Projectiles/TelluricGlare.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TemporalFloeSwordProjectile.cs b/Projectiles/TemporalFloeSwordProjectile.cs index 92f00c148b..076ef88422 100644 --- a/Projectiles/TemporalFloeSwordProjectile.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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 diff --git a/Projectiles/TerraArrow.cs b/Projectiles/TerraArrow.cs index 5645317dcb..52e61ca7f3 100644 --- a/Projectiles/TerraArrow.cs +++ b/Projectiles/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 -{ - 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.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; - } - } - 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("TerraArrow2"), (int)((double)projectile.damage * 0.66), 0f, projectile.owner, 0f, 0f); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + } + } + 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("TerraArrow2"), (int)((double)projectile.damage * 0.66), 0f, projectile.owner, 0f, 0f); + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/TerraArrow2.cs b/Projectiles/TerraArrow2.cs index bc0205ade9..3013410105 100644 --- a/Projectiles/TerraArrow2.cs +++ b/Projectiles/TerraArrow2.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 -{ - 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.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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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 diff --git a/Projectiles/TerraBall.cs b/Projectiles/TerraBall.cs index d21b30d119..707e1638ae 100644 --- a/Projectiles/TerraBall.cs +++ b/Projectiles/TerraBall.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 -{ - 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; - return; - } - } - - 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, 400); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 400); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallB.cs b/Projectiles/TerraBallB.cs index 6c91ef6ac2..f33ff96148 100644 --- a/Projectiles/TerraBallB.cs +++ b/Projectiles/TerraBallB.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 -{ - 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; - return; - } - } - - 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, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 300); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallG.cs b/Projectiles/TerraBallG.cs index b88514dc15..859761fa86 100644 --- a/Projectiles/TerraBallG.cs +++ b/Projectiles/TerraBallG.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 -{ - 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; - return; - } - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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 diff --git a/Projectiles/TerraBallI.cs b/Projectiles/TerraBallI.cs index 0353980fb7..76e8c9e98a 100644 --- a/Projectiles/TerraBallI.cs +++ b/Projectiles/TerraBallI.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 -{ - 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; - return; - } - } - - 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, 250); - target.AddBuff(BuffID.Frostburn, 50); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 250); + target.AddBuff(BuffID.Frostburn, 50); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallO.cs b/Projectiles/TerraBallO.cs index 9714498867..bcdb8fda4a 100644 --- a/Projectiles/TerraBallO.cs +++ b/Projectiles/TerraBallO.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 -{ - 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; - return; - } - } - - 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, 200); - target.AddBuff(BuffID.Ichor, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 200); + target.AddBuff(BuffID.Ichor, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallR.cs b/Projectiles/TerraBallR.cs index 3450f6232d..d294ba5967 100644 --- a/Projectiles/TerraBallR.cs +++ b/Projectiles/TerraBallR.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 -{ - 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; - return; - } - } - - 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, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 300); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallV.cs b/Projectiles/TerraBallV.cs index e451669f6f..58f478acfc 100644 --- a/Projectiles/TerraBallV.cs +++ b/Projectiles/TerraBallV.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 -{ - 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; - return; - } - } - - 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, 150); - target.AddBuff(BuffID.OnFire, 150); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 150); + target.AddBuff(BuffID.OnFire, 150); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBallY.cs b/Projectiles/TerraBallY.cs index 672c4186f9..9656d50183 100644 --- a/Projectiles/TerraBallY.cs +++ b/Projectiles/TerraBallY.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 -{ - 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; - return; - } - } - - 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, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 300); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraBolt.cs b/Projectiles/TerraBolt.cs index 04f4badd81..5bb4cea455 100644 --- a/Projectiles/TerraBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerraBolt2.cs b/Projectiles/TerraBolt2.cs index d25278c003..4a4b6050be 100644 --- a/Projectiles/TerraBolt2.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerraBullet.cs b/Projectiles/TerraBullet.cs index cc2c0b4a88..fe5c0ab5ad 100644 --- a/Projectiles/TerraBullet.cs +++ b/Projectiles/TerraBullet.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 -{ - 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.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] >= 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, 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) - { - 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("TerraBulletSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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] >= 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, 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) + { + 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("TerraBulletSplit"), (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 diff --git a/Projectiles/TerraBulletSplit.cs b/Projectiles/TerraBulletSplit.cs index 3905c6fdd0..7f97345e59 100644 --- a/Projectiles/TerraBulletSplit.cs +++ b/Projectiles/TerraBulletSplit.cs @@ -1,135 +1,135 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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() - { - 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, 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + 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, 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 diff --git a/Projectiles/TerraEdgeBeam.cs b/Projectiles/TerraEdgeBeam.cs index 00c05d4d66..ec42e50dde 100644 --- a/Projectiles/TerraEdgeBeam.cs +++ b/Projectiles/TerraEdgeBeam.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 -{ - 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - int healAmount = (Main.rand.Next(2) + 1); - target.AddBuff(BuffID.Ichor, 60); - Player player = Main.player[projectile.owner]; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + int healAmount = (Main.rand.Next(2) + 1); + target.AddBuff(BuffID.Ichor, 60); + Player player = Main.player[projectile.owner]; + player.statLife += healAmount; + player.HealEffect(healAmount); + } + + 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 diff --git a/Projectiles/TerraFireBlue.cs b/Projectiles/TerraFireBlue.cs index 296c69cb0c..610abe2038 100644 --- a/Projectiles/TerraFireBlue.cs +++ b/Projectiles/TerraFireBlue.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 -{ - 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 ((num297 == 66 && 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; - if (num297 == 66) - { - Main.dust[num299].velocity += projectile.velocity; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 240); - target.AddBuff(BuffID.Frostburn, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 66 && 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; + if (num297 == 66) + { + Main.dust[num299].velocity += projectile.velocity; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 240); + target.AddBuff(BuffID.Frostburn, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraFireGreen.cs b/Projectiles/TerraFireGreen.cs index 90d84e4422..a63780de14 100644 --- a/Projectiles/TerraFireGreen.cs +++ b/Projectiles/TerraFireGreen.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 -{ - 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 = 74; - 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 ((num297 == 74 && 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; - if (num297 == 74) - { - 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; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 500); - target.AddBuff(BuffID.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 74; + 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 ((num297 == 74 && 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; + if (num297 == 74) + { + 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; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.CursedInferno, 500); + target.AddBuff(BuffID.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraFireGreen2.cs b/Projectiles/TerraFireGreen2.cs index 8f594ee7d7..0f25f4cbf9 100644 --- a/Projectiles/TerraFireGreen2.cs +++ b/Projectiles/TerraFireGreen2.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 -{ - 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 ((num297 == 66 && 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; - if (num297 == 66) - { - Main.dust[num299].velocity += projectile.velocity; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 500); - target.AddBuff(mod.BuffType("Plague"), 240); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 66 && 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; + if (num297 == 66) + { + Main.dust[num299].velocity += projectile.velocity; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 500); + target.AddBuff(mod.BuffType("Plague"), 240); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraFireRed.cs b/Projectiles/TerraFireRed.cs index 4c087c0080..684958204b 100644 --- a/Projectiles/TerraFireRed.cs +++ b/Projectiles/TerraFireRed.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 -{ - 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 ((num297 == 66 && 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; - if (num297 == 66) - { - Main.dust[num299].velocity += projectile.velocity; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - target.AddBuff(BuffID.OnFire, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 ((num297 == 66 && 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; + if (num297 == 66) + { + Main.dust[num299].velocity += projectile.velocity; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + target.AddBuff(BuffID.OnFire, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/TerraLanceProjectile.cs b/Projectiles/TerraLanceProjectile.cs index 70611da6fa..a578549b88 100644 --- a/Projectiles/TerraLanceProjectile.cs +++ b/Projectiles/TerraLanceProjectile.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 -{ - 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, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if(projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if(Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X * projectile.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85f), 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if(projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if(Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X * projectile.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85f), 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 diff --git a/Projectiles/TerraOrb.cs b/Projectiles/TerraOrb.cs index baa4325cb2..a76bfb2616 100644 --- a/Projectiles/TerraOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerraOrb2.cs b/Projectiles/TerraOrb2.cs index 82c912ae00..3289f09e43 100644 --- a/Projectiles/TerraOrb2.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerraRay.cs b/Projectiles/TerraRay.cs index 54a05386a4..60b5b60f10 100644 --- a/Projectiles/TerraRay.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerraSpear.cs b/Projectiles/TerraSpear.cs index d6cee919f3..7cc0a2b7be 100644 --- a/Projectiles/TerraSpear.cs +++ b/Projectiles/TerraSpear.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 -{ - public class TerraSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (Main.rand.Next(3) == 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 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.immune[projectile.owner] = 5; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class TerraSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (Main.rand.Next(3) == 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 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.immune[projectile.owner] = 5; + } + } } \ No newline at end of file diff --git a/Projectiles/Terracotta.cs b/Projectiles/Terracotta.cs index eeeb2d9502..9e460aa3c4 100644 --- a/Projectiles/Terracotta.cs +++ b/Projectiles/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 -{ - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TerracottaExplosion.cs b/Projectiles/TerracottaExplosion.cs index 71814f096a..84b3a58c44 100644 --- a/Projectiles/TerracottaExplosion.cs +++ b/Projectiles/TerracottaExplosion.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 -{ - 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, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.35f) / 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, 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.35f) / 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, 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++; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } } \ No newline at end of file diff --git a/Projectiles/TerratomereProjectile.cs b/Projectiles/TerratomereProjectile.cs index add56ce014..730f03ad52 100644 --- a/Projectiles/TerratomereProjectile.cs +++ b/Projectiles/TerratomereProjectile.cs @@ -1,116 +1,116 @@ -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 -{ - 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; - return; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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) - { - if (Main.rand.Next(3) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - target.AddBuff(BuffID.CursedInferno, 1120); - target.AddBuff(BuffID.Frostburn, 660); - target.AddBuff(BuffID.OnFire, 800); - target.AddBuff(BuffID.Ichor, 300); - if (target.type == NPCID.TargetDummy) - { - return; - } - int healAmount = Main.rand.Next(2); - Player player = Main.player[projectile.owner]; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - 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; - } - } - } +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 +{ + 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; + return; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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) + { + if (Main.rand.Next(3) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + target.AddBuff(BuffID.CursedInferno, 1120); + target.AddBuff(BuffID.Frostburn, 660); + target.AddBuff(BuffID.OnFire, 800); + target.AddBuff(BuffID.Ichor, 300); + if (target.type == NPCID.TargetDummy) + { + return; + } + int healAmount = Main.rand.Next(2); + Player player = Main.player[projectile.owner]; + player.statLife += healAmount; + player.HealEffect(healAmount); + } + + 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 diff --git a/Projectiles/TerrorBeam.cs b/Projectiles/TerrorBeam.cs index 59c21eed70..28f3bdc9a7 100644 --- a/Projectiles/TerrorBeam.cs +++ b/Projectiles/TerrorBeam.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 -{ - public class TerrorBeam : ModProjectile - { - 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 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; - return; - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class TerrorBeam : ModProjectile + { + 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 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; + return; + } + + 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 diff --git a/Projectiles/TerrorBoom.cs b/Projectiles/TerrorBoom.cs index 4a52a382f3..0c98c9eb54 100644 --- a/Projectiles/TerrorBoom.cs +++ b/Projectiles/TerrorBoom.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 -{ - 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; - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/TheEyeofCalamitasProjectile.cs b/Projectiles/TheEyeofCalamitasProjectile.cs index 28145c5307..5c38cee05b 100644 --- a/Projectiles/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/TheEyeofCalamitasProjectile.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 -{ - 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.5f), projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - - public override void OnHitNPC(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.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.5f), projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } } \ No newline at end of file diff --git a/Projectiles/TheGodsGambitProjectile.cs b/Projectiles/TheGodsGambitProjectile.cs index 2ee8d5d421..2cc3631c3a 100644 --- a/Projectiles/TheGodsGambitProjectile.cs +++ b/Projectiles/TheGodsGambitProjectile.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 -{ - 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() - { - if (Main.rand.Next(8) == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 406, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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() + { + if (Main.rand.Next(8) == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 406, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/TheObliterator.cs b/Projectiles/TheObliterator.cs index e4d87c02c1..f035ff3d67 100644 --- a/Projectiles/TheObliterator.cs +++ b/Projectiles/TheObliterator.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 -{ - public class TheObliterator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Obliterator"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1f; - 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; - int projChoice = Main.rand.Next(2); - if (projChoice == 0) - { - projChoice = mod.ProjectileType("NebulaShot"); - } - else - { - projChoice = mod.ProjectileType("IceBeam"); - } - if (projectile.owner == Main.myPlayer) - { - int shoot = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, projChoice, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[shoot].ranged = false; - Main.projectile[shoot].melee = true; - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class TheObliterator : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Obliterator"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1f; + 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; + int projChoice = Main.rand.Next(2); + if (projChoice == 0) + { + projChoice = mod.ProjectileType("NebulaShot"); + } + else + { + projChoice = mod.ProjectileType("IceBeam"); + } + if (projectile.owner == Main.myPlayer) + { + int shoot = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, projChoice, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[shoot].ranged = false; + Main.projectile[shoot].melee = true; + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/ThePlaguebringer.cs b/Projectiles/ThePlaguebringer.cs index a924006b6c..10011268ed 100644 --- a/Projectiles/ThePlaguebringer.cs +++ b/Projectiles/ThePlaguebringer.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 -{ - 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.5f), projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.5f), projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + } } \ No newline at end of file diff --git a/Projectiles/TinyCrystal.cs b/Projectiles/TinyCrystal.cs index 5a8baf1ec9..221c8bccbc 100644 --- a/Projectiles/TinyCrystal.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TinyFlare.cs b/Projectiles/TinyFlare.cs index 6ebd640b1b..4d96e43d4c 100644 --- a/Projectiles/TinyFlare.cs +++ b/Projectiles/TinyFlare.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 -{ - 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; - } - - 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, 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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, 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } } \ No newline at end of file diff --git a/Projectiles/TitRail.cs b/Projectiles/TitRail.cs index 21271eda9f..1288552a28 100644 --- a/Projectiles/TitRail.cs +++ b/Projectiles/TitRail.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 -{ - 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].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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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].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 diff --git a/Projectiles/TitaniumShurikenProjectile.cs b/Projectiles/TitaniumShurikenProjectile.cs index d63c624e36..7f6dfed80f 100644 --- a/Projectiles/TitaniumShurikenProjectile.cs +++ b/Projectiles/TitaniumShurikenProjectile.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class TitaniumShurikenProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shuriken"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class TitaniumShurikenProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shuriken"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.scale = 0.75f; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/ToothBallProjectile.cs b/Projectiles/ToothBallProjectile.cs index 2ba1f0b5d2..161d476609 100644 --- a/Projectiles/ToothBallProjectile.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/Tornado.cs b/Projectiles/Tornado.cs index 2edc2b2a3c..b60660b067 100644 --- a/Projectiles/Tornado.cs +++ b/Projectiles/Tornado.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 -{ - 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 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/TornadoHostile.cs b/Projectiles/TornadoHostile.cs index f74b91b311..c202fdc67c 100644 --- a/Projectiles/TornadoHostile.cs +++ b/Projectiles/TornadoHostile.cs @@ -1,172 +1,172 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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; - } - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + 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 diff --git a/Projectiles/TorrentialArrow.cs b/Projectiles/TorrentialArrow.cs index ba425739fa..a3fa331171 100644 --- a/Projectiles/TorrentialArrow.cs +++ b/Projectiles/TorrentialArrow.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 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(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 = 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 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(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 = 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 diff --git a/Projectiles/ToxicMinnowCloud.cs b/Projectiles/ToxicMinnowCloud.cs index 55ada1de09..05e5c7bebb 100644 --- a/Projectiles/ToxicMinnowCloud.cs +++ b/Projectiles/ToxicMinnowCloud.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 -{ - 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; - return; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - return; - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Poisoned, 300); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 300); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + return; + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 300); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 300); + } + } } \ No newline at end of file diff --git a/Projectiles/TradewindsProjectile.cs b/Projectiles/TradewindsProjectile.cs index 9a9cb780f1..e66598bd9b 100644 --- a/Projectiles/TradewindsProjectile.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TransfusionTrail.cs b/Projectiles/TransfusionTrail.cs index 5c4ef3a141..3cb32acbc7 100644 --- a/Projectiles/TransfusionTrail.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TriactisOPHammer.cs b/Projectiles/TriactisOPHammer.cs index 5cd9320231..6dae9c007e 100644 --- a/Projectiles/TriactisOPHammer.cs +++ b/Projectiles/TriactisOPHammer.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 -{ - 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.thrown = 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = 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 diff --git a/Projectiles/TriactisOPHammerMelee.cs b/Projectiles/TriactisOPHammerMelee.cs index 7256e4d176..94eabccc12 100644 --- a/Projectiles/TriactisOPHammerMelee.cs +++ b/Projectiles/TriactisOPHammerMelee.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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Triploon.cs b/Projectiles/Triploon.cs index 8dd88676c8..e1d4d3de61 100644 --- a/Projectiles/Triploon.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TrueBattleSpawn.cs b/Projectiles/TrueBattleSpawn.cs index ca4272765f..e37e142dc4 100644 --- a/Projectiles/TrueBattleSpawn.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TrueBiomeOrb.cs b/Projectiles/TrueBiomeOrb.cs index 27dd4a0c89..432518bcc2 100644 --- a/Projectiles/TrueBiomeOrb.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TrueCausticEdgeProjectile.cs b/Projectiles/TrueCausticEdgeProjectile.cs index c51859e694..8705f595d3 100644 --- a/Projectiles/TrueCausticEdgeProjectile.cs +++ b/Projectiles/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 -{ - 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.01f) / 255f, ((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 diff --git a/Projectiles/Tumbleweed.cs b/Projectiles/Tumbleweed.cs index 867431a888..57e19d2a07 100644 --- a/Projectiles/Tumbleweed.cs +++ b/Projectiles/Tumbleweed.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; - -namespace CalamityMod.Projectiles -{ - 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; - } - - 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + + 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 diff --git a/Projectiles/TumbleweedRolling.cs b/Projectiles/TumbleweedRolling.cs index 8153e3caba..c5b60d5939 100644 --- a/Projectiles/TumbleweedRolling.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TyphonsGreed.cs b/Projectiles/TyphonsGreed.cs index 2391957933..39e929e8ce 100644 --- a/Projectiles/TyphonsGreed.cs +++ b/Projectiles/TyphonsGreed.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 -{ - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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"), 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 < 6; 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 < 10; 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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"), 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 < 6; 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 < 10; 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 diff --git a/Projectiles/TyphonsGreedStaff.cs b/Projectiles/TyphonsGreedStaff.cs index 45c66e61f7..57e90c5985 100644 --- a/Projectiles/TyphonsGreedStaff.cs +++ b/Projectiles/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 -{ - 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] >= 24f) - { - 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"), (int)((double)projectile.damage * 0.7), 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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] >= 24f) + { + 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"), (int)((double)projectile.damage * 0.7), 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 diff --git a/Projectiles/TyphoonArrow.cs b/Projectiles/TyphoonArrow.cs index 05d6429b39..0fd62866ab 100644 --- a/Projectiles/TyphoonArrow.cs +++ b/Projectiles/TyphoonArrow.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/TyphoonBubble.cs b/Projectiles/TyphoonBubble.cs index dcece716b7..d252243901 100644 --- a/Projectiles/TyphoonBubble.cs +++ b/Projectiles/TyphoonBubble.cs @@ -1,121 +1,121 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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(); - return; - } - } - - 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; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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(); + return; + } + } + + 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 diff --git a/Projectiles/UberBubble.cs b/Projectiles/UberBubble.cs index e8e236f120..b77304f5f5 100644 --- a/Projectiles/UberBubble.cs +++ b/Projectiles/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 -{ - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/UndinesRetribution.cs b/Projectiles/UndinesRetribution.cs index 4672484550..55e1a5d41d 100644 --- a/Projectiles/UndinesRetribution.cs +++ b/Projectiles/UndinesRetribution.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 -{ - 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.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - //projectile.spriteDirection = 1; - 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; - 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; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - 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"), 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 < 6; 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 < 10; 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(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + else + { + //projectile.spriteDirection = 1; + 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; + 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; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + 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"), 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 < 6; 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 < 10; 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 diff --git a/Projectiles/Urchin.cs b/Projectiles/Urchin.cs index b4c95c1462..8ec63ce823 100644 --- a/Projectiles/Urchin.cs +++ b/Projectiles/Urchin.cs @@ -1,151 +1,151 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class Urchin : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin"); - Main.projPet[projectile.type] = true; - 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.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.sentry = true; - } - - 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) - { - 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; - } - } - 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 num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 300f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - 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"), (int)((double)7 * player.minionDamage), 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; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Urchin : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin"); + Main.projPet[projectile.type] = true; + 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.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.sentry = true; + } + + 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) + { + 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; + } + } + 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 num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 300f; + NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + { + float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); + float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); + float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); + if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + { + num508 = num511; + num506 = num509; + num507 = num510; + flag18 = true; + } + } + if (!flag18) + { + for (int num512 = 0; num512 < 200; num512++) + { + if (Main.npc[num512].CanBeChasedBy(projectile, false)) + { + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + { + num508 = num515; + num506 = num513; + num507 = num514; + 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"), (int)((double)7 * player.minionDamage), 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; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/UrchinSpearProjectile.cs b/Projectiles/UrchinSpearProjectile.cs index 735d848207..fa1c6084ca 100644 --- a/Projectiles/UrchinSpearProjectile.cs +++ b/Projectiles/UrchinSpearProjectile.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 -{ - 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] -= 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) - { - target.AddBuff(BuffID.Poisoned, 600); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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] -= 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) + { + target.AddBuff(BuffID.Poisoned, 600); + } + } } \ No newline at end of file diff --git a/Projectiles/UrchinSpike.cs b/Projectiles/UrchinSpike.cs index 16e5e048b4..b872c0e788 100644 --- a/Projectiles/UrchinSpike.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/UrchinSpikeFugu.cs b/Projectiles/UrchinSpikeFugu.cs index bb691868ab..f0fdf5efa8 100644 --- a/Projectiles/UrchinSpikeFugu.cs +++ b/Projectiles/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 -{ - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/UrchinStinger.cs b/Projectiles/UrchinStinger.cs index 8aee8fca09..368bc22220 100644 --- a/Projectiles/UrchinStinger.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 150); - } - - 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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 150); + } + + 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 diff --git a/Projectiles/Valediction.cs b/Projectiles/Valediction.cs index 77a435b0a9..374bc325a0 100644 --- a/Projectiles/Valediction.cs +++ b/Projectiles/Valediction.cs @@ -1,187 +1,187 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.thrown = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } - - 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; - return; - } - } - } - 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; - 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 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + 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; + return; + } + } + } + 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; + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } } \ No newline at end of file diff --git a/Projectiles/Valkyrie.cs b/Projectiles/Valkyrie.cs index 1b6f08dc00..58543d6db5 100644 --- a/Projectiles/Valkyrie.cs +++ b/Projectiles/Valkyrie.cs @@ -1,258 +1,258 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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 = 100; - projectile.height = 100; - 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) - { - 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 ((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; - } - 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; - return; - } - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 = 100; + projectile.height = 100; + 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) + { + 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 ((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; + } + 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; + return; + } + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/VanquisherArrow.cs b/Projectiles/VanquisherArrow.cs index 0d5fc033e2..57bea7c684 100644 --- a/Projectiles/VanquisherArrow.cs +++ b/Projectiles/VanquisherArrow.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 -{ - 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.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"), projectile.damage, 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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"), projectile.damage, 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/VanquisherArrow2.cs b/Projectiles/VanquisherArrow2.cs index 9b1841334e..234bef79a1 100644 --- a/Projectiles/VanquisherArrow2.cs +++ b/Projectiles/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 -{ - 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.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; - return; - } - } - - 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"), 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + return; + } + } + + 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"), 500); + } + } } \ No newline at end of file diff --git a/Projectiles/Vehemence.cs b/Projectiles/Vehemence.cs index 723c38ff07..7504c7f44a 100644 --- a/Projectiles/Vehemence.cs +++ b/Projectiles/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 -{ - public class Vehemence : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vehemence"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - 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 < 6; 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; - } - return; - } - - 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 > 500000) - { - damage = 500000; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.life == target.lifeMax) - { - target.AddBuff(BuffID.ShadowFlame, 1200); - target.AddBuff(BuffID.Ichor, 1200); - target.AddBuff(BuffID.Frostburn, 1200); - target.AddBuff(BuffID.OnFire, 1200); - target.AddBuff(BuffID.Poisoned, 1200); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class Vehemence : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vehemence"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + 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 < 6; 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; + } + return; + } + + 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 > 500000) + { + damage = 500000; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.life == target.lifeMax) + { + target.AddBuff(BuffID.ShadowFlame, 1200); + target.AddBuff(BuffID.Ichor, 1200); + target.AddBuff(BuffID.Frostburn, 1200); + target.AddBuff(BuffID.OnFire, 1200); + target.AddBuff(BuffID.Poisoned, 1200); + } + } + } } \ No newline at end of file diff --git a/Projectiles/VenusianBolt.cs b/Projectiles/VenusianBolt.cs index 284589a172..f8671ad033 100644 --- a/Projectiles/VenusianBolt.cs +++ b/Projectiles/VenusianBolt.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 -{ - 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; - } - return; - } - - 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); - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/VenusianExplosion.cs b/Projectiles/VenusianExplosion.cs index bb34c0ebec..ce1c501150 100644 --- a/Projectiles/VenusianExplosion.cs +++ b/Projectiles/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 -{ - 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, 750); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, 750); + } + } } \ No newline at end of file diff --git a/Projectiles/VenusianFlame.cs b/Projectiles/VenusianFlame.cs index 0ee86080cb..76ac811aa7 100644 --- a/Projectiles/VenusianFlame.cs +++ b/Projectiles/VenusianFlame.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 -{ - 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; - return; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/VerdantProjectile.cs b/Projectiles/VerdantProjectile.cs index 00f4e15647..589514d09b 100644 --- a/Projectiles/VerdantProjectile.cs +++ b/Projectiles/VerdantProjectile.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 -{ - 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) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - return; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + return; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/VeriumBullet.cs b/Projectiles/VeriumBullet.cs index 180d262082..9c0dfc27cc 100644 --- a/Projectiles/VeriumBullet.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/Viscera.cs b/Projectiles/Viscera.cs index ada2a858e8..d75ad642d2 100644 --- a/Projectiles/Viscera.cs +++ b/Projectiles/Viscera.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 -{ - 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.5f; - 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; - } - if (target.type == mod.NPCType("DevourerofGodsBody") || target.type == mod.NPCType("DevourerofGodsBodyS")) - { - healAmt *= 0.5f; - } - healAmt *= 1.5f; - 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; - } - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.5f; + 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; + } + if (target.type == mod.NPCType("DevourerofGodsBody") || target.type == mod.NPCType("DevourerofGodsBodyS")) + { + healAmt *= 0.5f; + } + healAmt *= 1.5f; + 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; + } + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/VividBolt.cs b/Projectiles/VividBolt.cs index fa657bb071..c49ec3f18a 100644 --- a/Projectiles/VividBolt.cs +++ b/Projectiles/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 -{ - 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; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/VividClarity.cs b/Projectiles/VividClarity.cs index 8a13f7e12b..b3b6fef941 100644 --- a/Projectiles/VividClarity.cs +++ b/Projectiles/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 -{ - 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; - } - return; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.damage = (int)((double)projectile.damage * 1.1f); - 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.05f); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.damage = (int)((double)projectile.damage * 1.1f); + 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.05f); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + } } \ No newline at end of file diff --git a/Projectiles/VividOrb.cs b/Projectiles/VividOrb.cs index 308f9d1149..c91def5c3e 100644 --- a/Projectiles/VividOrb.cs +++ b/Projectiles/VividOrb.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 -{ - 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); - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/Voidragon.cs b/Projectiles/Voidragon.cs index f8fb963cca..5bef2d24a3 100644 --- a/Projectiles/Voidragon.cs +++ b/Projectiles/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 -{ - 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); - } - } - } +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 +{ + 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 diff --git a/Projectiles/Vortex.cs b/Projectiles/Vortex.cs index 9f27d31657..cd9ae15dbe 100644 --- a/Projectiles/Vortex.cs +++ b/Projectiles/Vortex.cs @@ -1,194 +1,194 @@ -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 -{ - 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 = 30; - projectile.height = 30; - 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; - return; - } - - 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) - { - if (Main.rand.Next(75) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); - target.AddBuff(mod.BuffType("GlacialState"), 100); - target.AddBuff(mod.BuffType("Plague"), 100); - target.AddBuff(mod.BuffType("HolyLight"), 100); - target.AddBuff(BuffID.CursedInferno, 100); - target.AddBuff(BuffID.Frostburn, 100); - target.AddBuff(BuffID.OnFire, 100); - target.AddBuff(BuffID.Ichor, 100); - } - - 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; - } - } +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 +{ + 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 = 30; + projectile.height = 30; + 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; + return; + } + + 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) + { + if (Main.rand.Next(75) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 100); + target.AddBuff(mod.BuffType("GlacialState"), 100); + target.AddBuff(mod.BuffType("Plague"), 100); + target.AddBuff(mod.BuffType("HolyLight"), 100); + target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Frostburn, 100); + target.AddBuff(BuffID.OnFire, 100); + target.AddBuff(BuffID.Ichor, 100); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/WaterSpearFriendly.cs b/Projectiles/WaterSpearFriendly.cs index d0d6a0b847..203257dce3 100644 --- a/Projectiles/WaterSpearFriendly.cs +++ b/Projectiles/WaterSpearFriendly.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 -{ - 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 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/WaterSpout.cs b/Projectiles/WaterSpout.cs index d53da04c9f..11cabb0aa4 100644 --- a/Projectiles/WaterSpout.cs +++ b/Projectiles/WaterSpout.cs @@ -1,125 +1,125 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - public class WaterSpout : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spout"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 42; - projectile.scale = 0.6f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - int num613 = 10; - 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); - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class WaterSpout : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spout"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 42; + projectile.scale = 0.6f; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + int num613 = 10; + 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); + 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; + } + } } \ No newline at end of file diff --git a/Projectiles/WaterStream.cs b/Projectiles/WaterStream.cs index 40819eb723..49b8be8c33 100644 --- a/Projectiles/WaterStream.cs +++ b/Projectiles/WaterStream.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 -{ - 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; - return; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } } \ No newline at end of file diff --git a/Projectiles/WaterStream2.cs b/Projectiles/WaterStream2.cs index 7bd5a44b76..33cf652eaa 100644 --- a/Projectiles/WaterStream2.cs +++ b/Projectiles/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 -{ - 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; - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/WhiteBoltAura.cs b/Projectiles/WhiteBoltAura.cs index dade66202f..ffb05e7007 100644 --- a/Projectiles/WhiteBoltAura.cs +++ b/Projectiles/WhiteBoltAura.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 -{ - 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; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/WhiteBoltAuraBlah.cs b/Projectiles/WhiteBoltAuraBlah.cs index 17f0f7d90c..737ea35c90 100644 --- a/Projectiles/WhiteBoltAuraBlah.cs +++ b/Projectiles/WhiteBoltAuraBlah.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 -{ - 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; - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + } + } } \ No newline at end of file diff --git a/Projectiles/WhiteFlame.cs b/Projectiles/WhiteFlame.cs index 9ea3266ca7..aa20b41957 100644 --- a/Projectiles/WhiteFlame.cs +++ b/Projectiles/WhiteFlame.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 -{ - 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; - } - return; - } - - 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); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + + 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 diff --git a/Projectiles/WhiteFlame2.cs b/Projectiles/WhiteFlame2.cs index 1d26a534fd..f81b0cb4bc 100644 --- a/Projectiles/WhiteFlame2.cs +++ b/Projectiles/WhiteFlame2.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 -{ - 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.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; - return; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.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; + return; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + } } \ No newline at end of file diff --git a/Projectiles/WhiteOrb.cs b/Projectiles/WhiteOrb.cs index a6818f704a..9ed123a44f 100644 --- a/Projectiles/WhiteOrb.cs +++ b/Projectiles/WhiteOrb.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 -{ - 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, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 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; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 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; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/WhiteOrbBlah.cs b/Projectiles/WhiteOrbBlah.cs index 8a273c7c05..1be8575c54 100644 --- a/Projectiles/WhiteOrbBlah.cs +++ b/Projectiles/WhiteOrbBlah.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 -{ - 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; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/Whiterain.cs b/Projectiles/Whiterain.cs index 03030ec3dc..42396c5705 100644 --- a/Projectiles/Whiterain.cs +++ b/Projectiles/Whiterain.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 -{ - 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, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 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 = 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; - return; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 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 = 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; + return; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/WhiterainBlah.cs b/Projectiles/WhiterainBlah.cs index b0041d64ad..6343ce12e4 100644 --- a/Projectiles/WhiterainBlah.cs +++ b/Projectiles/WhiterainBlah.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 -{ - 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; - return; - } - return; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + return; + } + } } \ No newline at end of file diff --git a/Projectiles/WintersFury.cs b/Projectiles/WintersFury.cs index 0e922eeadc..84c1124966 100644 --- a/Projectiles/WintersFury.cs +++ b/Projectiles/WintersFury.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles -{ - 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.aiStyle = 1; - projectile.timeLeft = 600; - aiType = 1; - } - - 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), 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); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.aiStyle = 1; + projectile.timeLeft = 600; + aiType = 1; + } + + 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), 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 diff --git a/Projectiles/WulfrumBolt.cs b/Projectiles/WulfrumBolt.cs index 880f87cf3c..56362f857c 100644 --- a/Projectiles/WulfrumBolt.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/WulfrumKnife.cs b/Projectiles/WulfrumKnife.cs index 232bca858e..90862f2bd9 100644 --- a/Projectiles/WulfrumKnife.cs +++ b/Projectiles/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 -{ - 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.thrown = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.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")); - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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.thrown = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.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 diff --git a/Projectiles/XerocBlast.cs b/Projectiles/XerocBlast.cs index ce1828b455..b9ca974fe3 100644 --- a/Projectiles/XerocBlast.cs +++ b/Projectiles/XerocBlast.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 -{ - 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++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.OnFire, 120); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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++; + } + return; + } + + 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 diff --git a/Projectiles/XerocBubble.cs b/Projectiles/XerocBubble.cs index 56472503f5..f6c84ed047 100644 --- a/Projectiles/XerocBubble.cs +++ b/Projectiles/XerocBubble.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/XerocFire.cs b/Projectiles/XerocFire.cs index d9ecb39a4c..68cd213c20 100644 --- a/Projectiles/XerocFire.cs +++ b/Projectiles/XerocFire.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 -{ - 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; - return; - } - } - - 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, 160); - target.AddBuff(BuffID.CursedInferno, 160); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + 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, 160); + target.AddBuff(BuffID.CursedInferno, 160); + } + } } \ No newline at end of file diff --git a/Projectiles/XerocHealOrb.cs b/Projectiles/XerocHealOrb.cs index b311ba28b1..f40589a46e 100644 --- a/Projectiles/XerocHealOrb.cs +++ b/Projectiles/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 -{ - 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; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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 diff --git a/Projectiles/XerocOrb.cs b/Projectiles/XerocOrb.cs index b6ac6bbc6c..359a0f6b4d 100644 --- a/Projectiles/XerocOrb.cs +++ b/Projectiles/XerocOrb.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 -{ - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/XerocPitchforkProjectile.cs b/Projectiles/XerocPitchforkProjectile.cs index 7dcd85e995..32db71c8ea 100644 --- a/Projectiles/XerocPitchforkProjectile.cs +++ b/Projectiles/XerocPitchforkProjectile.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 -{ - public class XerocPitchforkProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitchfork"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.thrown = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - target.AddBuff(BuffID.CursedInferno, 500); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class XerocPitchforkProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitchfork"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.thrown = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if(projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + target.AddBuff(BuffID.CursedInferno, 500); + } + } } \ No newline at end of file diff --git a/Projectiles/XerocStar.cs b/Projectiles/XerocStar.cs index 889fab30fb..552215b5e2 100644 --- a/Projectiles/XerocStar.cs +++ b/Projectiles/XerocStar.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 -{ - 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; - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 200); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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; + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 200); + target.AddBuff(BuffID.CursedInferno, 200); + } + } } \ No newline at end of file diff --git a/Projectiles/YharimsCrystal.cs b/Projectiles/YharimsCrystal.cs index e9bf44f9b0..d21985d701 100644 --- a/Projectiles/YharimsCrystal.cs +++ b/Projectiles/YharimsCrystal.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; -using Terraria.Enums; - -namespace CalamityMod.Projectiles -{ - public class YharimsCrystal : 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 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 >= 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("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); - } - } +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 +{ + public class YharimsCrystal : 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 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 >= 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("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 diff --git a/Projectiles/YharimsCrystalBeam.cs b/Projectiles/YharimsCrystalBeam.cs index 2f3b3b706a..b824acd62e 100644 --- a/Projectiles/YharimsCrystalBeam.cs +++ b/Projectiles/YharimsCrystalBeam.cs @@ -1,286 +1,286 @@ -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; -using Terraria.GameContent.Shaders; -using Terraria.Graphics.Effects; - -namespace CalamityMod.Projectiles -{ - 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 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; - } - } +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; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; + +namespace CalamityMod.Projectiles +{ + 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 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 diff --git a/Projectiles/YinYo.cs b/Projectiles/YinYo.cs index 82e3db824d..ccdaf01f9f 100644 --- a/Projectiles/YinYo.cs +++ b/Projectiles/YinYo.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 -{ - 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); - } - } - } - return; - } - } - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + } + } + return; + } + } + } + } } \ No newline at end of file diff --git a/Sounds/Custom/AngryDogGrowl.cs b/Sounds/Custom/AngryDogGrowl.cs index 28934cf2b0..64ecfaa792 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; - } - } +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 diff --git a/Sounds/Custom/CorvinaScream.cs b/Sounds/Custom/CorvinaScream.cs index e1f8af8af4..e902d06701 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; - } - } +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 diff --git a/Sounds/Custom/EidolonWyrmRoarClose.cs b/Sounds/Custom/EidolonWyrmRoarClose.cs index c3e10f492f..b585af18a6 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; - } - } +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 diff --git a/Sounds/Custom/GreatSandSharkRoar.cs b/Sounds/Custom/GreatSandSharkRoar.cs index b95844442d..094df9b943 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; - } - } +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 diff --git a/Sounds/Custom/LegStomp.cs b/Sounds/Custom/LegStomp.cs index 9afe666602..c566334f1f 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; - } - } +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 diff --git a/Sounds/Custom/MaulerRoar.cs b/Sounds/Custom/MaulerRoar.cs index b863e0dd94..c932a0f70d 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 3f0aefb522..36c6c8ccc4 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 37ff2750eb..4aabdc7192 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/WyrmScream.cs b/Sounds/Custom/WyrmScream.cs index 5a3d9c55c2..35be3048ad 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 9709462f83..33a8763e86 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; - } - } +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 diff --git a/Sounds/Custom/YharonRoarShort.cs b/Sounds/Custom/YharonRoarShort.cs new file mode 100644 index 0000000000..bc9c2a565e --- /dev/null +++ b/Sounds/Custom/YharonRoarShort.cs @@ -0,0 +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 diff --git a/Sounds/Custom/YharonRoarShort.wav b/Sounds/Custom/YharonRoarShort.wav new file mode 100644 index 0000000000..05be005cf7 Binary files /dev/null and b/Sounds/Custom/YharonRoarShort.wav differ diff --git a/Sounds/Item/FlareSound.cs b/Sounds/Item/FlareSound.cs index ea8a8c2842..e5f81945a1 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/IronHeartDeath.cs b/Sounds/Item/IronHeartDeath.cs index 73b31868a1..033fadadb3 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; - } - } +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 diff --git a/Sounds/Item/LaserCannon.cs b/Sounds/Item/LaserCannon.cs index a7f08b7159..7c04fe465f 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/OpalStrike.cs b/Sounds/Item/OpalStrike.cs index a706d14c3a..0cf3a22fb7 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 bd773fa994..ebd4573c0d 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 64a791b559..bb4ca65ed9 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/Music/SC1.mp3 b/Sounds/Music/SC1.mp3 index 0684478b82..d3a8a656a3 100644 Binary files a/Sounds/Music/SC1.mp3 and b/Sounds/Music/SC1.mp3 differ diff --git a/Sounds/Music/SC2.mp3 b/Sounds/Music/SC2.mp3 index 8664fa4ec6..196e2f3fa6 100644 Binary files a/Sounds/Music/SC2.mp3 and b/Sounds/Music/SC2.mp3 differ diff --git a/Sounds/Music/SC3.mp3 b/Sounds/Music/SC3.mp3 index bd0afeb102..87a6040b04 100644 Binary files a/Sounds/Music/SC3.mp3 and b/Sounds/Music/SC3.mp3 differ diff --git a/Sounds/Music/SC4.mp3 b/Sounds/Music/SC4.mp3 new file mode 100644 index 0000000000..6906559960 Binary files /dev/null and b/Sounds/Music/SC4.mp3 differ diff --git a/Sounds/Music/TheVoid.mp3 b/Sounds/Music/TheVoid.mp3 new file mode 100644 index 0000000000..161bd7b1b8 Binary files /dev/null and b/Sounds/Music/TheVoid.mp3 differ diff --git a/Sounds/NPCHit/AngryDogHit.cs b/Sounds/NPCHit/AngryDogHit.cs index 3123a60cb2..dfdcf2e07f 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; - } - } +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 diff --git a/Sounds/NPCHit/AstralEnemyHit2.cs b/Sounds/NPCHit/AstralEnemyHit2.cs new file mode 100644 index 0000000000..cc8295a99d --- /dev/null +++ b/Sounds/NPCHit/AstralEnemyHit2.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCHit +{ + public class AstralEnemyHit2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Pan = pan; + soundInstance.Volume = volume * 0.5f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCHit/AstralEnemyHit2.wav b/Sounds/NPCHit/AstralEnemyHit2.wav new file mode 100644 index 0000000000..2918e88011 Binary files /dev/null and b/Sounds/NPCHit/AstralEnemyHit2.wav differ diff --git a/Sounds/NPCHit/AstralEnemyHit3.cs b/Sounds/NPCHit/AstralEnemyHit3.cs new file mode 100644 index 0000000000..facd2d38a6 --- /dev/null +++ b/Sounds/NPCHit/AstralEnemyHit3.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCHit +{ + public class AstralEnemyHit3 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Pan = pan; + soundInstance.Volume = volume * 0.5f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCHit/AstralEnemyHit3.wav b/Sounds/NPCHit/AstralEnemyHit3.wav new file mode 100644 index 0000000000..46a2c10e63 Binary files /dev/null and b/Sounds/NPCHit/AstralEnemyHit3.wav differ diff --git a/Sounds/NPCHit/AstrumAureusHit.cs b/Sounds/NPCHit/AstrumAureusHit.cs index 42e5953511..89c08cfac7 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 * 1f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } +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.4f; //1f + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } } \ No newline at end of file diff --git a/Sounds/NPCHit/AstrumAureusHit.wav b/Sounds/NPCHit/AstrumAureusHit.wav index eff0e1a7b3..32258e0783 100644 Binary files a/Sounds/NPCHit/AstrumAureusHit.wav and b/Sounds/NPCHit/AstrumAureusHit.wav differ diff --git a/Sounds/NPCKilled/AstralEnemyDeath.cs b/Sounds/NPCKilled/AstralEnemyDeath.cs new file mode 100644 index 0000000000..473d6164e8 --- /dev/null +++ b/Sounds/NPCKilled/AstralEnemyDeath.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCDeath +{ + public class AstralEnemyDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Pan = pan; + soundInstance.Volume = volume * 0.7f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCKilled/AstralEnemyDeath.wav b/Sounds/NPCKilled/AstralEnemyDeath.wav new file mode 100644 index 0000000000..d1d9b5981a Binary files /dev/null and b/Sounds/NPCKilled/AstralEnemyDeath.wav differ diff --git a/Sounds/NPCKilled/AtlasDeath.cs b/Sounds/NPCKilled/AtlasDeath.cs new file mode 100644 index 0000000000..a8763a8f13 --- /dev/null +++ b/Sounds/NPCKilled/AtlasDeath.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCDeath +{ + public class AtlasDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Pan = pan; + soundInstance.Volume = volume * 0.65f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCKilled/AtlasDeath.wav b/Sounds/NPCKilled/AtlasDeath.wav new file mode 100644 index 0000000000..ef0d1fbb67 Binary files /dev/null and b/Sounds/NPCKilled/AtlasDeath.wav differ diff --git a/Sounds/NPCKilled/Sunskater.cs b/Sounds/NPCKilled/Sunskater.cs new file mode 100644 index 0000000000..d26a4b2ad4 --- /dev/null +++ b/Sounds/NPCKilled/Sunskater.cs @@ -0,0 +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 diff --git a/Sounds/NPCKilled/Sunskater.wav b/Sounds/NPCKilled/Sunskater.wav new file mode 100644 index 0000000000..cad3914464 Binary files /dev/null and b/Sounds/NPCKilled/Sunskater.wav differ diff --git a/Tiles/AbyssBath.cs b/Tiles/AbyssBath.cs index 5638a6ffd3..1947162d49 100644 --- a/Tiles/AbyssBath.cs +++ b/Tiles/AbyssBath.cs @@ -1,32 +1,32 @@ -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 -{ - class AbyssBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBath")); - } - } -} +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 +{ + class AbyssBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBath")); + } + } +} diff --git a/Tiles/AbyssBed.cs b/Tiles/AbyssBed.cs index 90c8362bb1..340325d5d2 100644 --- a/Tiles/AbyssBed.cs +++ b/Tiles/AbyssBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("AbyssBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("AbyssBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssBed"); + } + } } \ No newline at end of file diff --git a/Tiles/AbyssBookcase.cs b/Tiles/AbyssBookcase.cs index 95d0731424..cf920eb207 100644 --- a/Tiles/AbyssBookcase.cs +++ b/Tiles/AbyssBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class AbyssBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBookcase")); - } - } -} +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 +{ + class AbyssBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssBookcase")); + } + } +} diff --git a/Tiles/AbyssCandelabra.cs b/Tiles/AbyssCandelabra.cs index 9eb0dd957a..e3816f41b0 100644 --- a/Tiles/AbyssCandelabra.cs +++ b/Tiles/AbyssCandelabra.cs @@ -1,85 +1,85 @@ -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 -{ - class AbyssCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AbyssCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AbyssCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AbyssCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AbyssCandle.cs b/Tiles/AbyssCandle.cs index 7fb4164f37..f7d7f73f08 100644 --- a/Tiles/AbyssCandle.cs +++ b/Tiles/AbyssCandle.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class AbyssCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Candle"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("AbyssCandle"); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("AbyssCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class AbyssCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Candle"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("AbyssCandle"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("AbyssCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AbyssChair.cs b/Tiles/AbyssChair.cs index 1db5e85dac..ee3d9af2f3 100644 --- a/Tiles/AbyssChair.cs +++ b/Tiles/AbyssChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AbyssChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AbyssChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssChair")); + } + } } \ No newline at end of file diff --git a/Tiles/AbyssChandelier.cs b/Tiles/AbyssChandelier.cs index c7d8e09c6e..1a1385a1b6 100644 --- a/Tiles/AbyssChandelier.cs +++ b/Tiles/AbyssChandelier.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AbyssChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AbyssChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AbyssChest.cs b/Tiles/AbyssChest.cs index 0139e12633..862d28d0cf 100644 --- a/Tiles/AbyssChest.cs +++ b/Tiles/AbyssChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssChest : 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("Abyss Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Abyss Chest"; - chestDrop = mod.ItemType("AbyssChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Abyss Chest"; - if (player.showItemIconText == "Abyss Chest") - { - player.showItemIcon2 = mod.ItemType("AbyssChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssChest : 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("Abyss Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Abyss Chest"; + chestDrop = mod.ItemType("AbyssChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Abyss Chest"; + if (player.showItemIconText == "Abyss Chest") + { + player.showItemIcon2 = mod.ItemType("AbyssChest"); + 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 diff --git a/Tiles/AbyssClock.cs b/Tiles/AbyssClock.cs index 7c246820f9..74d3a92d26 100644 --- a/Tiles/AbyssClock.cs +++ b/Tiles/AbyssClock.cs @@ -1,105 +1,105 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - animationFrameHeight = 90; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AbyssClock")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssClock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + animationFrameHeight = 90; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AbyssClock")); + } + } } \ No newline at end of file diff --git a/Tiles/AbyssDoorClosed.cs b/Tiles/AbyssDoorClosed.cs index 8a274846e4..e2f875deb1 100644 --- a/Tiles/AbyssDoorClosed.cs +++ b/Tiles/AbyssDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class AbyssDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AbyssDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("AbyssDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class AbyssDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AbyssDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("AbyssDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AbyssDoorOpen.cs b/Tiles/AbyssDoorOpen.cs index fd31cbdc2b..8934d21b72 100644 --- a/Tiles/AbyssDoorOpen.cs +++ b/Tiles/AbyssDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AbyssDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("AbyssDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AbyssDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AbyssDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("AbyssDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AbyssDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AbyssDresser.cs b/Tiles/AbyssDresser.cs index 4a43d55263..f380338a8f 100644 --- a/Tiles/AbyssDresser.cs +++ b/Tiles/AbyssDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AbyssDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AbyssDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "AbyssDresser"; - dresserDrop = mod.ItemType("AbyssDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AbyssDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AbyssDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AbyssDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "AbyssDresser"; + dresserDrop = mod.ItemType("AbyssDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AbyssDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/AbyssGravel.cs b/Tiles/AbyssGravel.cs index 870bd938fe..6825de13f8 100644 --- a/Tiles/AbyssGravel.cs +++ b/Tiles/AbyssGravel.cs @@ -1,44 +1,44 @@ -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 = 64; - 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; - } - - 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); - } - } - } - } +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 = 64; + 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; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/Tiles/AbyssLamp.cs b/Tiles/AbyssLamp.cs index ecd1e6704a..b3d548df0a 100644 --- a/Tiles/AbyssLamp.cs +++ b/Tiles/AbyssLamp.cs @@ -1,85 +1,85 @@ -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 -{ - class AbyssLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AbyssLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AbyssLantern.cs b/Tiles/AbyssLantern.cs index 5cac1a8dc5..999e76867c 100644 --- a/Tiles/AbyssLantern.cs +++ b/Tiles/AbyssLantern.cs @@ -1,83 +1,83 @@ -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 -{ - class AbyssLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AbyssLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AbyssPiano.cs b/Tiles/AbyssPiano.cs index 3137139894..379cc5556a 100644 --- a/Tiles/AbyssPiano.cs +++ b/Tiles/AbyssPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class AbyssPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssPiano")); - } - } -} +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 +{ + class AbyssPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssPiano")); + } + } +} diff --git a/Tiles/AbyssSink.cs b/Tiles/AbyssSink.cs index ecc81a7e7d..945c9d2ec2 100644 --- a/Tiles/AbyssSink.cs +++ b/Tiles/AbyssSink.cs @@ -1,31 +1,31 @@ -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 -{ - class AbyssSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSink")); - } - } -} +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 +{ + class AbyssSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSink")); + } + } +} diff --git a/Tiles/AbyssSofa.cs b/Tiles/AbyssSofa.cs index 09543f46f1..8b19b98824 100644 --- a/Tiles/AbyssSofa.cs +++ b/Tiles/AbyssSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class AbyssSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSofa")); - } - } -} +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 +{ + class AbyssSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssSofa")); + } + } +} diff --git a/Tiles/AbyssTable.cs b/Tiles/AbyssTable.cs index c5eaa20b85..b507cc6b7c 100644 --- a/Tiles/AbyssTable.cs +++ b/Tiles/AbyssTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class AbyssTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class AbyssTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssTable")); + } + } +} diff --git a/Tiles/AbyssTorch.cs b/Tiles/AbyssTorch.cs index 5cb7a9debd..2193db3655 100644 --- a/Tiles/AbyssTorch.cs +++ b/Tiles/AbyssTorch.cs @@ -1,94 +1,94 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssTorch : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; - TileObjectData.addAlternate(2); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.AnchorWall = true; - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Torch"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AbyssTorch"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Torches }; - torch = true; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = Main.rand.Next(1, 3); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - Tile tile = Main.tile[i, j]; - if (tile.frameX < 66) - { - r = 0.9f; - g = 0.9f; - b = 0.9f; - } - } - - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) - { - offsetY = 0; - if (WorldGen.SolidTile(i, j - 1)) - { - offsetY = 2; - if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) - { - offsetY = 4; - } - } - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - ulong randSeed = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)((ulong)i)); - Color color = new Color(100, 100, 100, 0); - int frameX = Main.tile[i, j].frameX; - int frameY = Main.tile[i, j].frameY; - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - for (int k = 0; k < 7; k++) - { - float x = (float)Utils.RandomInt(ref randSeed, -10, 11) * 0.15f; - float y = (float)Utils.RandomInt(ref randSeed, -10, 1) * 0.35f; - } - } - } +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssTorch : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 }; + TileObjectData.addAlternate(2); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AbyssTorch"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Torches }; + torch = true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = Main.rand.Next(1, 3); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.frameX < 66) + { + r = 0.9f; + g = 0.9f; + b = 0.9f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + ulong randSeed = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)((ulong)i)); + Color color = new Color(100, 100, 100, 0); + int frameX = Main.tile[i, j].frameX; + int frameY = Main.tile[i, j].frameY; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + for (int k = 0; k < 7; k++) + { + float x = (float)Utils.RandomInt(ref randSeed, -10, 11) * 0.15f; + float y = (float)Utils.RandomInt(ref randSeed, -10, 1) * 0.35f; + } + } + } } \ No newline at end of file diff --git a/Tiles/AbyssWorkbench.cs b/Tiles/AbyssWorkbench.cs index efcf2f3466..2c1da5f96e 100644 --- a/Tiles/AbyssWorkbench.cs +++ b/Tiles/AbyssWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AbyssWorkbench : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AbyssWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AbyssWorkbench : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AbyssWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index e5ecdfe09a..b4506038bf 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class AerialiteBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileBlendAll[this.Type] = true; - dustType = mod.DustType("AHSparkle"); - drop = mod.ItemType("AerialiteBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Aerialite Brick"); - AddMapEntry(new Color(0, 255, 255), name); - soundType = 21; - } - - 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 AerialiteBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBlendAll[this.Type] = true; + dustType = mod.DustType("AHSparkle"); + drop = mod.ItemType("AerialiteBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Aerialite Brick"); + AddMapEntry(new Color(0, 255, 255), name); + soundType = 21; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/AerialiteOre.cs b/Tiles/AerialiteOre.cs index ae6e116acc..f09d611d49 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 = 64; - 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; - } - } +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 = 64; + 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 diff --git a/Tiles/AncientAltar.cs b/Tiles/AncientAltar.cs index 1587672b69..15beb0cb24 100644 --- a/Tiles/AncientAltar.cs +++ b/Tiles/AncientAltar.cs @@ -1,51 +1,51 @@ -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 -{ - class AncientAltar : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AncientAltar"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientAltar")); - } - } -} +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 +{ + class AncientAltar : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AncientAltar"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientAltar")); + } + } +} diff --git a/Tiles/AncientBasin.cs b/Tiles/AncientBasin.cs index 96881ccf9a..b944be3d71 100644 --- a/Tiles/AncientBasin.cs +++ b/Tiles/AncientBasin.cs @@ -1,101 +1,101 @@ -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 -{ - class AncientBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Basin"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void RightClick(int i, int j) - { - Main.PlaySound(SoundID.Mech, i * 16, j * 16, 0); - HitWire(i, j); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - Tile tile = Main.tile[i, j]; - //227 79 79 - if (tile.frameX < 54) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBasin")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x - 3; l < x + 3; l++) - { - for (int m = y - 3; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - } - } -} +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 +{ + class AncientBasin : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Basin"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void RightClick(int i, int j) + { + Main.PlaySound(SoundID.Mech, i * 16, j * 16, 0); + HitWire(i, j); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + //227 79 79 + if (tile.frameX < 54) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBasin")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x - 3; l < x + 3; l++) + { + for (int m = y - 3; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + } + } +} diff --git a/Tiles/AncientBath.cs b/Tiles/AncientBath.cs index e7e980b3ba..2ff3dfb580 100644 --- a/Tiles/AncientBath.cs +++ b/Tiles/AncientBath.cs @@ -1,32 +1,32 @@ -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 -{ - class AncientBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBath")); - } - } -} +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 +{ + class AncientBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBath")); + } + } +} diff --git a/Tiles/AncientBed.cs b/Tiles/AncientBed.cs index c94c3349fc..99640dd778 100644 --- a/Tiles/AncientBed.cs +++ b/Tiles/AncientBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("AncientBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("AncientBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientBed"); + } + } } \ No newline at end of file diff --git a/Tiles/AncientBookcase.cs b/Tiles/AncientBookcase.cs index 911175afa3..1213a45080 100644 --- a/Tiles/AncientBookcase.cs +++ b/Tiles/AncientBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class AncientBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBookcase")); - } - } -} +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 +{ + class AncientBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientBookcase")); + } + } +} diff --git a/Tiles/AncientChair.cs b/Tiles/AncientChair.cs index e94aafef37..de17139645 100644 --- a/Tiles/AncientChair.cs +++ b/Tiles/AncientChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AncientChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AncientChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientChair")); + } + } } \ No newline at end of file diff --git a/Tiles/AncientChandelier.cs b/Tiles/AncientChandelier.cs index 9993426a14..4913c61d9a 100644 --- a/Tiles/AncientChandelier.cs +++ b/Tiles/AncientChandelier.cs @@ -1,40 +1,40 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AncientChandelier")); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AncientChandelier")); + } + } +} diff --git a/Tiles/AncientDoorClosed.cs b/Tiles/AncientDoorClosed.cs index ea924b7f78..cfb08261b8 100644 --- a/Tiles/AncientDoorClosed.cs +++ b/Tiles/AncientDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class AncientDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AncientDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("AncientDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class AncientDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AncientDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("AncientDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AncientDoorOpen.cs b/Tiles/AncientDoorOpen.cs index beba8f7cf6..66f5df4e24 100644 --- a/Tiles/AncientDoorOpen.cs +++ b/Tiles/AncientDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AncientDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("AncientDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AncientDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AncientDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("AncientDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AncientDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AncientDresser.cs b/Tiles/AncientDresser.cs index e9bac0e3e0..d4e64bf5a0 100644 --- a/Tiles/AncientDresser.cs +++ b/Tiles/AncientDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AncientDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AncientDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "AncientDresser"; - dresserDrop = mod.ItemType("AncientDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AncientDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AncientDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AncientDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AncientDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "AncientDresser"; + dresserDrop = mod.ItemType("AncientDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AncientDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AncientDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/AncientLamp.cs b/Tiles/AncientLamp.cs index aac8307927..8fd3ab1158 100644 --- a/Tiles/AncientLamp.cs +++ b/Tiles/AncientLamp.cs @@ -1,52 +1,52 @@ -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 -{ - class AncientLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientLamp")); - } - } -} +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 +{ + class AncientLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientLamp")); + } + } +} diff --git a/Tiles/AncientLantern.cs b/Tiles/AncientLantern.cs index 68aa276961..29a6941fc7 100644 --- a/Tiles/AncientLantern.cs +++ b/Tiles/AncientLantern.cs @@ -1,35 +1,35 @@ -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 -{ - class AncientLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientLantern")); - } - } -} +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 +{ + class AncientLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientLantern")); + } + } +} diff --git a/Tiles/AncientMonolith.cs b/Tiles/AncientMonolith.cs index 30897c1834..e3cd7c5669 100644 --- a/Tiles/AncientMonolith.cs +++ b/Tiles/AncientMonolith.cs @@ -1,136 +1,136 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientMonolith : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - int animationFrameWidth = 36; - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - uniqueAnimationFrame = (uniqueAnimationFrame % 35) + 1; - - frameXOffset = uniqueAnimationFrame * animationFrameWidth; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 6) - { - frameCounter = 0; - frame++; - if (frame > 35) - { - frame = 1; - } - } - // Above code works, but since we are just mimicking another tile, we can just use the same value. - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AncientMonolith")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientMonolith : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + int animationFrameWidth = 36; + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + uniqueAnimationFrame = (uniqueAnimationFrame % 35) + 1; + + frameXOffset = uniqueAnimationFrame * animationFrameWidth; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 6) + { + frameCounter = 0; + frame++; + if (frame > 35) + { + frame = 1; + } + } + // Above code works, but since we are just mimicking another tile, we can just use the same value. + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AncientMonolith")); + } + } } \ No newline at end of file diff --git a/Tiles/AncientPiano.cs b/Tiles/AncientPiano.cs index ac37064001..3aa2f57f31 100644 --- a/Tiles/AncientPiano.cs +++ b/Tiles/AncientPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class AncientPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientPiano")); - } - } -} +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 +{ + class AncientPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientPiano")); + } + } +} diff --git a/Tiles/AncientSink.cs b/Tiles/AncientSink.cs index dd0a2864e4..f1fdc4e352 100644 --- a/Tiles/AncientSink.cs +++ b/Tiles/AncientSink.cs @@ -1,31 +1,31 @@ -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 -{ - class AncientSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSink")); - } - } -} +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 +{ + class AncientSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSink")); + } + } +} diff --git a/Tiles/AncientSofa.cs b/Tiles/AncientSofa.cs index c21bbf6d5a..2bf3d3e144 100644 --- a/Tiles/AncientSofa.cs +++ b/Tiles/AncientSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class AncientSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSofa")); - } - } -} +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 +{ + class AncientSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientSofa")); + } + } +} diff --git a/Tiles/AncientTable.cs b/Tiles/AncientTable.cs index 21bc2a1d2e..c4828e37c3 100644 --- a/Tiles/AncientTable.cs +++ b/Tiles/AncientTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class AncientTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ancient Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class AncientTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientTable")); + } + } +} diff --git a/Tiles/AncientWorkbench.cs b/Tiles/AncientWorkbench.cs index 0b95f1b386..6cc0454e1b 100644 --- a/Tiles/AncientWorkbench.cs +++ b/Tiles/AncientWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AncientWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AncientWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AncientWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AncientWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/AquaticScourgeMusicbox.cs b/Tiles/AquaticScourgeMusicbox.cs index 8e8e0e9155..654941edc7 100644 --- a/Tiles/AquaticScourgeMusicbox.cs +++ b/Tiles/AquaticScourgeMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AquaticScourgeMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AquaticScourgeMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AquaticScourgeMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AquaticScourgeMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AquaticScourgeMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AquaticScourgeMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index b2ac5689c4..1ace9d5de6 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,37 +1,37 @@ -using Microsoft.Xna.Framework; -using Terraria; -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 ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = (float)Main.DiscoR / 255f; - g = 0f; - b = 0f; - } - } +using Microsoft.Xna.Framework; +using Terraria; +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 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 diff --git a/Tiles/AshenAltar.cs b/Tiles/AshenAltar.cs index 060e0cd184..af3b0bf02d 100644 --- a/Tiles/AshenAltar.cs +++ b/Tiles/AshenAltar.cs @@ -1,51 +1,51 @@ -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 -{ - class AshenAltar : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AshenAltar"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenAltar")); - } - } -} +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 +{ + class AshenAltar : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AshenAltar"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenAltar")); + } + } +} diff --git a/Tiles/AshenBasin.cs b/Tiles/AshenBasin.cs index 3e5fba6aac..49267d90d9 100644 --- a/Tiles/AshenBasin.cs +++ b/Tiles/AshenBasin.cs @@ -1,101 +1,101 @@ -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 -{ - class AshenBasin : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Basin"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void RightClick(int i, int j) - { - Main.PlaySound(SoundID.Mech, i * 16, j * 16, 0); - HitWire(i, j); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - Tile tile = Main.tile[i, j]; - //227 79 79 - if (tile.frameX < 54) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBasin")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x - 3; l < x + 3; l++) - { - for (int m = y - 3; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - } - } -} +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 +{ + class AshenBasin : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Basin"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void RightClick(int i, int j) + { + Main.PlaySound(SoundID.Mech, i * 16, j * 16, 0); + HitWire(i, j); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + //227 79 79 + if (tile.frameX < 54) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBasin")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x - 3; l < x + 3; l++) + { + for (int m = y - 3; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + } + } +} diff --git a/Tiles/AshenBath.cs b/Tiles/AshenBath.cs index 1c7c8d3daa..cf4d3cd884 100644 --- a/Tiles/AshenBath.cs +++ b/Tiles/AshenBath.cs @@ -1,32 +1,32 @@ -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 -{ - class AshenBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBath")); - } - } -} +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 +{ + class AshenBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBath")); + } + } +} diff --git a/Tiles/AshenBed.cs b/Tiles/AshenBed.cs index a06e8fc994..48b25c22cd 100644 --- a/Tiles/AshenBed.cs +++ b/Tiles/AshenBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("AshenBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("AshenBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenBed"); + } + } } \ No newline at end of file diff --git a/Tiles/AshenBookcase.cs b/Tiles/AshenBookcase.cs index 1b6f8ec4f7..223c5dae82 100644 --- a/Tiles/AshenBookcase.cs +++ b/Tiles/AshenBookcase.cs @@ -1,43 +1,43 @@ -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 -{ - class AshenBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 72; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 25; - frameCounter = 0; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBookcase")); - } - } -} +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 +{ + class AshenBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 72; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 25; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenBookcase")); + } + } +} diff --git a/Tiles/AshenCandelabra.cs b/Tiles/AshenCandelabra.cs index cb9d433ae8..361bb6f904 100644 --- a/Tiles/AshenCandelabra.cs +++ b/Tiles/AshenCandelabra.cs @@ -1,96 +1,96 @@ -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 -{ - class AshenCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 36; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AshenCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AshenCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 36; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AshenCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AshenCandle.cs b/Tiles/AshenCandle.cs index 221398e46a..c7503f6a2e 100644 --- a/Tiles/AshenCandle.cs +++ b/Tiles/AshenCandle.cs @@ -1,95 +1,95 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class AshenCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 22; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("AshenCandle"); - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 11; - frameCounter = 0; - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("AshenCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class AshenCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 22; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("AshenCandle"); + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 11; + frameCounter = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("AshenCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AshenChair.cs b/Tiles/AshenChair.cs index c20e0ca924..5e3eed6edb 100644 --- a/Tiles/AshenChair.cs +++ b/Tiles/AshenChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AshenChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AshenChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenChair")); + } + } } \ No newline at end of file diff --git a/Tiles/AshenChandelier.cs b/Tiles/AshenChandelier.cs index 4a5490b4a3..8187582f1b 100644 --- a/Tiles/AshenChandelier.cs +++ b/Tiles/AshenChandelier.cs @@ -1,109 +1,109 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AshenChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("AshenChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AshenChest.cs b/Tiles/AshenChest.cs index bc172f6863..0db69bb744 100644 --- a/Tiles/AshenChest.cs +++ b/Tiles/AshenChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenChest : 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("Ashen Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Ashen Chest"; - chestDrop = mod.ItemType("AshenChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Ashen Chest"; - if (player.showItemIconText == "Ashen Chest") - { - player.showItemIcon2 = mod.ItemType("AshenChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenChest : 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("Ashen Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Ashen Chest"; + chestDrop = mod.ItemType("AshenChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Ashen Chest"; + if (player.showItemIconText == "Ashen Chest") + { + player.showItemIcon2 = mod.ItemType("AshenChest"); + 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 diff --git a/Tiles/AshenChestLocked.cs b/Tiles/AshenChestLocked.cs index 08a6f20850..2cf5a0a78a 100644 --- a/Tiles/AshenChestLocked.cs +++ b/Tiles/AshenChestLocked.cs @@ -1,202 +1,202 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenChestLocked : 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("Locked Ashen Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Locked Ashen Chest"; - chestDrop = mod.ItemType("LockedAshenChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - if (Main.player[Main.myPlayer].HasItem(mod.ItemType("BrimstoneKey"))) { - 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) - { - 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 - { - 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; - 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 : "Locked Ashen Chest"; - if (player.showItemIconText == "Locked Ashen Chest") - { - player.showItemIcon2 = mod.ItemType("BrimstoneKey"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenChestLocked : 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("Locked Ashen Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Locked Ashen Chest"; + chestDrop = mod.ItemType("LockedAshenChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + if (Main.player[Main.myPlayer].HasItem(mod.ItemType("BrimstoneKey"))) { + 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) + { + 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 + { + 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; + 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 : "Locked Ashen Chest"; + if (player.showItemIconText == "Locked Ashen Chest") + { + player.showItemIcon2 = mod.ItemType("BrimstoneKey"); + 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 diff --git a/Tiles/AshenDoorClosed.cs b/Tiles/AshenDoorClosed.cs index 0a85e8a832..5f47e9298e 100644 --- a/Tiles/AshenDoorClosed.cs +++ b/Tiles/AshenDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class AshenDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("AshenDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("AshenDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class AshenDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("AshenDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("AshenDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AshenDoorOpen.cs b/Tiles/AshenDoorOpen.cs index 54c85f3dea..a357442d2b 100644 --- a/Tiles/AshenDoorOpen.cs +++ b/Tiles/AshenDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("AshenDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("AshenDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AshenDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("AshenDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("AshenDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AshenDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/AshenDresser.cs b/Tiles/AshenDresser.cs index b87dfdb0dd..e40f4023b7 100644 --- a/Tiles/AshenDresser.cs +++ b/Tiles/AshenDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AshenDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("AshenDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "AshenDresser"; - dresserDrop = mod.ItemType("AshenDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AshenDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("AshenDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AshenDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("AshenDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "AshenDresser"; + dresserDrop = mod.ItemType("AshenDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AshenDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("AshenDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/AshenLamp.cs b/Tiles/AshenLamp.cs index 62c2a6be85..eba2a0ab90 100644 --- a/Tiles/AshenLamp.cs +++ b/Tiles/AshenLamp.cs @@ -1,96 +1,96 @@ -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 -{ - class AshenLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 11; - frameCounter = 0; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AshenLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 11; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AshenLantern.cs b/Tiles/AshenLantern.cs index eae3cac0e5..4d76439712 100644 --- a/Tiles/AshenLantern.cs +++ b/Tiles/AshenLantern.cs @@ -1,94 +1,94 @@ -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 -{ - class AshenLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 36; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 11; - frameCounter = 0; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class AshenLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 36; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 11; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/AshenMonolith.cs b/Tiles/AshenMonolith.cs index f54a631168..e92919c803 100644 --- a/Tiles/AshenMonolith.cs +++ b/Tiles/AshenMonolith.cs @@ -1,136 +1,136 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenMonolith : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - int animationFrameWidth = 36; - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.9f; - g = 0.3f; - b = 0.3f; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - uniqueAnimationFrame = (uniqueAnimationFrame % 54) + 1; - - frameXOffset = uniqueAnimationFrame * animationFrameWidth; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 6) - { - frameCounter = 0; - frame++; - if (frame > 54) - { - frame = 1; - } - } - // Above code works, but since we are just mimicking another tile, we can just use the same value. - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AshenMonolith")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenMonolith : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + int animationFrameWidth = 36; + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.9f; + g = 0.3f; + b = 0.3f; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + uniqueAnimationFrame = (uniqueAnimationFrame % 54) + 1; + + frameXOffset = uniqueAnimationFrame * animationFrameWidth; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 6) + { + frameCounter = 0; + frame++; + if (frame > 54) + { + frame = 1; + } + } + // Above code works, but since we are just mimicking another tile, we can just use the same value. + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AshenMonolith")); + } + } } \ No newline at end of file diff --git a/Tiles/AshenPiano.cs b/Tiles/AshenPiano.cs index 4c1ab3a306..dc36c596af 100644 --- a/Tiles/AshenPiano.cs +++ b/Tiles/AshenPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class AshenPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenPiano")); - } - } -} +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 +{ + class AshenPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenPiano")); + } + } +} diff --git a/Tiles/AshenPlatform.cs b/Tiles/AshenPlatform.cs index ff617615c4..6456443140 100644 --- a/Tiles/AshenPlatform.cs +++ b/Tiles/AshenPlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AshenPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AshenPlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/AshenSink.cs b/Tiles/AshenSink.cs index 09905de9a4..9e3eb347e6 100644 --- a/Tiles/AshenSink.cs +++ b/Tiles/AshenSink.cs @@ -1,31 +1,31 @@ -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 -{ - class AshenSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSink")); - } - } -} +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 +{ + class AshenSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSink")); + } + } +} diff --git a/Tiles/AshenSlab.cs b/Tiles/AshenSlab.cs index 516338ee34..f7f566f929 100644 --- a/Tiles/AshenSlab.cs +++ b/Tiles/AshenSlab.cs @@ -1,83 +1,83 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class AshenSlab : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("AshenSlab"); - AddMapEntry(new Color(100, 100, 150)); - animationFrameHeight = 270; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //So the basic summary of how this works is that for each possible state there is a unique tile sheet - //for every single unique position. This, as opposed to animating, is used to set which tile sheet is - //used for each tile position. Think of it as a grid, only converted into a single axis. - //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the - //final 3 are the last row. Simple. So for determining the y offset, 1 is added to - //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where - //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. - //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so - //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the - //maximum number of variants is 7. A tile sheet can be used multiple times (although this - //will disrupt the easy to understand arrangement of the tiles in the megasheet. - //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to - //either i (x) or j (y). Test if that modulo is equal to the target position (for example: - //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) - //Dimensions 4 x 5 - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - int xPos = i % 2; - int yPos = j % 3; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 0; - break; - case 1: - uniqueAnimationFrame = 1; - break; - case 2: - uniqueAnimationFrame = 2; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 3; - break; - case 1: - uniqueAnimationFrame = 4; - break; - case 2: - uniqueAnimationFrame = 5; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - default: - uniqueAnimationFrame = 0; - break; - } - - frameYOffset = uniqueAnimationFrame * animationFrameHeight; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AshenSlab : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("AshenSlab"); + AddMapEntry(new Color(100, 100, 150)); + animationFrameHeight = 270; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + //So the basic summary of how this works is that for each possible state there is a unique tile sheet + //for every single unique position. This, as opposed to animating, is used to set which tile sheet is + //used for each tile position. Think of it as a grid, only converted into a single axis. + //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the + //final 3 are the last row. Simple. So for determining the y offset, 1 is added to + //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where + //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. + //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so + //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the + //maximum number of variants is 7. A tile sheet can be used multiple times (although this + //will disrupt the easy to understand arrangement of the tiles in the megasheet. + //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to + //either i (x) or j (y). Test if that modulo is equal to the target position (for example: + //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) + //Dimensions 4 x 5 + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + int xPos = i % 2; + int yPos = j % 3; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrame = 0; + break; + case 1: + uniqueAnimationFrame = 1; + break; + case 2: + uniqueAnimationFrame = 2; + break; + default: + uniqueAnimationFrame = 0; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrame = 3; + break; + case 1: + uniqueAnimationFrame = 4; + break; + case 2: + uniqueAnimationFrame = 5; + break; + default: + uniqueAnimationFrame = 0; + break; + } + break; + default: + uniqueAnimationFrame = 0; + break; + } + + frameYOffset = uniqueAnimationFrame * animationFrameHeight; + } + } } \ No newline at end of file diff --git a/Tiles/AshenSofa.cs b/Tiles/AshenSofa.cs index 8d6c02ddfe..cc89537268 100644 --- a/Tiles/AshenSofa.cs +++ b/Tiles/AshenSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class AshenSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSofa")); - } - } -} +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 +{ + class AshenSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenSofa")); + } + } +} diff --git a/Tiles/AshenTable.cs b/Tiles/AshenTable.cs index 8b81155132..826d55a76a 100644 --- a/Tiles/AshenTable.cs +++ b/Tiles/AshenTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class AshenTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class AshenTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenTable")); + } + } +} diff --git a/Tiles/AshenWorkbench.cs b/Tiles/AshenWorkbench.cs index 1041318294..14ebd30af6 100644 --- a/Tiles/AshenWorkbench.cs +++ b/Tiles/AshenWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class AshenWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Ashen Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AshenWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AshenWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ashen Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AshenWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/AstrageldonMusicbox.cs b/Tiles/AstrageldonMusicbox.cs index 5c3bdcfa97..ecf828b38c 100644 --- a/Tiles/AstrageldonMusicbox.cs +++ b/Tiles/AstrageldonMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AstrageldonMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AstrageldonMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AstrageldonMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AstrageldonMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AstrageldonMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AstrageldonMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/Astral/AstralPalmTree.cs b/Tiles/Astral/AstralPalmTree.cs index f0b3bf0a66..ab8ef73904 100644 --- a/Tiles/Astral/AstralPalmTree.cs +++ b/Tiles/Astral/AstralPalmTree.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Tiles { public override Texture2D GetTexture() { - return CalamityMod.Instance.GetTexture("Tiles/Normal/AstralPalmTree"); + return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralPalmTree"); } public override Texture2D GetTopTextures() { - return CalamityMod.Instance.GetTexture("Tiles/Normal/AstralPalmTree_Tops"); + return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralPalmTree_Tops"); } public override int DropWood() diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index f93f5cfb85..b228f911c9 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Tiles public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset) { frame = (i + j * j) % 3; - return CalamityMod.Instance.GetTexture("Tiles/Normal/AstralTree_Tops"); + return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree_Tops"); } public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) { - return CalamityMod.Instance.GetTexture("Tiles/Normal/AstralTree_Branches"); + return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree_Branches"); } public override Texture2D GetTexture() { - return CalamityMod.Instance.GetTexture("Tiles/Normal/AstralTree"); + return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralTree"); } public override int DropWood() diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index 2329540a98..a2726beba0 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class AstralBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 173; - drop = mod.ItemType("AstralBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Brick"); - AddMapEntry(new Color(255, 153, 255), 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.08f; - g = 0.04f; - b = 0.10f; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AstralBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 173; + drop = mod.ItemType("AstralBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Brick"); + AddMapEntry(new Color(255, 153, 255), 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.08f; + g = 0.04f; + b = 0.10f; + } + } } \ No newline at end of file diff --git a/Tiles/AstralMusicbox.cs b/Tiles/AstralMusicbox.cs index c211becfda..4466b544b8 100644 --- a/Tiles/AstralMusicbox.cs +++ b/Tiles/AstralMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class AstralMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AstralMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("AstralMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class AstralMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("AstralMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("AstralMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/AstralMusicbox.png b/Tiles/AstralMusicbox.png index 3b4c233818..d087e83736 100644 Binary files a/Tiles/AstralMusicbox.png and b/Tiles/AstralMusicbox.png differ diff --git a/Tiles/AuricOre.cs b/Tiles/AuricOre.cs index 506fbba23e..d1898f2e88 100644 --- a/Tiles/AuricOre.cs +++ b/Tiles/AuricOre.cs @@ -1,45 +1,45 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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 = 274; - 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; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 = 274; + 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 diff --git a/Tiles/BossTrophy.cs b/Tiles/BossTrophy.cs index ba4c59a300..ab8294331b 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); - } - } - } +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 diff --git a/Tiles/BrimstoneSlag.cs b/Tiles/BrimstoneSlag.cs index 35e9a59ac7..5aee90b167 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 = 179; - 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; - } - } +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 = 179; + 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 diff --git a/Tiles/CalamitasMusicbox.cs b/Tiles/CalamitasMusicbox.cs index de5ae2f287..6e267f0ecd 100644 --- a/Tiles/CalamitasMusicbox.cs +++ b/Tiles/CalamitasMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class CalamitasMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CalamitasMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CalamitasMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class CalamitasMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CalamitasMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CalamitasMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 4427f9f351..57915abeac 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,551 +1,588 @@ -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; - -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 bool Drop(int i, int j, int type) - { - if (type == 28) - { - if (Main.LocalPlayer.GetModPlayer(mod).ZoneAbyss) - { - 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 (Main.LocalPlayer.GetModPlayer(mod).ZoneSulphur) - { - 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; - } - - public override void RandomUpdate(int i, int j, int type) - { - if (Main.netMode != 1) - { - if (type == (ushort)mod.TileType("ArenaTile")) - { - if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - for (int k = 0; k < Main.maxTilesX; k++) - { - for (int l = 0; l < Main.maxTilesY; l++) - { - if (Main.tile[k, l].type == (ushort)mod.TileType("ArenaTile")) - { - Main.tile[k, l].active(false); - WorldGen.SquareTileFrame(k, l); - } - } - } - } - } - } - if (Main.hardMode) - { - if (j > (int)Main.worldSurface) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].nactive()) - { - if (type == 60) - { - int j2 = j - 1; - if (Main.tile[i, j2].liquid == 0) - { - if (WorldGen.genRand.Next(3) == 0) - { - bool flag18 = true; - int num80 = 400; - for (int num81 = i - num80; num81 < i + num80; num81 += 2) - { - for (int num82 = j - num80; num82 < j + num80; num82 += 2) - { - if (num81 > 1 && num81 < Main.maxTilesX - 2 && num82 > 1 && num82 < Main.maxTilesY - 2 && Main.tile[num81, num82].active() && Main.tile[num81, num82].type == 238) - { - flag18 = false; - break; - } - } - } - if (flag18) - { - WorldGen.PlaceJunglePlant(i, j2, 238, 0, 0); - WorldGen.SquareTileFrame(i, j2, true); - WorldGen.SquareTileFrame(i + 1, j2 + 1, true); - if (Main.tile[i, j2].type == 238 && Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j2, 4, TileChangeType.None); - } - } - } - if (NPC.downedMechBossAny && WorldGen.genRand.Next(6) == 0) - { - bool flag19 = true; - int num83 = 150; - for (int num84 = i - num83; num84 < i + num83; num84 += 2) - { - for (int num85 = j - num83; num85 < j + num83; num85 += 2) - { - if (num84 > 1 && num84 < Main.maxTilesX - 2 && num85 > 1 && num85 < Main.maxTilesY - 2 && Main.tile[num84, num85].active() && Main.tile[num84, num85].type == 236) - { - flag19 = false; - break; - } - } - } - if (flag19) - { - WorldGen.PlaceJunglePlant(i, j2, 236, WorldGen.genRand.Next(3), 0); - WorldGen.SquareTileFrame(i, j2, true); - WorldGen.SquareTileFrame(i + 1, j2 + 1, true); - if (Main.tile[i, j2].type == 236 && Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j2, 4, TileChangeType.None); - } - } - } - } - } - } - } - } - } - } - } -} +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; + +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 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; + } + + public override void RandomUpdate(int i, int j, int type) + { + if (Main.netMode != 1) + { + if (type == (ushort)mod.TileType("ArenaTile")) + { + if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + for (int k = 0; k < Main.maxTilesX; k++) + { + for (int l = 0; l < Main.maxTilesY; l++) + { + if (Main.tile[k, l].type == (ushort)mod.TileType("ArenaTile")) + { + Main.tile[k, l].active(false); + WorldGen.SquareTileFrame(k, l); + } + } + } + } + } + } + if (Main.hardMode) + { + if (j > (int)Main.worldSurface) + { + if (Main.tile[i, j] != null) + { + if (Main.tile[i, j].nactive()) + { + if (type == 60) + { + int j2 = j - 1; + if (Main.tile[i, j2].liquid == 0) + { + if (WorldGen.genRand.Next(3) == 0) + { + bool flag18 = true; + int num80 = 400; + for (int num81 = i - num80; num81 < i + num80; num81 += 2) + { + for (int num82 = j - num80; num82 < j + num80; num82 += 2) + { + if (num81 > 1 && num81 < Main.maxTilesX - 2 && num82 > 1 && num82 < Main.maxTilesY - 2 && Main.tile[num81, num82].active() && Main.tile[num81, num82].type == 238) + { + flag18 = false; + break; + } + } + } + if (flag18) + { + WorldGen.PlaceJunglePlant(i, j2, 238, 0, 0); + WorldGen.SquareTileFrame(i, j2, true); + WorldGen.SquareTileFrame(i + 1, j2 + 1, true); + if (Main.tile[i, j2].type == 238 && Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j2, 4, TileChangeType.None); + } + } + } + if (NPC.downedMechBossAny && WorldGen.genRand.Next(6) == 0) + { + bool flag19 = true; + int num83 = 150; + for (int num84 = i - num83; num84 < i + num83; num84 += 2) + { + for (int num85 = j - num83; num85 < j + num83; num85 += 2) + { + if (num84 > 1 && num84 < Main.maxTilesX - 2 && num85 > 1 && num85 < Main.maxTilesY - 2 && Main.tile[num84, num85].active() && Main.tile[num84, num85].type == 236) + { + flag19 = false; + break; + } + } + } + if (flag19) + { + WorldGen.PlaceJunglePlant(i, j2, 236, WorldGen.genRand.Next(3), 0); + WorldGen.SquareTileFrame(i, j2, true); + WorldGen.SquareTileFrame(i + 1, j2 + 1, true); + if (Main.tile[i, j2].type == 236 && Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j2, 4, TileChangeType.None); + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/Tiles/CeaselessVoidMusicbox.cs b/Tiles/CeaselessVoidMusicbox.cs index 3e07f984cb..c7f07b7807 100644 --- a/Tiles/CeaselessVoidMusicbox.cs +++ b/Tiles/CeaselessVoidMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class CeaselessVoidMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CeaselessVoidMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CeaselessVoidMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class CeaselessVoidMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CeaselessVoidMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CeaselessVoidMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs index c9ffbb95bd..304762d615 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; - } - } +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 diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs index 4c62905a9f..13e7793498 100644 --- a/Tiles/ChaoticOre.cs +++ b/Tiles/ChaoticOre.cs @@ -1,78 +1,78 @@ -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; - dustType = 105; - drop = mod.ItemType("ChaoticOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Chaotic Ore"); - AddMapEntry(new Color(255, 0, 0), name); - mineResist = 4f; - minPick = 209; - soundType = 21; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 750 : 0); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - 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; - } - } +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; + dustType = 105; + drop = mod.ItemType("ChaoticOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Ore"); + AddMapEntry(new Color(255, 0, 0), name); + mineResist = 4f; + minPick = 209; + soundType = 21; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 750 : 0); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + 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 diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index 6ffb490bcc..d382838be5 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -1,48 +1,48 @@ -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; - drop = mod.ItemType("CharredOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Charred Ore"); - AddMapEntry(new Color(128, 0, 0), name); - mineResist = 6f; - minPick = 199; - soundType = 21; - dustType = 235; - Main.tileSpelunker[Type] = true; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 710 : 0); - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss; - } - - 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; - } - } +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; + drop = mod.ItemType("CharredOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Charred Ore"); + AddMapEntry(new Color(128, 0, 0), name); + mineResist = 6f; + minPick = 199; + soundType = 21; + dustType = 235; + Main.tileSpelunker[Type] = true; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 710 : 0); + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss; + } + + 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 diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs index cea9f5f437..63546a0161 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Cinderplate.cs @@ -1,43 +1,43 @@ -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; - - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cinderplate"); - AddMapEntry(new Color(97, 22, 57), name); - - minPick = 0; - - 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; + + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cinderplate"); + AddMapEntry(new Color(97, 22, 57), name); + + minPick = 0; + + 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/CosmiliteBath.cs b/Tiles/CosmiliteBath.cs index d9eba79ae0..cb2173bc67 100644 --- a/Tiles/CosmiliteBath.cs +++ b/Tiles/CosmiliteBath.cs @@ -1,32 +1,32 @@ -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 -{ - class CosmiliteBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteBath")); - } - } -} +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 +{ + class CosmiliteBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteBath")); + } + } +} diff --git a/Tiles/CosmiliteBed.cs b/Tiles/CosmiliteBed.cs index 774bc9bfe8..c7cdff859c 100644 --- a/Tiles/CosmiliteBed.cs +++ b/Tiles/CosmiliteBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("CosmiliteBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("CosmiliteBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteBed"); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteBookcase.cs b/Tiles/CosmiliteBookcase.cs index c3bdeecfa7..d09889fa74 100644 --- a/Tiles/CosmiliteBookcase.cs +++ b/Tiles/CosmiliteBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class CosmiliteBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteBookcase")); - } - } -} +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 +{ + class CosmiliteBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteBookcase")); + } + } +} diff --git a/Tiles/CosmiliteBrick.cs b/Tiles/CosmiliteBrick.cs index 67259bb310..174ac647d5 100644 --- a/Tiles/CosmiliteBrick.cs +++ b/Tiles/CosmiliteBrick.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class CosmiliteBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("CosmiliteBrick"); - AddMapEntry(new Color(60, 50, 50)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class CosmiliteBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("CosmiliteBrick"); + AddMapEntry(new Color(60, 50, 50)); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteCandelabra.cs b/Tiles/CosmiliteCandelabra.cs index df7bb7e2e5..3b4303ca52 100644 --- a/Tiles/CosmiliteCandelabra.cs +++ b/Tiles/CosmiliteCandelabra.cs @@ -1,85 +1,85 @@ -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 -{ - class CosmiliteCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.6f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("CosmiliteCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class CosmiliteCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.6f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("CosmiliteCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/CosmiliteCandle.cs b/Tiles/CosmiliteCandle.cs index 6a0e6bef44..5dd9ef4336 100644 --- a/Tiles/CosmiliteCandle.cs +++ b/Tiles/CosmiliteCandle.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class CosmiliteCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Candle"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("CosmiliteCandle"); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.6f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("CosmiliteCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class CosmiliteCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Candle"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("CosmiliteCandle"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.6f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("CosmiliteCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/CosmiliteChair.cs b/Tiles/CosmiliteChair.cs index bdfdf62bd0..e2b68dce43 100644 --- a/Tiles/CosmiliteChair.cs +++ b/Tiles/CosmiliteChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("CosmiliteChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("CosmiliteChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteChair")); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteChandelier.cs b/Tiles/CosmiliteChandelier.cs index 5b0a7b6fa9..75eb55aa2e 100644 --- a/Tiles/CosmiliteChandelier.cs +++ b/Tiles/CosmiliteChandelier.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.6f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("CosmiliteChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.6f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("CosmiliteChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/CosmiliteChest.cs b/Tiles/CosmiliteChest.cs index 7931725847..7acd63c07f 100644 --- a/Tiles/CosmiliteChest.cs +++ b/Tiles/CosmiliteChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteChest : 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("Cosmilite Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Cosmilite Chest"; - chestDrop = mod.ItemType("CosmiliteChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Cosmilite Chest"; - if (player.showItemIconText == "Cosmilite Chest") - { - player.showItemIcon2 = mod.ItemType("CosmiliteChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteChest : 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("Cosmilite Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Cosmilite Chest"; + chestDrop = mod.ItemType("CosmiliteChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Cosmilite Chest"; + if (player.showItemIconText == "Cosmilite Chest") + { + player.showItemIcon2 = mod.ItemType("CosmiliteChest"); + 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 diff --git a/Tiles/CosmiliteClock.cs b/Tiles/CosmiliteClock.cs index c88a928dae..82068e10e6 100644 --- a/Tiles/CosmiliteClock.cs +++ b/Tiles/CosmiliteClock.cs @@ -1,105 +1,105 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - animationFrameHeight = 90; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CosmiliteClock")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteClock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + animationFrameHeight = 90; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CosmiliteClock")); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteDoorClosed.cs b/Tiles/CosmiliteDoorClosed.cs index d0df303271..83704d62de 100644 --- a/Tiles/CosmiliteDoorClosed.cs +++ b/Tiles/CosmiliteDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class CosmiliteDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("CosmiliteDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("CosmiliteDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class CosmiliteDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("CosmiliteDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("CosmiliteDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteDoorOpen.cs b/Tiles/CosmiliteDoorOpen.cs index 1bd58f7065..2f68413190 100644 --- a/Tiles/CosmiliteDoorOpen.cs +++ b/Tiles/CosmiliteDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("CosmiliteDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("CosmiliteDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("CosmiliteDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("CosmiliteDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteDresser.cs b/Tiles/CosmiliteDresser.cs index 58003383a5..7c505d5626 100644 --- a/Tiles/CosmiliteDresser.cs +++ b/Tiles/CosmiliteDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class CosmiliteDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("CosmiliteDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "CosmiliteDresser"; - dresserDrop = mod.ItemType("CosmiliteDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class CosmiliteDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("CosmiliteDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "CosmiliteDresser"; + dresserDrop = mod.ItemType("CosmiliteDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("CosmiliteDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/CosmiliteLamp.cs b/Tiles/CosmiliteLamp.cs index 17d1802d98..d5b1ce81b1 100644 --- a/Tiles/CosmiliteLamp.cs +++ b/Tiles/CosmiliteLamp.cs @@ -1,85 +1,85 @@ -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 -{ - class CosmiliteLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.6f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class CosmiliteLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.6f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/CosmiliteLantern.cs b/Tiles/CosmiliteLantern.cs index ddcf709884..2209219b8a 100644 --- a/Tiles/CosmiliteLantern.cs +++ b/Tiles/CosmiliteLantern.cs @@ -1,83 +1,83 @@ -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 -{ - class CosmiliteLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.6f; - b = 1f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class CosmiliteLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.6f; + b = 1f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/CosmilitePiano.cs b/Tiles/CosmilitePiano.cs index c1134290bd..08d78eabdf 100644 --- a/Tiles/CosmilitePiano.cs +++ b/Tiles/CosmilitePiano.cs @@ -1,31 +1,31 @@ -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 -{ - class CosmilitePiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmilitePiano")); - } - } -} +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 +{ + class CosmilitePiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmilitePiano")); + } + } +} diff --git a/Tiles/CosmilitePlatform.cs b/Tiles/CosmilitePlatform.cs index d76a937a80..e8d7e61fa3 100644 --- a/Tiles/CosmilitePlatform.cs +++ b/Tiles/CosmilitePlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmilitePlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CosmilitePlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmilitePlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CosmilitePlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/CosmiliteSink.cs b/Tiles/CosmiliteSink.cs index be8f0a780f..f579f1552c 100644 --- a/Tiles/CosmiliteSink.cs +++ b/Tiles/CosmiliteSink.cs @@ -1,31 +1,31 @@ -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 -{ - class CosmiliteSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSink")); - } - } -} +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 +{ + class CosmiliteSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSink")); + } + } +} diff --git a/Tiles/CosmiliteSofa.cs b/Tiles/CosmiliteSofa.cs index d6323425d6..21cd7b66b9 100644 --- a/Tiles/CosmiliteSofa.cs +++ b/Tiles/CosmiliteSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class CosmiliteSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSofa")); - } - } -} +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 +{ + class CosmiliteSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteSofa")); + } + } +} diff --git a/Tiles/CosmiliteTable.cs b/Tiles/CosmiliteTable.cs index 487815d76d..d1235c5738 100644 --- a/Tiles/CosmiliteTable.cs +++ b/Tiles/CosmiliteTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class CosmiliteTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class CosmiliteTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteTable")); + } + } +} diff --git a/Tiles/CosmiliteWorkbench.cs b/Tiles/CosmiliteWorkbench.cs index 2495d88bd0..a5baa9f442 100644 --- a/Tiles/CosmiliteWorkbench.cs +++ b/Tiles/CosmiliteWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class CosmiliteWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmilite Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("CosmiliteWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmilite Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("CosmiliteWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/CrabulonMusicbox.cs b/Tiles/CrabulonMusicbox.cs index d34568f796..ff978155b4 100644 --- a/Tiles/CrabulonMusicbox.cs +++ b/Tiles/CrabulonMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class CrabulonMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CrabulonMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CrabulonMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class CrabulonMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CrabulonMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CrabulonMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/CryogenMusicbox.cs b/Tiles/CryogenMusicbox.cs index 634743e74a..c34d326adc 100644 --- a/Tiles/CryogenMusicbox.cs +++ b/Tiles/CryogenMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class CryogenMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CryogenMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("CryogenMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class CryogenMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("CryogenMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("CryogenMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index a23aa9d22d..965555f173 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class CryonicBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; - Main.tileBlockLight[Type] = true; - dustType = mod.DustType("MSparkle"); - drop = mod.ItemType("CryonicBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cryonic Brick"); - AddMapEntry(new Color(0, 0, 150), 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.02f; - g = 0.02f; - b = 0.06f; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class CryonicBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = mod.DustType("MSparkle"); + drop = mod.ItemType("CryonicBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cryonic Brick"); + AddMapEntry(new Color(0, 0, 150), 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.02f; + g = 0.02f; + b = 0.06f; + } + } } \ No newline at end of file diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs index 8a5d4a8294..5b1b5bc9ad 100644 --- a/Tiles/CryonicOre.cs +++ b/Tiles/CryonicOre.cs @@ -1,49 +1,49 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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; - 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 = 179; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 675 : 0); - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedCryogen; - } - - 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; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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; + 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 = 179; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 675 : 0); + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedCryogen; + } + + 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 diff --git a/Tiles/DesertScourgeMusicbox.cs b/Tiles/DesertScourgeMusicbox.cs index 531672833e..e053dc367f 100644 --- a/Tiles/DesertScourgeMusicbox.cs +++ b/Tiles/DesertScourgeMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class DesertScourgeMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("DesertScourgeMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("DesertScourgeMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class DesertScourgeMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("DesertScourgeMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("DesertScourgeMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/DoGMusicbox.cs b/Tiles/DoGMusicbox.cs index ded0aa1d14..e1c4611872 100644 --- a/Tiles/DoGMusicbox.cs +++ b/Tiles/DoGMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class DoGMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("DoGMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("DoGMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class DoGMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("DoGMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("DoGMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/DraedonsForge.cs b/Tiles/DraedonsForge.cs index 1c8102663b..2f7e27da5d 100644 --- a/Tiles/DraedonsForge.cs +++ b/Tiles/DraedonsForge.cs @@ -1,53 +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; - } - } - } - } +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 diff --git a/Tiles/EutrophicSand.cs b/Tiles/EutrophicSand.cs index f2b96a38ec..37f1822ce9 100644 --- a/Tiles/EutrophicSand.cs +++ b/Tiles/EutrophicSand.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class EutrophicSand : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Sand"); - AddMapEntry(new Color(0, 255, 150), name); - soundType = 0; - dustType = 185; - } - - 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 NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class EutrophicSand : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Sand"); + AddMapEntry(new Color(0, 255, 150), name); + soundType = 0; + dustType = 185; + } + + 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 NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs index c6a9c29bce..c2a0dd2e80 100644 --- a/Tiles/ExodiumOre.cs +++ b/Tiles/ExodiumOre.cs @@ -1,38 +1,38 @@ -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); - - minPick = 0; - Main.tileValue[Type] = 450; - 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); + + minPick = 0; + Main.tileValue[Type] = 450; + 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/HigherAbyssMusicbox.cs b/Tiles/HigherAbyssMusicbox.cs index 4ed6763c29..adffb62708 100644 --- a/Tiles/HigherAbyssMusicbox.cs +++ b/Tiles/HigherAbyssMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class HigherAbyssMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("HigherAbyssMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("HigherAbyssMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class HigherAbyssMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("HigherAbyssMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("HigherAbyssMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/HiveMindMusicbox.cs b/Tiles/HiveMindMusicbox.cs index 7582f036f4..02016704e2 100644 --- a/Tiles/HiveMindMusicbox.cs +++ b/Tiles/HiveMindMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class HiveMindMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("HiveMindMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("HiveMindMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class HiveMindMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("HiveMindMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("HiveMindMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/LumenylCrystals.png b/Tiles/LumenylCrystals.png new file mode 100644 index 0000000000..86757d77bb Binary files /dev/null and b/Tiles/LumenylCrystals.png differ diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index ad41be4bec..c22bc46356 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class PerennialBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; - Main.tileBlockLight[Type] = true; - dustType = mod.DustType("CESparkle"); - drop = mod.ItemType("PerennialBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Perennial Brick"); - AddMapEntry(new Color(200, 250, 100), 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.10f; - b = 0.02f; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class PerennialBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = mod.DustType("CESparkle"); + drop = mod.ItemType("PerennialBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Perennial Brick"); + AddMapEntry(new Color(200, 250, 100), 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.10f; + b = 0.02f; + } + } } \ No newline at end of file diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs index ae21ec8be2..b1e7b5c989 100644 --- a/Tiles/PerennialOre.cs +++ b/Tiles/PerennialOre.cs @@ -1,49 +1,49 @@ -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; - 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 = 199; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 690 : 0); - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss; - } - - 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; - } - } +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; + 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 = 199; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 690 : 0); + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss; + } + + 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 diff --git a/Tiles/PerforatorMusicbox.cs b/Tiles/PerforatorMusicbox.cs index 4283915d74..26dd7705a6 100644 --- a/Tiles/PerforatorMusicbox.cs +++ b/Tiles/PerforatorMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class PerforatorMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PerforatorMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PerforatorMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class PerforatorMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PerforatorMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PerforatorMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/PlaguebringerMusicbox.cs b/Tiles/PlaguebringerMusicbox.cs index 5be4578e40..cf829ac270 100644 --- a/Tiles/PlaguebringerMusicbox.cs +++ b/Tiles/PlaguebringerMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class PlaguebringerMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PlaguebringerMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PlaguebringerMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class PlaguebringerMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PlaguebringerMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PlaguebringerMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/PlantyMush.cs b/Tiles/PlantyMush.cs index 76232c53aa..7dbd2e2853 100644 --- a/Tiles/PlantyMush.cs +++ b/Tiles/PlantyMush.cs @@ -1,85 +1,85 @@ -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; - minPick = 199; - 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()) - { - if (Main.tile[i, j + 1].liquid == 255 && - (Main.tile[i, j + 1].wall == (byte)mod.WallType("MossyGravelWall") || - Main.tile[i, j + 1].wall == (byte)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); - } - } - } - } - } - } - } +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; + minPick = 199; + 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()) + { + if (Main.tile[i, j + 1].liquid == 255 && + (Main.tile[i, j + 1].wall == (byte)mod.WallType("MossyGravelWall") || + Main.tile[i, j + 1].wall == (byte)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 diff --git a/Tiles/PolterghastMusicbox.cs b/Tiles/PolterghastMusicbox.cs index 8d5488668b..a94743cb88 100644 --- a/Tiles/PolterghastMusicbox.cs +++ b/Tiles/PolterghastMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class PolterghastMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PolterghastMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("PolterghastMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class PolterghastMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("PolterghastMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("PolterghastMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedBath.cs b/Tiles/ProfanedBath.cs index 09128563ef..e7652bb113 100644 --- a/Tiles/ProfanedBath.cs +++ b/Tiles/ProfanedBath.cs @@ -1,32 +1,32 @@ -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 -{ - class ProfanedBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBath")); - } - } -} +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 +{ + class ProfanedBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBath")); + } + } +} diff --git a/Tiles/ProfanedBed.cs b/Tiles/ProfanedBed.cs index bf4e760541..49d186074c 100644 --- a/Tiles/ProfanedBed.cs +++ b/Tiles/ProfanedBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("ProfanedBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("ProfanedBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedBed"); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedBench.cs b/Tiles/ProfanedBench.cs index 06694fc410..d15fa75b60 100644 --- a/Tiles/ProfanedBench.cs +++ b/Tiles/ProfanedBench.cs @@ -1,31 +1,31 @@ -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 -{ - class ProfanedBench : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Bench"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBench")); - } - } -} +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 +{ + class ProfanedBench : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Bench"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBench")); + } + } +} diff --git a/Tiles/ProfanedBookcase.cs b/Tiles/ProfanedBookcase.cs index fa87d0b2fd..05cab6ad19 100644 --- a/Tiles/ProfanedBookcase.cs +++ b/Tiles/ProfanedBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class ProfanedBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBookcase")); - } - } -} +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 +{ + class ProfanedBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedBookcase")); + } + } +} diff --git a/Tiles/ProfanedCandelabra.cs b/Tiles/ProfanedCandelabra.cs index aa632129a3..d6d0693ab1 100644 --- a/Tiles/ProfanedCandelabra.cs +++ b/Tiles/ProfanedCandelabra.cs @@ -1,85 +1,85 @@ -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 -{ - class ProfanedCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.85f; - b = 0.7f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("ProfanedCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class ProfanedCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.85f; + b = 0.7f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("ProfanedCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/ProfanedCandle.cs b/Tiles/ProfanedCandle.cs index 290e681d7c..df34f40b25 100644 --- a/Tiles/ProfanedCandle.cs +++ b/Tiles/ProfanedCandle.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class ProfanedCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Candle"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("ProfanedCandle"); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.85f; - b = 0.7f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ProfanedCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class ProfanedCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Candle"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("ProfanedCandle"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.85f; + b = 0.7f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ProfanedCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/ProfanedChair.cs b/Tiles/ProfanedChair.cs index aff116a60a..aa03e12d24 100644 --- a/Tiles/ProfanedChair.cs +++ b/Tiles/ProfanedChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("ProfanedChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("ProfanedChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedChair")); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedChandelier.cs b/Tiles/ProfanedChandelier.cs index ab19eeb698..5590804959 100644 --- a/Tiles/ProfanedChandelier.cs +++ b/Tiles/ProfanedChandelier.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.85f; - b = 0.7f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("ProfanedChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.85f; + b = 0.7f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("ProfanedChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/ProfanedChest.cs b/Tiles/ProfanedChest.cs index 68cbb16e10..e4ad1a54d0 100644 --- a/Tiles/ProfanedChest.cs +++ b/Tiles/ProfanedChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedChest : 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("Profaned Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Profaned Chest"; - chestDrop = mod.ItemType("ProfanedChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Profaned Chest"; - if (player.showItemIconText == "Profaned Chest") - { - player.showItemIcon2 = mod.ItemType("ProfanedChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedChest : 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("Profaned Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Profaned Chest"; + chestDrop = mod.ItemType("ProfanedChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Profaned Chest"; + if (player.showItemIconText == "Profaned Chest") + { + player.showItemIcon2 = mod.ItemType("ProfanedChest"); + 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 diff --git a/Tiles/ProfanedClock.cs b/Tiles/ProfanedClock.cs index 9a68c51b6a..ef0fd1638c 100644 --- a/Tiles/ProfanedClock.cs +++ b/Tiles/ProfanedClock.cs @@ -1,105 +1,105 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - animationFrameHeight = 90; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("ProfanedClock")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedClock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + animationFrameHeight = 90; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("ProfanedClock")); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedCrystal.cs b/Tiles/ProfanedCrystal.cs index fbc723f203..adc3bf17e4 100644 --- a/Tiles/ProfanedCrystal.cs +++ b/Tiles/ProfanedCrystal.cs @@ -1,57 +1,57 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ProfanedCrystal : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("ProfanedCrystal"); - AddMapEntry(new Color(60, 50, 50)); - animationFrameHeight = 270; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //So the basic summary of how this works is that for each possible state there is a unique tile sheet - //for every single unique position. This, as opposed to animating, is used to set which tile sheet is - //used for each tile position. Think of it as a grid, only converted into a single axis. - //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the - //final 3 are the last row. Simple. So for determining the y offset, 1 is added to - //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where - //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. - //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so - //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the - //maximum number of variants is 7. A tile sheet can be used multiple times (although this - //will disrupt the easy to understand arrangement of the tiles in the megasheet. - //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to - //either i (x) or j (y). Test if that modulo is equal to the target position (for example: - //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - if (i % 2 == 0 && j % 2 == 0) - { - uniqueAnimationFrame = 1; - } - else if (i % 2 == 1 && j % 2 == 0) - { - uniqueAnimationFrame = 3; - } - else if (i % 2 == 0 && j % 2 == 1) - { - uniqueAnimationFrame = 0; - } - else if (i % 2 == 1 && j % 2 == 1) - { - uniqueAnimationFrame = 2; - } - //uniqueAnimationFrame = uniqueAnimationFrame % 2; - - frameYOffset = uniqueAnimationFrame * animationFrameHeight; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ProfanedCrystal : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("ProfanedCrystal"); + AddMapEntry(new Color(60, 50, 50)); + animationFrameHeight = 270; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + //So the basic summary of how this works is that for each possible state there is a unique tile sheet + //for every single unique position. This, as opposed to animating, is used to set which tile sheet is + //used for each tile position. Think of it as a grid, only converted into a single axis. + //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the + //final 3 are the last row. Simple. So for determining the y offset, 1 is added to + //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where + //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. + //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so + //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the + //maximum number of variants is 7. A tile sheet can be used multiple times (although this + //will disrupt the easy to understand arrangement of the tiles in the megasheet. + //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to + //either i (x) or j (y). Test if that modulo is equal to the target position (for example: + //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + if (i % 2 == 0 && j % 2 == 0) + { + uniqueAnimationFrame = 1; + } + else if (i % 2 == 1 && j % 2 == 0) + { + uniqueAnimationFrame = 3; + } + else if (i % 2 == 0 && j % 2 == 1) + { + uniqueAnimationFrame = 0; + } + else if (i % 2 == 1 && j % 2 == 1) + { + uniqueAnimationFrame = 2; + } + //uniqueAnimationFrame = uniqueAnimationFrame % 2; + + frameYOffset = uniqueAnimationFrame * animationFrameHeight; + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedDoorClosed.cs b/Tiles/ProfanedDoorClosed.cs index 00904812ae..65de536b8f 100644 --- a/Tiles/ProfanedDoorClosed.cs +++ b/Tiles/ProfanedDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class ProfanedDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("ProfanedDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("ProfanedDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class ProfanedDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("ProfanedDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("ProfanedDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedDoorOpen.cs b/Tiles/ProfanedDoorOpen.cs index 0768da6295..e861b467d7 100644 --- a/Tiles/ProfanedDoorOpen.cs +++ b/Tiles/ProfanedDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("ProfanedDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("ProfanedDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("ProfanedDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("ProfanedDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedDresser.cs b/Tiles/ProfanedDresser.cs index 74764c2954..90540733d3 100644 --- a/Tiles/ProfanedDresser.cs +++ b/Tiles/ProfanedDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class ProfanedDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("ProfanedDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "ProfanedDresser"; - dresserDrop = mod.ItemType("ProfanedDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("ProfanedDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("ProfanedDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class ProfanedDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("ProfanedDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "ProfanedDresser"; + dresserDrop = mod.ItemType("ProfanedDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("ProfanedDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("ProfanedDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/ProfanedGuardianMusicbox.cs b/Tiles/ProfanedGuardianMusicbox.cs index 24bbbde9a5..795722f632 100644 --- a/Tiles/ProfanedGuardianMusicbox.cs +++ b/Tiles/ProfanedGuardianMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class ProfanedGuardianMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProfanedGuardianMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProfanedGuardianMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class ProfanedGuardianMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProfanedGuardianMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProfanedGuardianMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedLamp.cs b/Tiles/ProfanedLamp.cs index 6b60f24bda..347e870088 100644 --- a/Tiles/ProfanedLamp.cs +++ b/Tiles/ProfanedLamp.cs @@ -1,85 +1,85 @@ -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 -{ - class ProfanedLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.85f; - b = 0.7f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class ProfanedLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.85f; + b = 0.7f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/ProfanedLantern.cs b/Tiles/ProfanedLantern.cs index 5299b98ba2..8adeb987a2 100644 --- a/Tiles/ProfanedLantern.cs +++ b/Tiles/ProfanedLantern.cs @@ -1,83 +1,83 @@ -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 -{ - class ProfanedLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 1f; - g = 0.85f; - b = 0.7f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class ProfanedLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 1f; + g = 0.85f; + b = 0.7f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/ProfanedPiano.cs b/Tiles/ProfanedPiano.cs index 61a1575ee0..fd77c5c0dd 100644 --- a/Tiles/ProfanedPiano.cs +++ b/Tiles/ProfanedPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class ProfanedPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedPiano")); - } - } -} +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 +{ + class ProfanedPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedPiano")); + } + } +} diff --git a/Tiles/ProfanedPlatform.cs b/Tiles/ProfanedPlatform.cs index 566c94763f..fbd4792928 100644 --- a/Tiles/ProfanedPlatform.cs +++ b/Tiles/ProfanedPlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedPlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedRock.cs b/Tiles/ProfanedRock.cs index f8b833fe05..2bb5b70537 100644 --- a/Tiles/ProfanedRock.cs +++ b/Tiles/ProfanedRock.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ProfanedRock : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("ProfanedRock"); - AddMapEntry(new Color(60, 50, 50)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ProfanedRock : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("ProfanedRock"); + AddMapEntry(new Color(60, 50, 50)); + } + } } \ No newline at end of file diff --git a/Tiles/ProfanedSink.cs b/Tiles/ProfanedSink.cs index 2422823e9e..e2899b9c54 100644 --- a/Tiles/ProfanedSink.cs +++ b/Tiles/ProfanedSink.cs @@ -1,31 +1,31 @@ -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 -{ - class ProfanedSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedSink")); - } - } -} +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 +{ + class ProfanedSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedSink")); + } + } +} diff --git a/Tiles/ProfanedSlab.cs b/Tiles/ProfanedSlab.cs index 80995fc80a..cce47d047d 100644 --- a/Tiles/ProfanedSlab.cs +++ b/Tiles/ProfanedSlab.cs @@ -1,119 +1,119 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ProfanedSlab : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("ProfanedSlab"); - AddMapEntry(new Color(100, 100, 150)); - animationFrameHeight = 270; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //So the basic summary of how this works is that for each possible state there is a unique tile sheet - //for every single unique position. This, as opposed to animating, is used to set which tile sheet is - //used for each tile position. Think of it as a grid, only converted into a single axis. - //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the - //final 3 are the last row. Simple. So for determining the y offset, 1 is added to - //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where - //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. - //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so - //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the - //maximum number of variants is 7. A tile sheet can be used multiple times (although this - //will disrupt the easy to understand arrangement of the tiles in the megasheet. - //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to - //either i (x) or j (y). Test if that modulo is equal to the target position (for example: - //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - if (i % 4 == 0 && j % 4 == 0) - { - uniqueAnimationFrame = 1; - } - else if(i % 4 == 1 && j % 4 == 0) - { - uniqueAnimationFrame = 3; - } - else if (i % 4 == 2 && j % 4 == 0) - { - uniqueAnimationFrame = 1; - } - else if (i % 4 == 3 && j % 4 == 0) - { - uniqueAnimationFrame = 2; - } - else if (i % 4 == 0 && j % 4 == 1) - { - uniqueAnimationFrame = 0; - } - else if (i % 4 == 1 && j % 4 == 1) - { - uniqueAnimationFrame = 2; - } - else if (i % 4 == 2 && j % 4 == 1) - { - uniqueAnimationFrame = 0; - } - else if (i % 4 == 3 && j % 4 == 1) - { - uniqueAnimationFrame = 2; - } - else if (i % 4 == 0 && j % 4 == 2) - { - uniqueAnimationFrame = 1; - } - else if (i % 4 == 1 && j % 4 == 2) - { - uniqueAnimationFrame = 3; - } - else if (i % 4 == 2 && j % 4 == 2) - { - uniqueAnimationFrame = 1; - } - else if (i % 4 == 3 && j % 4 == 2) - { - uniqueAnimationFrame = 3; - } - else if (i % 4 == 0 && j % 4 == 3) - { - uniqueAnimationFrame = 0; - } - else if (i % 4 == 1 && j % 4 == 3) - { - uniqueAnimationFrame = 2; - } - else if (i % 4 == 2 && j % 4 == 3) - { - uniqueAnimationFrame = 0; - } - else if (i % 4 == 3 && j % 4 == 3) - { - uniqueAnimationFrame = 2; - } - //uniqueAnimationFrame = uniqueAnimationFrame % 2; - - frameYOffset = uniqueAnimationFrame * animationFrameHeight; - } - - //public override void AnimateTile(ref int frame, ref int frameCounter) - //{ - // frameCounter++; - // if (frameCounter > 10) - // { - // frameCounter = 0; - // frame++; - // if (frame > 1) - // { - // frame = 0; - // } - // } - //} - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ProfanedSlab : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("ProfanedSlab"); + AddMapEntry(new Color(100, 100, 150)); + animationFrameHeight = 270; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + //So the basic summary of how this works is that for each possible state there is a unique tile sheet + //for every single unique position. This, as opposed to animating, is used to set which tile sheet is + //used for each tile position. Think of it as a grid, only converted into a single axis. + //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the + //final 3 are the last row. Simple. So for determining the y offset, 1 is added to + //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where + //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. + //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so + //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the + //maximum number of variants is 7. A tile sheet can be used multiple times (although this + //will disrupt the easy to understand arrangement of the tiles in the megasheet. + //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to + //either i (x) or j (y). Test if that modulo is equal to the target position (for example: + //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + if (i % 4 == 0 && j % 4 == 0) + { + uniqueAnimationFrame = 1; + } + else if(i % 4 == 1 && j % 4 == 0) + { + uniqueAnimationFrame = 3; + } + else if (i % 4 == 2 && j % 4 == 0) + { + uniqueAnimationFrame = 1; + } + else if (i % 4 == 3 && j % 4 == 0) + { + uniqueAnimationFrame = 2; + } + else if (i % 4 == 0 && j % 4 == 1) + { + uniqueAnimationFrame = 0; + } + else if (i % 4 == 1 && j % 4 == 1) + { + uniqueAnimationFrame = 2; + } + else if (i % 4 == 2 && j % 4 == 1) + { + uniqueAnimationFrame = 0; + } + else if (i % 4 == 3 && j % 4 == 1) + { + uniqueAnimationFrame = 2; + } + else if (i % 4 == 0 && j % 4 == 2) + { + uniqueAnimationFrame = 1; + } + else if (i % 4 == 1 && j % 4 == 2) + { + uniqueAnimationFrame = 3; + } + else if (i % 4 == 2 && j % 4 == 2) + { + uniqueAnimationFrame = 1; + } + else if (i % 4 == 3 && j % 4 == 2) + { + uniqueAnimationFrame = 3; + } + else if (i % 4 == 0 && j % 4 == 3) + { + uniqueAnimationFrame = 0; + } + else if (i % 4 == 1 && j % 4 == 3) + { + uniqueAnimationFrame = 2; + } + else if (i % 4 == 2 && j % 4 == 3) + { + uniqueAnimationFrame = 0; + } + else if (i % 4 == 3 && j % 4 == 3) + { + uniqueAnimationFrame = 2; + } + //uniqueAnimationFrame = uniqueAnimationFrame % 2; + + frameYOffset = uniqueAnimationFrame * animationFrameHeight; + } + + //public override void AnimateTile(ref int frame, ref int frameCounter) + //{ + // frameCounter++; + // if (frameCounter > 10) + // { + // frameCounter = 0; + // frame++; + // if (frame > 1) + // { + // frame = 0; + // } + // } + //} + } } \ No newline at end of file diff --git a/Tiles/ProfanedTable.cs b/Tiles/ProfanedTable.cs index 6c3c40c09f..a186f0a113 100644 --- a/Tiles/ProfanedTable.cs +++ b/Tiles/ProfanedTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class ProfanedTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class ProfanedTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedTable")); + } + } +} diff --git a/Tiles/ProfanedWorkbench.cs b/Tiles/ProfanedWorkbench.cs index bd2fca5779..437b9cf3df 100644 --- a/Tiles/ProfanedWorkbench.cs +++ b/Tiles/ProfanedWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class ProfanedWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Profaned Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("ProfanedWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ProfanedWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Profaned Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("ProfanedWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/ProvidenceMusicbox.cs b/Tiles/ProvidenceMusicbox.cs index e1457df8d0..b62dd66902 100644 --- a/Tiles/ProvidenceMusicbox.cs +++ b/Tiles/ProvidenceMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class ProvidenceMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProvidenceMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ProvidenceMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class ProvidenceMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("ProvidenceMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ProvidenceMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/RavagerMusicbox.cs b/Tiles/RavagerMusicbox.cs index b131dc4120..17c2e21957 100644 --- a/Tiles/RavagerMusicbox.cs +++ b/Tiles/RavagerMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class RavagerMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("RavagerMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("RavagerMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class RavagerMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("RavagerMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("RavagerMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/RunicProfanedBrick.cs b/Tiles/RunicProfanedBrick.cs index 187345634f..052c97db3d 100644 --- a/Tiles/RunicProfanedBrick.cs +++ b/Tiles/RunicProfanedBrick.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class RunicProfanedBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("RunicProfanedBrick"); - AddMapEntry(new Color(60, 50, 50)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class RunicProfanedBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("RunicProfanedBrick"); + AddMapEntry(new Color(60, 50, 50)); + } + } } \ No newline at end of file diff --git a/Tiles/SeaPrism.cs b/Tiles/SeaPrism.cs index 1da54d3cb8..7dbbe97bcc 100644 --- a/Tiles/SeaPrism.cs +++ b/Tiles/SeaPrism.cs @@ -1,41 +1,41 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - 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("CryonicOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Prism"); - AddMapEntry(new Color(0, 150, 200), name); - mineResist = 3f; - minPick = 199; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 700 : 0); - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedLeviathan; - } - - 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 SeaPrism : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 33; + //drop = mod.ItemType("CryonicOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism"); + AddMapEntry(new Color(0, 150, 200), name); + mineResist = 3f; + minPick = 199; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 700 : 0); + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedLeviathan; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/SignusMusicbox.cs b/Tiles/SignusMusicbox.cs index 13722d9ccc..d0edc29063 100644 --- a/Tiles/SignusMusicbox.cs +++ b/Tiles/SignusMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class SignusMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SignusMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SignusMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class SignusMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SignusMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SignusMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/SlimeGodMusicbox.cs b/Tiles/SlimeGodMusicbox.cs index 6b107819ab..1e6ece1514 100644 --- a/Tiles/SlimeGodMusicbox.cs +++ b/Tiles/SlimeGodMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class SlimeGodMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SlimeGodMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SlimeGodMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class SlimeGodMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SlimeGodMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SlimeGodMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/SmoothAbyssGravel.cs b/Tiles/SmoothAbyssGravel.cs index c0aed9a394..d5bb47fd00 100644 --- a/Tiles/SmoothAbyssGravel.cs +++ b/Tiles/SmoothAbyssGravel.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class SmoothAbyssGravel : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("SmoothAbyssGravel"); - AddMapEntry(new Color(100, 100, 150)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class SmoothAbyssGravel : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("SmoothAbyssGravel"); + AddMapEntry(new Color(100, 100, 150)); + } + } } \ No newline at end of file diff --git a/Tiles/SmoothAbyssGravelPlatform.cs b/Tiles/SmoothAbyssGravelPlatform.cs index e392afa12b..6f032f7c44 100644 --- a/Tiles/SmoothAbyssGravelPlatform.cs +++ b/Tiles/SmoothAbyssGravelPlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class SmoothAbyssGravelPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothAbyssGravelPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class SmoothAbyssGravelPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothAbyssGravelPlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/SmoothBrimstoneSlag.cs b/Tiles/SmoothBrimstoneSlag.cs index 159e6608c2..5ba3d5ce43 100644 --- a/Tiles/SmoothBrimstoneSlag.cs +++ b/Tiles/SmoothBrimstoneSlag.cs @@ -1,37 +1,37 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class SmoothBrimstoneSlag : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileLighted[Type] = true; - drop = mod.ItemType("SmoothBrimstoneSlag"); - mineResist = 3f; - minPick = 79; - dustType = 53; - soundType = 21; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Smooth 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 void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.50f; - g = 0.00f; - b = 0.00f; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class SmoothBrimstoneSlag : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + drop = mod.ItemType("SmoothBrimstoneSlag"); + mineResist = 3f; + minPick = 79; + dustType = 53; + soundType = 21; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Smooth 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 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 diff --git a/Tiles/SmoothVoidstone.cs b/Tiles/SmoothVoidstone.cs index 76d55cd16f..676c97b65d 100644 --- a/Tiles/SmoothVoidstone.cs +++ b/Tiles/SmoothVoidstone.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class SmoothVoidstone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("SmoothVoidstone"); - AddMapEntry(new Color(10, 10, 10)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class SmoothVoidstone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("SmoothVoidstone"); + AddMapEntry(new Color(10, 10, 10)); + } + } } \ No newline at end of file diff --git a/Tiles/SmoothVoidstonePlatform.cs b/Tiles/SmoothVoidstonePlatform.cs index 1ce7832eac..3fe184aea5 100644 --- a/Tiles/SmoothVoidstonePlatform.cs +++ b/Tiles/SmoothVoidstonePlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class SmoothVoidstonePlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothVoidstonePlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class SmoothVoidstonePlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothVoidstonePlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/StaticRefiner.cs b/Tiles/StaticRefiner.cs index 2fd250ed52..b94076b621 100644 --- a/Tiles/StaticRefiner.cs +++ b/Tiles/StaticRefiner.cs @@ -1,124 +1,124 @@ -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 -{ - class StaticRefiner : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Static Refiner"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 10; - frameCounter = 0; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StaticRefiner")); - } - - // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. - /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - // Flips the sprite - SpriteEffects effects = SpriteEffects.None; - if (i % 2 == 1) - { - effects = SpriteEffects.FlipHorizontally; - } - - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int k = Main.tileFrame[Type] + i % 6; - if (i % 2 == 0) - { - k += 3; - } - if (i % 3 == 0) - { - k += 3; - } - if (i % 4 == 0) - { - k += 3; - } - k = k % 6; - - Tile tile = Main.tile[i, j]; - Texture2D texture; - if (Main.canDrawColorTile(i, j)) - { - texture = Main.tileAltTexture[Type, (int)tile.color()]; - } - else - { - texture = Main.tileTexture[Type]; - } - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - int animate = k * animationFrameWidth; - - Main.spriteBatch.Draw( - texture, - new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, - new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), - Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); - - return false; // return false to stop vanilla draw. - }*/ - - // public override void AnimateTile(ref int frame, ref int frameCounter) - //{ - // /*frameCounter++; - // if (frameCounter > 8) - // { - // frameCounter = 0; - // frame++; - // if (frame > 5) - // { - // frame = 0; - // } - // }*/ - // // Above code works, but since we are just mimicking another tile, we can just use the same value. - // frame = Main.tileFrame[TileID.FireflyinaBottle]; - //} - } - - //class ExampleAnimatedTileItem : ModItem - //{ - // public override void SetStaticDefaults() - // { - // DisplayName.SetDefault("Red Firefly in a Bottle"); - // } - - // public override void SetDefaults() - // { - // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = mod.TileType(); - // } - //} -} +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 +{ + class StaticRefiner : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Static Refiner"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 10; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StaticRefiner")); + } + + // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. + /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + // Flips the sprite + SpriteEffects effects = SpriteEffects.None; + if (i % 2 == 1) + { + effects = SpriteEffects.FlipHorizontally; + } + + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int k = Main.tileFrame[Type] + i % 6; + if (i % 2 == 0) + { + k += 3; + } + if (i % 3 == 0) + { + k += 3; + } + if (i % 4 == 0) + { + k += 3; + } + k = k % 6; + + Tile tile = Main.tile[i, j]; + Texture2D texture; + if (Main.canDrawColorTile(i, j)) + { + texture = Main.tileAltTexture[Type, (int)tile.color()]; + } + else + { + texture = Main.tileTexture[Type]; + } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int animate = k * animationFrameWidth; + + Main.spriteBatch.Draw( + texture, + new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, + new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), + Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); + + return false; // return false to stop vanilla draw. + }*/ + + // public override void AnimateTile(ref int frame, ref int frameCounter) + //{ + // /*frameCounter++; + // if (frameCounter > 8) + // { + // frameCounter = 0; + // frame++; + // if (frame > 5) + // { + // frame = 0; + // } + // }*/ + // // Above code works, but since we are just mimicking another tile, we can just use the same value. + // frame = Main.tileFrame[TileID.FireflyinaBottle]; + //} + } + + //class ExampleAnimatedTileItem : ModItem + //{ + // public override void SetStaticDefaults() + // { + // DisplayName.SetDefault("Red Firefly in a Bottle"); + // } + + // public override void SetDefaults() + // { + // item.CloneDefaults(ItemID.FireflyinaBottle); + // item.createTile = mod.TileType(); + // } + //} +} diff --git a/Tiles/StatigelBath.cs b/Tiles/StatigelBath.cs index 10c58de18d..e7ce0795b0 100644 --- a/Tiles/StatigelBath.cs +++ b/Tiles/StatigelBath.cs @@ -1,32 +1,32 @@ -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 -{ - class StatigelBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelBath")); - } - } -} +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 +{ + class StatigelBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelBath")); + } + } +} diff --git a/Tiles/StatigelBed.cs b/Tiles/StatigelBed.cs index 932369174e..8d5aa4c470 100644 --- a/Tiles/StatigelBed.cs +++ b/Tiles/StatigelBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("StatigelBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("StatigelBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelBed"); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelBlock.cs b/Tiles/StatigelBlock.cs index 20ed9dd025..b5b7133341 100644 --- a/Tiles/StatigelBlock.cs +++ b/Tiles/StatigelBlock.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class StatigelBlock : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("StatigelBlock"); - AddMapEntry(new Color(10, 10, 10)); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class StatigelBlock : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("StatigelBlock"); + AddMapEntry(new Color(10, 10, 10)); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelBookcase.cs b/Tiles/StatigelBookcase.cs index f7b87b1947..d14ed775f0 100644 --- a/Tiles/StatigelBookcase.cs +++ b/Tiles/StatigelBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class StatigelBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelBookcase")); - } - } -} +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 +{ + class StatigelBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelBookcase")); + } + } +} diff --git a/Tiles/StatigelCandelabra.cs b/Tiles/StatigelCandelabra.cs index 937e06ff0e..41ea1472a5 100644 --- a/Tiles/StatigelCandelabra.cs +++ b/Tiles/StatigelCandelabra.cs @@ -1,85 +1,85 @@ -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 -{ - class StatigelCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("StatigelCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class StatigelCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("StatigelCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/StatigelCandle.cs b/Tiles/StatigelCandle.cs index 12795205bc..aa9fab7679 100644 --- a/Tiles/StatigelCandle.cs +++ b/Tiles/StatigelCandle.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class StatigelCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Candle"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("StatigelCandle"); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("StatigelCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class StatigelCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Candle"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("StatigelCandle"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("StatigelCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/StatigelChair.cs b/Tiles/StatigelChair.cs index 7c5ec1212b..0bc12b4201 100644 --- a/Tiles/StatigelChair.cs +++ b/Tiles/StatigelChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("StatigelChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("StatigelChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelChair")); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelChandelier.cs b/Tiles/StatigelChandelier.cs index 90375fee07..fd05f19d36 100644 --- a/Tiles/StatigelChandelier.cs +++ b/Tiles/StatigelChandelier.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("StatigelChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("StatigelChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/StatigelChest.cs b/Tiles/StatigelChest.cs index 4cd08f36c9..1c3cf6007f 100644 --- a/Tiles/StatigelChest.cs +++ b/Tiles/StatigelChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelChest : 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("Statigel Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Statigel Chest"; - chestDrop = mod.ItemType("StatigelChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Statigel Chest"; - if (player.showItemIconText == "Statigel Chest") - { - player.showItemIcon2 = mod.ItemType("StatigelChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelChest : 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("Statigel Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Statigel Chest"; + chestDrop = mod.ItemType("StatigelChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Statigel Chest"; + if (player.showItemIconText == "Statigel Chest") + { + player.showItemIcon2 = mod.ItemType("StatigelChest"); + 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 diff --git a/Tiles/StatigelClock.cs b/Tiles/StatigelClock.cs index c16f755f5e..c88907218e 100644 --- a/Tiles/StatigelClock.cs +++ b/Tiles/StatigelClock.cs @@ -1,104 +1,104 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StatigelClock")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelClock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StatigelClock")); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelDoorClosed.cs b/Tiles/StatigelDoorClosed.cs index 9b07a295ec..294caebd7d 100644 --- a/Tiles/StatigelDoorClosed.cs +++ b/Tiles/StatigelDoorClosed.cs @@ -1,73 +1,73 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - // TODO: Smart Cursor Outlines and tModLoader support - public class StatigelDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("StatigelDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("StatigelDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + // TODO: Smart Cursor Outlines and tModLoader support + public class StatigelDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("StatigelDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("StatigelDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelDoorOpen.cs b/Tiles/StatigelDoorOpen.cs index a9d17442f8..badb5c4df1 100644 --- a/Tiles/StatigelDoorOpen.cs +++ b/Tiles/StatigelDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("StatigelDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("StatigelDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StatigelDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("StatigelDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("StatigelDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StatigelDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/StatigelDresser.cs b/Tiles/StatigelDresser.cs index a856e99343..d50cc11cf1 100644 --- a/Tiles/StatigelDresser.cs +++ b/Tiles/StatigelDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class StatigelDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("StatigelDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "StatigelDresser"; - dresserDrop = mod.ItemType("StatigelDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StatigelDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("StatigelDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class StatigelDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("StatigelDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "StatigelDresser"; + dresserDrop = mod.ItemType("StatigelDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StatigelDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("StatigelDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/StatigelLamp.cs b/Tiles/StatigelLamp.cs index b1076a512e..ddd59f3b8c 100644 --- a/Tiles/StatigelLamp.cs +++ b/Tiles/StatigelLamp.cs @@ -1,85 +1,85 @@ -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 -{ - class StatigelLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class StatigelLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/StatigelLantern.cs b/Tiles/StatigelLantern.cs index 74ce4a04a0..72c3528402 100644 --- a/Tiles/StatigelLantern.cs +++ b/Tiles/StatigelLantern.cs @@ -1,83 +1,83 @@ -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 -{ - class StatigelLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class StatigelLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/StatigelPiano.cs b/Tiles/StatigelPiano.cs index c22ce9dd61..68a977cfd0 100644 --- a/Tiles/StatigelPiano.cs +++ b/Tiles/StatigelPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class StatigelPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelPiano")); - } - } -} +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 +{ + class StatigelPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelPiano")); + } + } +} diff --git a/Tiles/StatigelPlatform.cs b/Tiles/StatigelPlatform.cs index 0e5db62695..a86096a477 100644 --- a/Tiles/StatigelPlatform.cs +++ b/Tiles/StatigelPlatform.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelPlatform : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileSolidTop[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.Platforms[Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - AddMapEntry(new Color(200, 200, 200)); - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StatigelPlatform"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Platforms }; - } - - public override void PostSetDefaults() - { - Main.tileNoSunLight[Type] = false; - } - - 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; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelPlatform : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.Platforms[Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[]{ 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + AddMapEntry(new Color(200, 200, 200)); + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("StatigelPlatform"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/StatigelSink.cs b/Tiles/StatigelSink.cs index dd03e2e9a7..e3c6c2b6b5 100644 --- a/Tiles/StatigelSink.cs +++ b/Tiles/StatigelSink.cs @@ -1,31 +1,31 @@ -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 -{ - class StatigelSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSink")); - } - } -} +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 +{ + class StatigelSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSink")); + } + } +} diff --git a/Tiles/StatigelSofa.cs b/Tiles/StatigelSofa.cs index d8e4d3c668..41b19e1e51 100644 --- a/Tiles/StatigelSofa.cs +++ b/Tiles/StatigelSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class StatigelSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSofa")); - } - } -} +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 +{ + class StatigelSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelSofa")); + } + } +} diff --git a/Tiles/StatigelTable.cs b/Tiles/StatigelTable.cs index 99154deb4f..7bd0c14b8b 100644 --- a/Tiles/StatigelTable.cs +++ b/Tiles/StatigelTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class StatigelTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class StatigelTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelTable")); + } + } +} diff --git a/Tiles/StatigelWorkbench.cs b/Tiles/StatigelWorkbench.cs index e72643487e..1604f3971d 100644 --- a/Tiles/StatigelWorkbench.cs +++ b/Tiles/StatigelWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class StatigelWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Statigel Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StatigelWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class StatigelWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Statigel Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StatigelWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/StormWeaverMusicbox.cs b/Tiles/StormWeaverMusicbox.cs index 63b5d2d83b..98919ef8b0 100644 --- a/Tiles/StormWeaverMusicbox.cs +++ b/Tiles/StormWeaverMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class StormWeaverMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StormWeaverMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("StormWeaverMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class StormWeaverMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("StormWeaverMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("StormWeaverMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/SulphurousMusicbox.cs b/Tiles/SulphurousMusicbox.cs index ad2353470d..cb89e9e9c8 100644 --- a/Tiles/SulphurousMusicbox.cs +++ b/Tiles/SulphurousMusicbox.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class SulphurousMusicbox : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.DrawYOffset = 2; - TileObjectData.addTile(Type); - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SulphurousMusicbox")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("SulphurousMusicbox"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class SulphurousMusicbox : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Music Box"); + AddMapEntry(new Color(200, 200, 200), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType("SulphurousMusicbox")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("SulphurousMusicbox"); + } + } } \ No newline at end of file diff --git a/Tiles/SulphurousSand.cs b/Tiles/SulphurousSand.cs index c984cdfbea..ade997740f 100644 --- a/Tiles/SulphurousSand.cs +++ b/Tiles/SulphurousSand.cs @@ -1,195 +1,195 @@ -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 = 54; - 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, j + 1] != null) - { - if (!Main.tile[i, j + 1].active()) - { - if (Main.tile[i, j + 1].liquid < 255) - { - Main.tile[i, j + 1].liquid = 255; - Main.tile[i, j + 1].lava(false); - } - } - } - 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); - } - } - } - } - } - } - } - } - } +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 = 54; + 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, j + 1] != null) + { + if (!Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].liquid < 255) + { + Main.tile[i, j + 1].liquid = 255; + Main.tile[i, j + 1].lava(false); + } + } + } + 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 diff --git a/Tiles/Tenebris.cs b/Tiles/Tenebris.cs index 6a8587ed8e..f54d98987e 100644 --- a/Tiles/Tenebris.cs +++ b/Tiles/Tenebris.cs @@ -1,89 +1,89 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -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 = 199; - soundType = 21; - } - - 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 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) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 690 : 0); - if (NPC.downedPlantBoss) - { - 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].liquid == 255 && - (Main.tile[i, j].type == (ushort)mod.TileType("PlantyMush") || (Main.tile[i, j].type == (ushort)mod.TileType("AbyssGravel") && Main.rand.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); - } - } - } - } - } - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 = 199; + soundType = 21; + } + + 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 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) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 690 : 0); + if (NPC.downedPlantBoss) + { + 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].liquid == 255 && + (Main.tile[i, j].type == (ushort)mod.TileType("PlantyMush") || (Main.tile[i, j].type == (ushort)mod.TileType("AbyssGravel") && Main.rand.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 diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 8b54adc7e9..82c91c15f0 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class UelibloomBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; - Main.tileBlockLight[Type] = true; - dustType = mod.DustType("TCESparkle"); - drop = mod.ItemType("UelibloomBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Uelibloom Brick"); - AddMapEntry(new Color(0, 255, 0), name); - soundType = 21; - } - - 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 UelibloomBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = mod.DustType("TCESparkle"); + drop = mod.ItemType("UelibloomBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Uelibloom Brick"); + AddMapEntry(new Color(0, 255, 0), name); + soundType = 21; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs index 2a96d9fc8a..7430f7cc0a 100644 --- a/Tiles/UelibloomOre.cs +++ b/Tiles/UelibloomOre.cs @@ -1,41 +1,41 @@ -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; - 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 = 249; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 805 : 0); - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedMoonlord; - } - - 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 UelibloomOre : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + 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 = 249; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override void RandomUpdate(int i, int j) + { + Main.tileValue[Type] = (short)(Main.hardMode ? 805 : 0); + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedMoonlord; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } } \ No newline at end of file diff --git a/Tiles/ViperVines.cs b/Tiles/ViperVines.cs index 5fc6456c86..c9d5858272 100644 --- a/Tiles/ViperVines.cs +++ b/Tiles/ViperVines.cs @@ -1,71 +1,71 @@ -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 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()) - { - if (Main.tile[i, j + 1].liquid == 255 && - (Main.tile[i, j + 1].wall == (byte)mod.WallType("MossyGravelWall") || - Main.tile[i, j + 1].wall == (byte)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); - } - } - } - } - } - } - } +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 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()) + { + if (Main.tile[i, j + 1].liquid == 255 && + (Main.tile[i, j + 1].wall == (byte)mod.WallType("MossyGravelWall") || + Main.tile[i, j + 1].wall == (byte)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 diff --git a/Tiles/VoidBath.cs b/Tiles/VoidBath.cs index ad715614ee..4d63c3e5e2 100644 --- a/Tiles/VoidBath.cs +++ b/Tiles/VoidBath.cs @@ -1,32 +1,32 @@ -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 -{ - class VoidBath : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Bath"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidBath")); - } - } -} +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 +{ + class VoidBath : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Bath"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidBath")); + } + } +} diff --git a/Tiles/VoidBed.cs b/Tiles/VoidBed.cs index 58ad310f2e..a936e2a656 100644 --- a/Tiles/VoidBed.cs +++ b/Tiles/VoidBed.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidBed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Bed"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Beds }; - bed = true; - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 64, 32, mod.ItemType("VoidBed")); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidBed"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidBed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Bed"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Beds }; + bed = true; + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 64, 32, mod.ItemType("VoidBed")); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidBed"); + } + } } \ No newline at end of file diff --git a/Tiles/VoidBookcase.cs b/Tiles/VoidBookcase.cs index 1ed6b50edb..6491d71a8b 100644 --- a/Tiles/VoidBookcase.cs +++ b/Tiles/VoidBookcase.cs @@ -1,33 +1,33 @@ -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 -{ - class VoidBookcase : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Bookcase"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidBookcase")); - } - } -} +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 +{ + class VoidBookcase : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Bookcase"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + adjTiles = new int[] { TileID.Bookcases }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidBookcase")); + } + } +} diff --git a/Tiles/VoidCandelabra.cs b/Tiles/VoidCandelabra.cs index 673d011cc1..46cbe1c82a 100644 --- a/Tiles/VoidCandelabra.cs +++ b/Tiles/VoidCandelabra.cs @@ -1,85 +1,85 @@ -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 -{ - class VoidCandelabra : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Candelabra"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("VoidCandelabra")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 2; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 2; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 36) - { - Main.tile[l, m].frameX += 36; - } - else - { - Main.tile[l, m].frameX -= 36; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class VoidCandelabra : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Candelabra"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("VoidCandelabra")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 2; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 36) + { + Main.tile[l, m].frameX += 36; + } + else + { + Main.tile[l, m].frameX -= 36; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/VoidCandle.cs b/Tiles/VoidCandle.cs index 1e8170c2d6..39e53fb311 100644 --- a/Tiles/VoidCandle.cs +++ b/Tiles/VoidCandle.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Enums; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class VoidCandle : 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); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Candle"); - AddMapEntry(new Color(238, 145, 105), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - drop = mod.ItemType("VoidCandle"); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("VoidCandle")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 1; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 1; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class VoidCandle : 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); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Candle"); + AddMapEntry(new Color(238, 145, 105), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + drop = mod.ItemType("VoidCandle"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("VoidCandle")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 1; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 1; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/VoidChair.cs b/Tiles/VoidChair.cs index 17e7b0937b..688427a44f 100644 --- a/Tiles/VoidChair.cs +++ b/Tiles/VoidChair.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidChair : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture - TileObjectData.newTile.StyleMultiplier = 2; //same as above - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player - TileObjectData.addAlternate(1); //facing right will use the second texture style - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("VoidChair"); - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Sparkle"); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.Chairs }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidChair")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidChair : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; //not really necessary but allows me to add more subtypes of chairs below the example chair texture + TileObjectData.newTile.StyleMultiplier = 2; //same as above + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player + TileObjectData.addAlternate(1); //facing right will use the second texture style + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("VoidChair"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Sparkle"); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.Chairs }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidChair")); + } + } } \ No newline at end of file diff --git a/Tiles/VoidChandelier.cs b/Tiles/VoidChandelier.cs index 460737fe09..b58f26e0da 100644 --- a/Tiles/VoidChandelier.cs +++ b/Tiles/VoidChandelier.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidChandelier : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Chandelier"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Torches }; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("VoidChandelier")); - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 3; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 3; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 54) - { - Main.tile[l, m].frameX += 54; - } - else - { - Main.tile[l, m].frameX -= 54; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - Wiring.SkipWire(x + 1, y); - Wiring.SkipWire(x + 1, y + 1); - Wiring.SkipWire(x + 1, y + 2); - Wiring.SkipWire(x + 2, y); - Wiring.SkipWire(x + 2, y + 1); - Wiring.SkipWire(x + 2, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidChandelier : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Chandelier"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Torches }; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("VoidChandelier")); + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 3; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 54) + { + Main.tile[l, m].frameX += 54; + } + else + { + Main.tile[l, m].frameX -= 54; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + Wiring.SkipWire(x + 1, y); + Wiring.SkipWire(x + 1, y + 1); + Wiring.SkipWire(x + 1, y + 2); + Wiring.SkipWire(x + 2, y); + Wiring.SkipWire(x + 2, y + 1); + Wiring.SkipWire(x + 2, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/VoidChest.cs b/Tiles/VoidChest.cs index 2bb47a9a68..7f1fc474de 100644 --- a/Tiles/VoidChest.cs +++ b/Tiles/VoidChest.cs @@ -1,200 +1,200 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidChest : 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("Void Chest"); - AddMapEntry(new Color(200, 200, 200), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Void Chest"; - chestDrop = mod.ItemType("VoidChest"); - } - - 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.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + 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) - { - 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 - { - 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; - 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 : "Void Chest"; - if (player.showItemIconText == "Void Chest") - { - player.showItemIcon2 = mod.ItemType("VoidChest"); - 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; - } - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidChest : 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("Void Chest"); + AddMapEntry(new Color(200, 200, 200), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Void Chest"; + chestDrop = mod.ItemType("VoidChest"); + } + + 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.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + 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) + { + 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 + { + 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; + 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 : "Void Chest"; + if (player.showItemIconText == "Void Chest") + { + player.showItemIcon2 = mod.ItemType("VoidChest"); + 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 diff --git a/Tiles/VoidClock.cs b/Tiles/VoidClock.cs index 0886fb8bd8..6ee5877728 100644 --- a/Tiles/VoidClock.cs +++ b/Tiles/VoidClock.cs @@ -1,115 +1,115 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidClock : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - animationFrameHeight = 90; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - // name.SetDefault("Example Clock"); // Automatic from .lang files - AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("Pixel"); - adjTiles = new int[] { TileID.GrandfatherClocks }; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 3) - { - frame = (frame + 1) % 10; - frameCounter = 0; - } - } - - public override void RightClick(int x, int y) - { - { - string text = "AM"; - //Get current weird time - double time = Main.time; - if (!Main.dayTime) - { - //if it's night add this number - time += 54000.0; - } - //Divide by seconds in a day * 24 - time = time / 86400.0 * 24.0; - //Dunno why we're taking 19.5. Something about hour formatting - time = time - 7.5 - 12.0; - //Format in readable time - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - text = "PM"; - } - int intTime = (int)time; - //Get the decimal points of time. - double deltaTime = time - intTime; - //multiply them by 60. Minutes, probably - deltaTime = ((int)(deltaTime * 60.0)); - //This could easily be replaced by deltaTime.ToString() - string text2 = string.Concat(deltaTime); - if (deltaTime < 10.0) - { - //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) - text2 = "0" + text2; - } - if (intTime > 12) - { - //This is for AM/PM time rather than 24hour time - intTime -= 12; - } - if (intTime == 0) - { - //0AM = 12AM - intTime = 12; - } - //Whack it all together to get a HH:MM format - var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); - Main.NewText(newText, 255, 240, 20); - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Main.clock = true; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("VoidClock")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidClock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + animationFrameHeight = 90; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + // name.SetDefault("Example Clock"); // Automatic from .lang files + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("Pixel"); + adjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 3) + { + frame = (frame + 1) % 10; + frameCounter = 0; + } + } + + public override void RightClick(int x, int y) + { + { + string text = "AM"; + //Get current weird time + double time = Main.time; + if (!Main.dayTime) + { + //if it's night add this number + time += 54000.0; + } + //Divide by seconds in a day * 24 + time = time / 86400.0 * 24.0; + //Dunno why we're taking 19.5. Something about hour formatting + time = time - 7.5 - 12.0; + //Format in readable time + if (time < 0.0) + { + time += 24.0; + } + if (time >= 12.0) + { + text = "PM"; + } + int intTime = (int)time; + //Get the decimal points of time. + double deltaTime = time - intTime; + //multiply them by 60. Minutes, probably + deltaTime = ((int)(deltaTime * 60.0)); + //This could easily be replaced by deltaTime.ToString() + string text2 = string.Concat(deltaTime); + if (deltaTime < 10.0) + { + //if deltaTime is eg "1" (which would cause time to display as HH:M instead of HH:MM) + text2 = "0" + text2; + } + if (intTime > 12) + { + //This is for AM/PM time rather than 24hour time + intTime -= 12; + } + if (intTime == 0) + { + //0AM = 12AM + intTime = 12; + } + //Whack it all together to get a HH:MM format + var newText = string.Concat("Time: ", intTime, ":", text2, " ", text); + Main.NewText(newText, 255, 240, 20); + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.clock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("VoidClock")); + } + } } \ No newline at end of file diff --git a/Tiles/VoidCondenser.cs b/Tiles/VoidCondenser.cs index 769ca114c2..88cfab3eb5 100644 --- a/Tiles/VoidCondenser.cs +++ b/Tiles/VoidCondenser.cs @@ -1,124 +1,124 @@ -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 -{ - class VoidCondenser : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Condenser"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 54; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 3) - { - frame = (frame + 1) % 28; - frameCounter = 0; - } - } - - // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. - /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - // Flips the sprite - SpriteEffects effects = SpriteEffects.None; - if (i % 2 == 1) - { - effects = SpriteEffects.FlipHorizontally; - } - - // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. - int k = Main.tileFrame[Type] + i % 6; - if (i % 2 == 0) - { - k += 3; - } - if (i % 3 == 0) - { - k += 3; - } - if (i % 4 == 0) - { - k += 3; - } - k = k % 6; - - Tile tile = Main.tile[i, j]; - Texture2D texture; - if (Main.canDrawColorTile(i, j)) - { - texture = Main.tileAltTexture[Type, (int)tile.color()]; - } - else - { - texture = Main.tileTexture[Type]; - } - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - int animate = k * animationFrameWidth; - - Main.spriteBatch.Draw( - texture, - new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, - new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), - Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); - - return false; // return false to stop vanilla draw. - }*/ - - // public override void AnimateTile(ref int frame, ref int frameCounter) - //{ - // /*frameCounter++; - // if (frameCounter > 8) - // { - // frameCounter = 0; - // frame++; - // if (frame > 5) - // { - // frame = 0; - // } - // }*/ - // // Above code works, but since we are just mimicking another tile, we can just use the same value. - // frame = Main.tileFrame[TileID.FireflyinaBottle]; - //} - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidCondenser")); - } - } - - //class ExampleAnimatedTileItem : ModItem - //{ - // public override void SetStaticDefaults() - // { - // DisplayName.SetDefault("Red Firefly in a Bottle"); - // } - - // public override void SetDefaults() - // { - // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = mod.TileType(); - // } - //} -} +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 +{ + class VoidCondenser : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Condenser"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 54; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 3) + { + frame = (frame + 1) % 28; + frameCounter = 0; + } + } + + // Below is an example completely manually drawing a tile. It shows some interesting concepts that may be useful for more advanced things. + /*public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + // Flips the sprite + SpriteEffects effects = SpriteEffects.None; + if (i % 2 == 1) + { + effects = SpriteEffects.FlipHorizontally; + } + + // Tweak the frame drawn by x position so tiles next to each other are off-sync and look much more interesting. + int k = Main.tileFrame[Type] + i % 6; + if (i % 2 == 0) + { + k += 3; + } + if (i % 3 == 0) + { + k += 3; + } + if (i % 4 == 0) + { + k += 3; + } + k = k % 6; + + Tile tile = Main.tile[i, j]; + Texture2D texture; + if (Main.canDrawColorTile(i, j)) + { + texture = Main.tileAltTexture[Type, (int)tile.color()]; + } + else + { + texture = Main.tileTexture[Type]; + } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int animate = k * animationFrameWidth; + + Main.spriteBatch.Draw( + texture, + new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, + new Rectangle(tile.frameX + animate, tile.frameY, 16, 16), + Lighting.GetColor(i, j), 0f, default(Vector2), 1f, effects, 0f); + + return false; // return false to stop vanilla draw. + }*/ + + // public override void AnimateTile(ref int frame, ref int frameCounter) + //{ + // /*frameCounter++; + // if (frameCounter > 8) + // { + // frameCounter = 0; + // frame++; + // if (frame > 5) + // { + // frame = 0; + // } + // }*/ + // // Above code works, but since we are just mimicking another tile, we can just use the same value. + // frame = Main.tileFrame[TileID.FireflyinaBottle]; + //} + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidCondenser")); + } + } + + //class ExampleAnimatedTileItem : ModItem + //{ + // public override void SetStaticDefaults() + // { + // DisplayName.SetDefault("Red Firefly in a Bottle"); + // } + + // public override void SetDefaults() + // { + // item.CloneDefaults(ItemID.FireflyinaBottle); + // item.createTile = mod.TileType(); + // } + //} +} diff --git a/Tiles/VoidDoorClosed.cs b/Tiles/VoidDoorClosed.cs index b5e6e803cb..fe66f123f5 100644 --- a/Tiles/VoidDoorClosed.cs +++ b/Tiles/VoidDoorClosed.cs @@ -1,72 +1,72 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidDoorClosed : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.NotReallySolid[Type] = true; - TileID.Sets.DrawsWalls[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.ClosedDoor }; - openDoorID = mod.TileType("VoidDoorOpen"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 16, 48, mod.ItemType("VoidDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidDoorClosed : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.NotReallySolid[Type] = true; + TileID.Sets.DrawsWalls[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.ClosedDoor }; + openDoorID = mod.TileType("VoidDoorOpen"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 16, 48, mod.ItemType("VoidDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/VoidDoorOpen.cs b/Tiles/VoidDoorOpen.cs index 9015fa4003..55f53c4505 100644 --- a/Tiles/VoidDoorOpen.cs +++ b/Tiles/VoidDoorOpen.cs @@ -1,92 +1,92 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidDoorOpen : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLavaDeath[Type] = true; - Main.tileNoSunLight[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls - TileID.Sets.HasOutlines[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Door"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.OpenDoor }; - closeDoorID = mod.TileType("VoidDoorClosed"); - } - - public override bool HasSmartInteract() - { - return true; - } - - 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, 48, mod.ItemType("VoidDoor")); - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("VoidDoor"); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidDoorOpen : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = true; + Main.tileNoSunLight[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls + TileID.Sets.HasOutlines[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Door"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.OpenDoor }; + closeDoorID = mod.TileType("VoidDoorClosed"); + } + + public override bool HasSmartInteract() + { + return true; + } + + 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, 48, mod.ItemType("VoidDoor")); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("VoidDoor"); + } + } } \ No newline at end of file diff --git a/Tiles/VoidDresser.cs b/Tiles/VoidDresser.cs index a0ec0f677e..19aa71a65f 100644 --- a/Tiles/VoidDresser.cs +++ b/Tiles/VoidDresser.cs @@ -1,232 +1,232 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.DataStructures; - -namespace CalamityMod.Tiles -{ - public class VoidDresser : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileContainer[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - 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); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("VoidDresser"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Dressers }; - dresser = "VoidDresser"; - dresserDrop = mod.ItemType("VoidDresser"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - Main.mouseRightRelease = false; - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - 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) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - 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 - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - } - } - - public override void MouseOverFar(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) - { - top--; - } - int num138 = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (num138 < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[num138].name != "") - { - player.showItemIconText = Main.chest[num138].name; - } - else - { - player.showItemIconText = chest; - } - if (player.showItemIconText == chest) - { - player.showItemIcon2 = mod.ItemType("VoidDresser"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); - Chest.DestroyChest(i, j); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; + +namespace CalamityMod.Tiles +{ + public class VoidDresser : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileContainer[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + 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); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("VoidDresser"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Dressers }; + dresser = "VoidDresser"; + dresserDrop = mod.ItemType("VoidDresser"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + Main.mouseRightRelease = false; + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + 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) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + 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 + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + } + } + + public override void MouseOverFar(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.frameX % 54 / 18); + if (tile.frameY % 36 != 0) + { + top--; + } + int num138 = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (num138 < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[num138].name != "") + { + player.showItemIconText = Main.chest[num138].name; + } + else + { + player.showItemIconText = chest; + } + if (player.showItemIconText == chest) + { + player.showItemIcon2 = mod.ItemType("VoidDresser"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/VoidLamp.cs b/Tiles/VoidLamp.cs index 3a4de7ee8f..3a4e2056b4 100644 --- a/Tiles/VoidLamp.cs +++ b/Tiles/VoidLamp.cs @@ -1,85 +1,85 @@ -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 -{ - class VoidLamp : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Lamp"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidLamp")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } - else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 3; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 3; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - Wiring.SkipWire(x, y + 2); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class VoidLamp : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Lamp"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidLamp")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 3; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + Wiring.SkipWire(x, y + 2); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/VoidLantern.cs b/Tiles/VoidLantern.cs index 887bb95ace..d449339e41 100644 --- a/Tiles/VoidLantern.cs +++ b/Tiles/VoidLantern.cs @@ -1,83 +1,83 @@ -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 -{ - class VoidLantern : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Lantern"); - AddMapEntry(new Color(238, 145, 105), name); - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Torches }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidLantern")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - if (Main.tile[i, j].frameX < 18) - { - r = 0.8f; - g = 0.9f; - b = 1f; - } else - { - r = 0f; - g = 0f; - b = 0f; - } - } - - public override void HitWire(int i, int j) - { - int x = i - (Main.tile[i, j].frameX / 18) % 1; - int y = j - (Main.tile[i, j].frameY / 18) % 2; - for (int l = x; l < x + 1; l++) - { - for (int m = y; m < y + 2; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) - { - if (Main.tile[l, m].frameX < 18) - { - Main.tile[l, m].frameX += 18; - } - else - { - Main.tile[l, m].frameX -= 18; - } - } - } - } - if (Wiring.running) - { - Wiring.SkipWire(x, y); - Wiring.SkipWire(x, y + 1); - } - //NetMessage.SendTileSquare(-1, x, y + 1, 3); - } - } -} +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 +{ + class VoidLantern : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Lantern"); + AddMapEntry(new Color(238, 145, 105), name); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Torches }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidLantern")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].frameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + int x = i - (Main.tile[i, j].frameX / 18) % 1; + int y = j - (Main.tile[i, j].frameY / 18) % 2; + for (int l = x; l < x + 1; l++) + { + for (int m = y; m < y + 2; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == Type) + { + if (Main.tile[l, m].frameX < 18) + { + Main.tile[l, m].frameX += 18; + } + else + { + Main.tile[l, m].frameX -= 18; + } + } + } + } + if (Wiring.running) + { + Wiring.SkipWire(x, y); + Wiring.SkipWire(x, y + 1); + } + //NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + } +} diff --git a/Tiles/VoidPiano.cs b/Tiles/VoidPiano.cs index a28012bebd..00e271c855 100644 --- a/Tiles/VoidPiano.cs +++ b/Tiles/VoidPiano.cs @@ -1,31 +1,31 @@ -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 -{ - class VoidPiano : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Piano"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidPiano")); - } - } -} +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 +{ + class VoidPiano : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Piano"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidPiano")); + } + } +} diff --git a/Tiles/VoidSink.cs b/Tiles/VoidSink.cs index 4201b1df66..ee2c9a2c18 100644 --- a/Tiles/VoidSink.cs +++ b/Tiles/VoidSink.cs @@ -1,31 +1,31 @@ -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 -{ - class VoidSink : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Sink"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSink")); - } - } -} +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 +{ + class VoidSink : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Sink"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSink")); + } + } +} diff --git a/Tiles/VoidSofa.cs b/Tiles/VoidSofa.cs index 72ee505a1d..43bcba779b 100644 --- a/Tiles/VoidSofa.cs +++ b/Tiles/VoidSofa.cs @@ -1,31 +1,31 @@ -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 -{ - class VoidSofa : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Sofa"); - AddMapEntry(new Color(238, 145, 105), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSofa")); - } - } -} +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 +{ + class VoidSofa : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Sofa"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidSofa")); + } + } +} diff --git a/Tiles/VoidTable.cs b/Tiles/VoidTable.cs index 5c7f7b29ba..3a4a3a9a1e 100644 --- a/Tiles/VoidTable.cs +++ b/Tiles/VoidTable.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - class VoidTable : ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Table"); - AddMapEntry(new Color(238, 145, 105), name); - adjTiles = new int[] { TileID.Tables }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidTable")); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + class VoidTable : ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Table"); + AddMapEntry(new Color(238, 145, 105), name); + adjTiles = new int[] { TileID.Tables }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidTable")); + } + } +} diff --git a/Tiles/VoidWorkbench.cs b/Tiles/VoidWorkbench.cs index 0c6c82273c..c551a51bcd 100644 --- a/Tiles/VoidWorkbench.cs +++ b/Tiles/VoidWorkbench.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class VoidWorkbench: ModTile - { - public override void SetDefaults() - { - Main.tileSolidTop[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Void Workbench"); - AddMapEntry(new Color(200, 200, 200), name); - disableSmartCursor = true; - adjTiles = new int[]{ TileID.WorkBenches }; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("VoidWorkbench")); - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class VoidWorkbench: ModTile + { + public override void SetDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Void Workbench"); + AddMapEntry(new Color(200, 200, 200), name); + disableSmartCursor = true; + adjTiles = new int[]{ TileID.WorkBenches }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("VoidWorkbench")); + } + } } \ No newline at end of file diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index 634cb1e0d8..bf9255da15 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -1,44 +1,44 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class Voidstone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("Voidstone"); - AddMapEntry(new Color(10, 10, 10)); - mineResist = 10f; - minPick = 189; - soundType = 21; - dustType = 187; - } - - 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); - } - } - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class Voidstone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("Voidstone"); + AddMapEntry(new Color(10, 10, 10)); + mineResist = 10f; + minPick = 189; + soundType = 21; + dustType = 187; + } + + 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); + } + } + } + } } \ No newline at end of file diff --git a/Tiles/VoidstoneSlab.cs b/Tiles/VoidstoneSlab.cs index d22aaca325..a39a2fbc1b 100644 --- a/Tiles/VoidstoneSlab.cs +++ b/Tiles/VoidstoneSlab.cs @@ -1,96 +1,96 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class VoidstoneSlab : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("VoidstoneSlab"); - AddMapEntry(new Color(100, 100, 150)); - animationFrameHeight = 270; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //So the basic summary of how this works is that for each possible state there is a unique tile sheet - //for every single unique position. This, as opposed to animating, is used to set which tile sheet is - //used for each tile position. Think of it as a grid, only converted into a single axis. - //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the - //final 3 are the last row. Simple. So for determining the y offset, 1 is added to - //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where - //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. - //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so - //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the - //maximum number of variants is 7. A tile sheet can be used multiple times (although this - //will disrupt the easy to understand arrangement of the tiles in the megasheet. - //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to - //either i (x) or j (y). Test if that modulo is equal to the target position (for example: - //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) - int uniqueAnimationFrame = Main.tileFrame[Type] + i; - int xPos = i % 3; - int yPos = j % 3; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 0; - break; - case 1: - uniqueAnimationFrame = 1; - break; - case 2: - uniqueAnimationFrame = 2; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 2; - break; - case 1: - uniqueAnimationFrame = 3; - break; - case 2: - uniqueAnimationFrame = 4; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrame = 4; - break; - case 1: - uniqueAnimationFrame = 0; - break; - case 2: - uniqueAnimationFrame = 1; - break; - default: - uniqueAnimationFrame = 0; - break; - } - break; - } - - frameYOffset = uniqueAnimationFrame * animationFrameHeight; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class VoidstoneSlab : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("VoidstoneSlab"); + AddMapEntry(new Color(100, 100, 150)); + animationFrameHeight = 270; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + //So the basic summary of how this works is that for each possible state there is a unique tile sheet + //for every single unique position. This, as opposed to animating, is used to set which tile sheet is + //used for each tile position. Think of it as a grid, only converted into a single axis. + //Say you have a 3 x 3 grid. The 3 tile sheetes are 1 row, the next three are the next row and the + //final 3 are the last row. Simple. So for determining the y offset, 1 is added to + //uniqueAnimationFrame, and the x dimension of the gid is added to determine the x offset of where + //the tile will appear. Set the relevant uniqueAnimationFrame to equal this value. + //There needs to be a tile sheet for each tile in the grid though, assuming that none are rused, so + //the grid can only be so big due to sheet size limitations. Unless tile sheets are recycled, the + //maximum number of variants is 7. A tile sheet can be used multiple times (although this + //will disrupt the easy to understand arrangement of the tiles in the megasheet. + //When testing for a tile position in the grid, apply a modulo (%) of the dimension in the axis to + //either i (x) or j (y). Test if that modulo is equal to the target position (for example: + //if (i % 4 == 0 && j % 4 == 2) will be for the tile at 0, 2 in a 4x4 grid) + int uniqueAnimationFrame = Main.tileFrame[Type] + i; + int xPos = i % 3; + int yPos = j % 3; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrame = 0; + break; + case 1: + uniqueAnimationFrame = 1; + break; + case 2: + uniqueAnimationFrame = 2; + break; + default: + uniqueAnimationFrame = 0; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrame = 2; + break; + case 1: + uniqueAnimationFrame = 3; + break; + case 2: + uniqueAnimationFrame = 4; + break; + default: + uniqueAnimationFrame = 0; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrame = 4; + break; + case 1: + uniqueAnimationFrame = 0; + break; + case 2: + uniqueAnimationFrame = 1; + break; + default: + uniqueAnimationFrame = 0; + break; + } + break; + } + + frameYOffset = uniqueAnimationFrame * animationFrameHeight; + } + } } \ No newline at end of file diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 3017b32620..1f5e08b8e9 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,202 +1,202 @@ -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 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 = CalamityPlayer.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 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 = CalamityPlayer.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 fe0c58d91c..de29822511 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,1066 +1,1066 @@ -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"); - HPBarFont = mod.GetFont("Fonts/HPBarFont"); - } - - 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(); - - //True Eye of Cthulhu, can't kill em so - 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("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); - MinibossHPBarList.Add(NPCID.DD2DarkMageT3); - - //Prehardmode - MinibossHPBarList.Add(NPCID.DungeonGuardian); - - //Hardmode - MinibossHPBarList.Add(NPCID.GoblinSummoner); - 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("Cnidrion")); - - //Hardmode - MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); - MinibossHPBarList.Add(calamity.NPCType("Horse")); - MinibossHPBarList.Add(calamity.NPCType("GreatSandShark")); - MinibossHPBarList.Add(calamity.NPCType("PlaguebringerShade")); - - //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) - 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"); + HPBarFont = mod.GetFont("Fonts/HPBarFont"); + } + + 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(); + + //True Eye of Cthulhu, can't kill em so + 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("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); + MinibossHPBarList.Add(NPCID.DD2DarkMageT3); + + //Prehardmode + MinibossHPBarList.Add(NPCID.DungeonGuardian); + + //Hardmode + MinibossHPBarList.Add(NPCID.GoblinSummoner); + 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("Cnidrion")); + + //Hardmode + MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); + MinibossHPBarList.Add(calamity.NPCType("Horse")); + MinibossHPBarList.Add(calamity.NPCType("GreatSandShark")); + MinibossHPBarList.Add(calamity.NPCType("PlaguebringerShade")); + + //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) + 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 52c690d182..c2b71f0e80 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 = 500f, posY = 30f; //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(); - } - } - } +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 = 500f, posY = 30f; //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 diff --git a/UI/UIBar2.cs b/UI/UIBar2.cs index 90a4027401..41912655aa 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 = 650f, posY = 30f; //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(); - } - } - } +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 = 650f, posY = 30f; //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 diff --git a/UI/UIImage.cs b/UI/UIImage.cs index 214f6a16eb..f80f0dca4f 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); - } - } +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 diff --git a/UIHandler.cs b/UIHandler.cs index 9b9b0a37f6..4ef26f6f74 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/BarStressBorder"), 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); - } - } +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/BarStressBorder"), 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 diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 76c21df637..c00bba5202 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; - } - } +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 diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs index 5489709a28..0aa78f447d 100644 --- a/Walls/AerialiteBrickWall.cs +++ b/Walls/AerialiteBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AerialiteBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("AerialiteBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Aerialite Brick Wall"); - AddMapEntry(new Color(0, 255, 255), name); - dustType = mod.DustType("AHSparkle"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AerialiteBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("AerialiteBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Aerialite Brick Wall"); + AddMapEntry(new Color(0, 255, 255), name); + dustType = mod.DustType("AHSparkle"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } } \ No newline at end of file diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs index d66d6fc710..f062431d3d 100644 --- a/Walls/AstralBrickWall.cs +++ b/Walls/AstralBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AstralBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("AstralBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Brick Wall"); - AddMapEntry(new Color(255, 153, 255), name); - dustType = 173; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AstralBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("AstralBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Brick Wall"); + AddMapEntry(new Color(255, 153, 255), name); + dustType = 173; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } } \ No newline at end of file diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 20d0e9b9da..a905a9c2f9 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; - } - } +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 diff --git a/Walls/ChaoticBrickWall.cs b/Walls/ChaoticBrickWall.cs index 280b3ac9e4..78921613bc 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; - } - } +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 diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index add85c5e27..f01c855f65 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; - } - } +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 diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs index f8a9503673..6a4b0bbd6a 100644 --- a/Walls/CosmiliteBrickWall.cs +++ b/Walls/CosmiliteBrickWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index 4cb14e4201..3d59801bb0 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class CryonicBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("CryonicBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cryonic Brick Wall"); - AddMapEntry(new Color(0, 0, 150), name); - dustType = mod.DustType("MSparkle"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class CryonicBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("CryonicBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cryonic Brick Wall"); + AddMapEntry(new Color(0, 0, 150), name); + dustType = mod.DustType("MSparkle"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } } \ No newline at end of file diff --git a/Walls/MossyGravelWall.cs b/Walls/MossyGravelWall.cs index 734343fe94..0a9c182ace 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; - } - } +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 diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 82b012cd71..ea61a1ca01 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class PerennialBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("PerennialBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Perennial Brick Wall"); - AddMapEntry(new Color(200, 250, 100), name); - dustType = mod.DustType("CESparkle"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class PerennialBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("PerennialBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Perennial Brick Wall"); + AddMapEntry(new Color(200, 250, 100), name); + dustType = mod.DustType("CESparkle"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } } \ No newline at end of file diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs index 39903946c9..13167a9f18 100644 --- a/Walls/ProfanedCrystalWall.cs +++ b/Walls/ProfanedCrystalWall.cs @@ -1,22 +1,22 @@ -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"); - drop = mod.ItemType("ProfanedCrystalWall"); - AddMapEntry(new Color(5, 5, 5)); - } - - 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.ModLoader; + +namespace CalamityMod.Walls +{ + public class ProfanedCrystalWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedCrystalWall"); + 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 diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs index 447b0f2d3e..3bb493011d 100644 --- a/Walls/ProfanedRockWall.cs +++ b/Walls/ProfanedRockWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index f6831b3d1e..5906d7ce56 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index a83de191d2..dd720a7d3f 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -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(5, 5, 5)); - } - - 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.ModLoader; + +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(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 diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs index b0cd882e73..7af8ca6d69 100644 --- a/Walls/SmoothAbyssGravelWall.cs +++ b/Walls/SmoothAbyssGravelWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs index 52dc06f688..47319b8c67 100644 --- a/Walls/SmoothBrimstoneSlagWall.cs +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class SmoothBrimstoneSlagWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("SmoothBrimstoneSlagWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Smooth 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; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SmoothBrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("SmoothBrimstoneSlagWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Smooth 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 diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs index 0083e2ab06..3c45a50c32 100644 --- a/Walls/SmoothVoidstoneWall.cs +++ b/Walls/SmoothVoidstoneWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs index c0511e4d50..dba924901a 100644 --- a/Walls/StatigelWall.cs +++ b/Walls/StatigelWall.cs @@ -1,22 +1,22 @@ -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(5, 5, 5)); - } - - 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.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(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 diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs index f5fe737b39..b1c13b6f41 100644 --- a/Walls/UelibloomBrickWall.cs +++ b/Walls/UelibloomBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class UelibloomBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("UelibloomBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Uelibloom Brick Wall"); - AddMapEntry(new Color(0, 255, 0), name); - dustType = mod.DustType("TCESparkle"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class UelibloomBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("UelibloomBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Uelibloom Brick Wall"); + AddMapEntry(new Color(0, 255, 0), name); + dustType = mod.DustType("TCESparkle"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } } \ No newline at end of file diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 07940f5268..9dab4dbd2a 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class VoidstoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = 187; - drop = mod.ItemType("VoidstoneWall"); - AddMapEntry(new Color(5, 5, 5)); - } - - 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.ModLoader; + +namespace CalamityMod.Walls +{ + public class VoidstoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = 187; + drop = mod.ItemType("VoidstoneWall"); + 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 diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index b0deea0c47..716f22a3d2 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; - } - } +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 diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index 2a0378155c..0599e1b8c0 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; - } - } +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 diff --git a/Waters/AbyssWaterflow.cs b/Waters/AbyssWaterflow.cs index f4192e988d..cb8ea57f8a 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 - { - - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class AbyssWaterflow : ModWaterfallStyle + { + + } } \ No newline at end of file diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 8f619638a4..e336646bcc 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,34 +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; - } - } +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 diff --git a/Waters/AstralWaterflow.cs b/Waters/AstralWaterflow.cs index 84624fb2ff..72665416b5 100644 --- a/Waters/AstralWaterflow.cs +++ b/Waters/AstralWaterflow.cs @@ -1,9 +1,8 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class AstralWaterflow : ModWaterfallStyle - { - } +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class AstralWaterflow : ModWaterfallStyle + { + } } \ No newline at end of file diff --git a/Waters/GreatSeaWater.cs b/Waters/GreatSeaWater.cs index 2f750de4ce..1f75ae6b62 100644 --- a/Waters/GreatSeaWater.cs +++ b/Waters/GreatSeaWater.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class GreatSeaWater : ModWaterStyle - { - public override bool ChooseWaterStyle() - { - return Main.LocalPlayer.GetModPlayer(mod).ZoneGreatSea; - } - - public override int ChooseWaterfallStyle() - { - return mod.GetWaterfallStyleSlot("GreatSeaWaterflow"); - } - - public override int GetSplashDust() - { - return 185; - } - - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Cyan; - } - } +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class GreatSeaWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneGreatSea; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("GreatSeaWaterflow"); + } + + public override int GetSplashDust() + { + return 185; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Cyan; + } + } } \ No newline at end of file diff --git a/Waters/GreatSeaWaterflow.cs b/Waters/GreatSeaWaterflow.cs index d8066783b1..4c8b80e45b 100644 --- a/Waters/GreatSeaWaterflow.cs +++ b/Waters/GreatSeaWaterflow.cs @@ -1,10 +1,10 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class GreatSeaWaterflow : ModWaterfallStyle - { - - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class GreatSeaWaterflow : ModWaterfallStyle + { + + } } \ No newline at end of file diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 60fcf75fab..9253fa28e3 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; - } - } +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 diff --git a/Waters/SulphuricWaterflow.cs b/Waters/SulphuricWaterflow.cs index 32e39a5c2c..79a9ca1e69 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 - { - - } +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricWaterflow : ModWaterfallStyle + { + + } } \ No newline at end of file diff --git a/World/CustomActions.cs b/World/CustomActions.cs index 79449bd64b..6eaa6741cb 100644 --- a/World/CustomActions.cs +++ b/World/CustomActions.cs @@ -1,123 +1,123 @@ -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 3f7e73499e..63734ff67c 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 01f8d7c3b9..68291dd91f 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 f28d12c2a8..1bb0ef50fd 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 ecd8ea3e63..9843ac102a 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -1,356 +1,356 @@ -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) - { - int radius = _random.Next(50, 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) + { + int radius = _random.Next(50, 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 c5a28d5065..669c13f657 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 df4cd64cda..6dbd19af2b 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Terraria; -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); - - 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.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); + + 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/build.txt b/build.txt index 03c5322de8..485ccb1ae0 100644 --- a/build.txt +++ b/build.txt @@ -1,8 +1,8 @@ -author = MountainDrew -version = 1.3.5.001 -displayName = Calamity Mod -homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ -hideCode = true -hideResources = true -includeSource = false +author = MountainDrew +version = 1.4.0.001 +displayName = Calamity Mod +homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ +hideCode = true +hideResources = true +includeSource = false includePDB = false \ No newline at end of file diff --git a/description.txt b/description.txt index 9b3fd8a94a..56f432504a 100644 --- a/description.txt +++ b/description.txt @@ -1,9 +1,9 @@ -This mod was created with the purpose of adding additional content to Terraria. -It currently contains: -8 new mineable ores -22 new bosses (with custom Expert Mode AI) -2 new modes for extra challenge -3 new biomes -220+ new enemy NPCs -1170+ new items +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 +250+ new enemy NPCs +1200+ new items Cross-content support for GRealm \ No newline at end of file