diff --git a/Backgrounds/SulphurBG.png b/Backgrounds/SulphurBG.png new file mode 100644 index 0000000000..139bcb19d0 Binary files /dev/null and b/Backgrounds/SulphurBG.png differ diff --git a/Buffs/AbyssalDivingSuitBuff.cs b/Buffs/AbyssalDivingSuitBuff.cs new file mode 100644 index 0000000000..daf73fa798 --- /dev/null +++ b/Buffs/AbyssalDivingSuitBuff.cs @@ -0,0 +1,49 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalDivingSuitBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit"); + Description.SetDefault("You are made of metal"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.abyssalDivingSuitPrevious) + { + player.gills = true; + modPlayer.abyssalDivingSuitPower = true; + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + modPlayer.anechoicPlating = true; + modPlayer.ironBoots = true; + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} \ No newline at end of file diff --git a/Buffs/AbyssalDivingSuitBuff.png b/Buffs/AbyssalDivingSuitBuff.png new file mode 100644 index 0000000000..54470f90ca Binary files /dev/null and b/Buffs/AbyssalDivingSuitBuff.png differ diff --git a/Buffs/AbyssalDivingSuitPlates.cs b/Buffs/AbyssalDivingSuitPlates.cs new file mode 100644 index 0000000000..fa97db5450 --- /dev/null +++ b/Buffs/AbyssalDivingSuitPlates.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/AbyssalDivingSuitPlates.png b/Buffs/AbyssalDivingSuitPlates.png new file mode 100644 index 0000000000..94f799fdbb Binary files /dev/null and b/Buffs/AbyssalDivingSuitPlates.png differ diff --git a/Buffs/AbyssalDivingSuitPlatesBroken.cs b/Buffs/AbyssalDivingSuitPlatesBroken.cs new file mode 100644 index 0000000000..b4bc9a82ab --- /dev/null +++ b/Buffs/AbyssalDivingSuitPlatesBroken.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalDivingSuitPlatesBroken : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit Plates Broken"); + Description.SetDefault("The plates are regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).abyssalDivingSuitCooldown = true; + } + } +} \ No newline at end of file diff --git a/Buffs/AbyssalDivingSuitPlatesBroken.png b/Buffs/AbyssalDivingSuitPlatesBroken.png new file mode 100644 index 0000000000..15d0c56138 Binary files /dev/null and b/Buffs/AbyssalDivingSuitPlatesBroken.png differ diff --git a/Buffs/AbyssalFlames.cs b/Buffs/AbyssalFlames.cs new file mode 100644 index 0000000000..0a3e7847bb --- /dev/null +++ b/Buffs/AbyssalFlames.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/AbyssalFlames.png b/Buffs/AbyssalFlames.png new file mode 100644 index 0000000000..2984d77d0b Binary files /dev/null and b/Buffs/AbyssalFlames.png differ diff --git a/Buffs/AbyssalWeapon.cs b/Buffs/AbyssalWeapon.cs new file mode 100644 index 0000000000..a2921cb83b --- /dev/null +++ b/Buffs/AbyssalWeapon.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/AbyssalWeapon.png b/Buffs/AbyssalWeapon.png new file mode 100644 index 0000000000..5bfb5b1bf5 Binary files /dev/null and b/Buffs/AbyssalWeapon.png differ diff --git a/Buffs/AdrenalineMode.cs b/Buffs/AdrenalineMode.cs new file mode 100644 index 0000000000..4d0324b8fb --- /dev/null +++ b/Buffs/AdrenalineMode.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/AdrenalineMode.png b/Buffs/AdrenalineMode.png new file mode 100644 index 0000000000..9a0de16293 Binary files /dev/null and b/Buffs/AdrenalineMode.png differ diff --git a/Buffs/Afflicted.cs b/Buffs/Afflicted.cs new file mode 100644 index 0000000000..64cb580df4 --- /dev/null +++ b/Buffs/Afflicted.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Afflicted.png b/Buffs/Afflicted.png new file mode 100644 index 0000000000..a18eba6244 Binary files /dev/null and b/Buffs/Afflicted.png differ diff --git a/Buffs/AlthenasBlessing.png b/Buffs/AlthenasBlessing.png new file mode 100644 index 0000000000..473b8b17e0 Binary files /dev/null and b/Buffs/AlthenasBlessing.png differ diff --git a/Buffs/AnechoicCoating.cs b/Buffs/AnechoicCoating.cs new file mode 100644 index 0000000000..c3b08c7075 --- /dev/null +++ b/Buffs/AnechoicCoating.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/AnechoicCoating.png b/Buffs/AnechoicCoating.png new file mode 100644 index 0000000000..bc28d7e811 Binary files /dev/null and b/Buffs/AnechoicCoating.png differ diff --git a/Buffs/AngryChicken.cs b/Buffs/AngryChicken.cs new file mode 100644 index 0000000000..dc4a05b9d3 --- /dev/null +++ b/Buffs/AngryChicken.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class AngryChicken : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Son of Yharon"); + Description.SetDefault("The Son of Yharon will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] > 0) + { + modPlayer.aChicken = true; + } + if (!modPlayer.aChicken) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/AngryChicken.png b/Buffs/AngryChicken.png new file mode 100644 index 0000000000..9cbadae4b1 Binary files /dev/null and b/Buffs/AngryChicken.png differ diff --git a/Buffs/AquaticEgg.png b/Buffs/AquaticEgg.png new file mode 100644 index 0000000000..d95081f895 Binary files /dev/null and b/Buffs/AquaticEgg.png differ diff --git a/Buffs/AquaticStar.cs b/Buffs/AquaticStar.cs new file mode 100644 index 0000000000..ad6ebaa424 --- /dev/null +++ b/Buffs/AquaticStar.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class AquaticStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Aquatic Star"); + Description.SetDefault("The aquatic star will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("AquaticStar")] > 0) + { + modPlayer.aStar = true; + } + if (!modPlayer.aStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/AquaticStar.png b/Buffs/AquaticStar.png new file mode 100644 index 0000000000..7f06fa9055 Binary files /dev/null and b/Buffs/AquaticStar.png differ diff --git a/Buffs/ArmorCrunch.cs b/Buffs/ArmorCrunch.cs new file mode 100644 index 0000000000..d1f6895cb8 --- /dev/null +++ b/Buffs/ArmorCrunch.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/ArmorCrunch.png b/Buffs/ArmorCrunch.png new file mode 100644 index 0000000000..b2af246db2 Binary files /dev/null and b/Buffs/ArmorCrunch.png differ diff --git a/Buffs/Backfire.cs b/Buffs/Backfire.cs new file mode 100644 index 0000000000..2d886cb1cc --- /dev/null +++ b/Buffs/Backfire.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/Backfire.png b/Buffs/Backfire.png new file mode 100644 index 0000000000..cf2d130203 Binary files /dev/null and b/Buffs/Backfire.png differ diff --git a/Buffs/BloodClot.cs b/Buffs/BloodClot.cs new file mode 100644 index 0000000000..69a120e473 --- /dev/null +++ b/Buffs/BloodClot.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BloodClot : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blood Clot"); + Description.SetDefault("The blood clot will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("BloodClotMinion")] > 0) + { + modPlayer.bClot = true; + } + if (!modPlayer.bClot) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/BloodClot.png b/Buffs/BloodClot.png new file mode 100644 index 0000000000..833f2c1dc9 Binary files /dev/null and b/Buffs/BloodClot.png differ diff --git a/Buffs/BrimlingBuff.cs b/Buffs/BrimlingBuff.cs new file mode 100644 index 0000000000..e45090c1f4 --- /dev/null +++ b/Buffs/BrimlingBuff.cs @@ -0,0 +1,30 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; + +namespace CalamityMod.Buffs +{ + public class BrimlingBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimling"); + Description.SetDefault("Protect her or suffer in agony"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).brimling = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Brimling")] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Brimling"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} \ No newline at end of file diff --git a/Buffs/BrimlingBuff.png b/Buffs/BrimlingBuff.png new file mode 100644 index 0000000000..9dc42fed0f Binary files /dev/null and b/Buffs/BrimlingBuff.png differ diff --git a/Buffs/BrimstoneFlames.cs b/Buffs/BrimstoneFlames.cs new file mode 100644 index 0000000000..e5dbddc411 --- /dev/null +++ b/Buffs/BrimstoneFlames.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/BrimstoneFlames.png b/Buffs/BrimstoneFlames.png new file mode 100644 index 0000000000..0fca908ce3 Binary files /dev/null and b/Buffs/BrimstoneFlames.png differ diff --git a/Buffs/BrimstoneMount.cs b/Buffs/BrimstoneMount.cs new file mode 100644 index 0000000000..ed53322f2d --- /dev/null +++ b/Buffs/BrimstoneMount.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/BrimstoneMount.png b/Buffs/BrimstoneMount.png new file mode 100644 index 0000000000..be0b5ed113 Binary files /dev/null and b/Buffs/BrimstoneMount.png differ diff --git a/Buffs/BrimstoneWaifu.cs b/Buffs/BrimstoneWaifu.cs new file mode 100644 index 0000000000..b3c406e545 --- /dev/null +++ b/Buffs/BrimstoneWaifu.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Buffs/BrimstoneWaifu.png b/Buffs/BrimstoneWaifu.png new file mode 100644 index 0000000000..d3598162c3 Binary files /dev/null and b/Buffs/BrimstoneWaifu.png differ diff --git a/Buffs/BrittleStar.cs b/Buffs/BrittleStar.cs new file mode 100644 index 0000000000..d0e6a94902 --- /dev/null +++ b/Buffs/BrittleStar.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BrittleStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brittle Star"); + Description.SetDefault("The brittle star will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("BrittleStar")] > 0) + { + modPlayer.bStar = true; + } + if (!modPlayer.bStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/BrittleStar.png b/Buffs/BrittleStar.png new file mode 100644 index 0000000000..04c3029de7 Binary files /dev/null and b/Buffs/BrittleStar.png differ diff --git a/Buffs/BurningBlood.cs b/Buffs/BurningBlood.cs new file mode 100644 index 0000000000..ce0b3cc2da --- /dev/null +++ b/Buffs/BurningBlood.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/BurningBlood.png b/Buffs/BurningBlood.png new file mode 100644 index 0000000000..3679a7fcec Binary files /dev/null and b/Buffs/BurningBlood.png differ diff --git a/Buffs/Cadence.cs b/Buffs/Cadence.cs new file mode 100644 index 0000000000..40d15ab78e --- /dev/null +++ b/Buffs/Cadence.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Cadence.png b/Buffs/Cadence.png new file mode 100644 index 0000000000..9337e5b993 Binary files /dev/null and b/Buffs/Cadence.png differ diff --git a/Buffs/Calamari.cs b/Buffs/Calamari.cs new file mode 100644 index 0000000000..1b4ab29727 --- /dev/null +++ b/Buffs/Calamari.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Calamari : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Calamari"); + Description.SetDefault("The squid will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Calamari")] > 0) + { + modPlayer.calamari = true; + } + if (!modPlayer.calamari) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Calamari.png b/Buffs/Calamari.png new file mode 100644 index 0000000000..d0828accd1 Binary files /dev/null and b/Buffs/Calamari.png differ diff --git a/Buffs/CalamitasEyes.cs b/Buffs/CalamitasEyes.cs new file mode 100644 index 0000000000..1fe74eff39 --- /dev/null +++ b/Buffs/CalamitasEyes.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CalamitasEyes : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blighted Eyes"); + Description.SetDefault("Calamitas and her brothers will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Calamitamini")] > 0) + { + modPlayer.cEyes = true; + } + if (!modPlayer.cEyes) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/CalamitasEyes.png b/Buffs/CalamitasEyes.png new file mode 100644 index 0000000000..d9c907eaf6 Binary files /dev/null and b/Buffs/CalamitasEyes.png differ diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs new file mode 100644 index 0000000000..4970f22556 --- /dev/null +++ b/Buffs/CalamityGlobalBuff.cs @@ -0,0 +1,25 @@ +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; + } + } + } +} diff --git a/Buffs/ChaosSpirit.cs b/Buffs/ChaosSpirit.cs new file mode 100644 index 0000000000..5299e7f19f --- /dev/null +++ b/Buffs/ChaosSpirit.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ChaosSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Description.SetDefault("The chaos spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] > 0) + { + modPlayer.cSpirit = true; + } + if (!modPlayer.cSpirit) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/ChaosSpirit.png b/Buffs/ChaosSpirit.png new file mode 100644 index 0000000000..e19ae1278c Binary files /dev/null and b/Buffs/ChaosSpirit.png differ diff --git a/Buffs/ChibiiBuff.cs b/Buffs/ChibiiBuff.cs new file mode 100644 index 0000000000..4b66869eb8 --- /dev/null +++ b/Buffs/ChibiiBuff.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/ChibiiBuff.png b/Buffs/ChibiiBuff.png new file mode 100644 index 0000000000..9dca168332 Binary files /dev/null and b/Buffs/ChibiiBuff.png differ diff --git a/Buffs/CloudyWaifu.cs b/Buffs/CloudyWaifu.cs new file mode 100644 index 0000000000..d6708a5d01 --- /dev/null +++ b/Buffs/CloudyWaifu.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Buffs/CloudyWaifu.png b/Buffs/CloudyWaifu.png new file mode 100644 index 0000000000..d7007beaab Binary files /dev/null and b/Buffs/CloudyWaifu.png differ diff --git a/Buffs/Corroslime.cs b/Buffs/Corroslime.cs new file mode 100644 index 0000000000..8c98873566 --- /dev/null +++ b/Buffs/Corroslime.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Corroslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Corroslime"); + Description.SetDefault("The corroslime will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Corroslime")] > 0) + { + modPlayer.cSlime = true; + } + if (!modPlayer.cSlime) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Corroslime.png b/Buffs/Corroslime.png new file mode 100644 index 0000000000..c249f7a17c Binary files /dev/null and b/Buffs/Corroslime.png differ diff --git a/Buffs/CosmicEnergy.cs b/Buffs/CosmicEnergy.cs new file mode 100644 index 0000000000..76994abfeb --- /dev/null +++ b/Buffs/CosmicEnergy.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CosmicEnergy : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmic Energy"); + Description.SetDefault("The cosmic energy will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("CosmicEnergy")] > 0) + { + modPlayer.cEnergy = true; + } + if (!modPlayer.cEnergy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/CosmicEnergy.png b/Buffs/CosmicEnergy.png new file mode 100644 index 0000000000..29c11421f3 Binary files /dev/null and b/Buffs/CosmicEnergy.png differ diff --git a/Buffs/CosmicFreeze.cs b/Buffs/CosmicFreeze.cs new file mode 100644 index 0000000000..5bc40ae006 --- /dev/null +++ b/Buffs/CosmicFreeze.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/CosmicFreeze.png b/Buffs/CosmicFreeze.png new file mode 100644 index 0000000000..29c11421f3 Binary files /dev/null and b/Buffs/CosmicFreeze.png differ diff --git a/Buffs/Cosmilamp.cs b/Buffs/Cosmilamp.cs new file mode 100644 index 0000000000..03ce467f96 --- /dev/null +++ b/Buffs/Cosmilamp.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Cosmilamp : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + Description.SetDefault("The cosmilamp will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Cosmilamp")] > 0) + { + modPlayer.cLamp = true; + } + if (!modPlayer.cLamp) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Cosmilamp.png b/Buffs/Cosmilamp.png new file mode 100644 index 0000000000..71e298b541 Binary files /dev/null and b/Buffs/Cosmilamp.png differ diff --git a/Buffs/Crimslime.cs b/Buffs/Crimslime.cs new file mode 100644 index 0000000000..b67d9d7da3 --- /dev/null +++ b/Buffs/Crimslime.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Crimslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crimslime"); + Description.SetDefault("The crimslime will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Crimslime")] > 0) + { + modPlayer.cSlime2 = true; + } + if (!modPlayer.cSlime2) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Crimslime.png b/Buffs/Crimslime.png new file mode 100644 index 0000000000..96d5cf5128 Binary files /dev/null and b/Buffs/Crimslime.png differ diff --git a/Buffs/CrushDepth.cs b/Buffs/CrushDepth.cs new file mode 100644 index 0000000000..e06f1b9f5e --- /dev/null +++ b/Buffs/CrushDepth.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/CrushDepth.png b/Buffs/CrushDepth.png new file mode 100644 index 0000000000..e08b25c84a Binary files /dev/null and b/Buffs/CrushDepth.png differ diff --git a/Buffs/DaedalusCrystal.cs b/Buffs/DaedalusCrystal.cs new file mode 100644 index 0000000000..f142e6a518 --- /dev/null +++ b/Buffs/DaedalusCrystal.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DaedalusCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + Description.SetDefault("The daedalus crystal will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] > 0) + { + modPlayer.dCrystal = true; + } + if (!modPlayer.dCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/DaedalusCrystal.png b/Buffs/DaedalusCrystal.png new file mode 100644 index 0000000000..0d5b9e5bde Binary files /dev/null and b/Buffs/DaedalusCrystal.png differ diff --git a/Buffs/DankCreeper.cs b/Buffs/DankCreeper.cs new file mode 100644 index 0000000000..697fb850be --- /dev/null +++ b/Buffs/DankCreeper.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DankCreeper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + Description.SetDefault("The dank creeper will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("DankCreeper")] > 0) + { + modPlayer.dCreeper = true; + } + if (!modPlayer.dCreeper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/DankCreeper.png b/Buffs/DankCreeper.png new file mode 100644 index 0000000000..9796d02419 Binary files /dev/null and b/Buffs/DankCreeper.png differ diff --git a/Buffs/DemonFlames.cs b/Buffs/DemonFlames.cs new file mode 100644 index 0000000000..40272b2ee9 --- /dev/null +++ b/Buffs/DemonFlames.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/DemonFlames.png b/Buffs/DemonFlames.png new file mode 100644 index 0000000000..e76a537765 Binary files /dev/null and b/Buffs/DemonFlames.png differ diff --git a/Buffs/DrewsSandyWaifu.cs b/Buffs/DrewsSandyWaifu.cs new file mode 100644 index 0000000000..5da03bef6e --- /dev/null +++ b/Buffs/DrewsSandyWaifu.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Buffs/DrewsSandyWaifu.png b/Buffs/DrewsSandyWaifu.png new file mode 100644 index 0000000000..73b9a887be Binary files /dev/null and b/Buffs/DrewsSandyWaifu.png differ diff --git a/Buffs/ElementalAxe.cs b/Buffs/ElementalAxe.cs new file mode 100644 index 0000000000..f57bd81956 --- /dev/null +++ b/Buffs/ElementalAxe.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ElementalAxe : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Elemental Axe"); + Description.SetDefault("The elemental axe will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("ElementalAxe")] > 0) + { + modPlayer.eAxe = true; + } + if (!modPlayer.eAxe) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/ElementalAxe.png b/Buffs/ElementalAxe.png new file mode 100644 index 0000000000..de0d03d3fb Binary files /dev/null and b/Buffs/ElementalAxe.png differ diff --git a/Buffs/Enraged.cs b/Buffs/Enraged.cs new file mode 100644 index 0000000000..5dcf53f4b8 --- /dev/null +++ b/Buffs/Enraged.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/Enraged.png b/Buffs/Enraged.png new file mode 100644 index 0000000000..d9a80f785b Binary files /dev/null and b/Buffs/Enraged.png differ diff --git a/Buffs/ExoFreeze.cs b/Buffs/ExoFreeze.cs new file mode 100644 index 0000000000..03199822a3 --- /dev/null +++ b/Buffs/ExoFreeze.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/ExoFreeze.png b/Buffs/ExoFreeze.png new file mode 100644 index 0000000000..097d9ed728 Binary files /dev/null and b/Buffs/ExoFreeze.png differ diff --git a/Buffs/ExtremeGrav.cs b/Buffs/ExtremeGrav.cs new file mode 100644 index 0000000000..dff7890e7a --- /dev/null +++ b/Buffs/ExtremeGrav.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/ExtremeGrav.png b/Buffs/ExtremeGrav.png new file mode 100644 index 0000000000..3e542d09b3 Binary files /dev/null and b/Buffs/ExtremeGrav.png differ diff --git a/Buffs/ExtremeGravity.cs b/Buffs/ExtremeGravity.cs new file mode 100644 index 0000000000..5cf32585fc --- /dev/null +++ b/Buffs/ExtremeGravity.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/ExtremeGravity.png b/Buffs/ExtremeGravity.png new file mode 100644 index 0000000000..c143f09dcc Binary files /dev/null and b/Buffs/ExtremeGravity.png differ diff --git a/Buffs/Fab.cs b/Buffs/Fab.cs new file mode 100644 index 0000000000..2fe3003dae --- /dev/null +++ b/Buffs/Fab.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/Fab.png b/Buffs/Fab.png new file mode 100644 index 0000000000..fb4d3a116e Binary files /dev/null and b/Buffs/Fab.png differ diff --git a/Buffs/FabsolVodka.cs b/Buffs/FabsolVodka.cs new file mode 100644 index 0000000000..e471773215 --- /dev/null +++ b/Buffs/FabsolVodka.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class FabsolVodka : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fab"); + Description.SetDefault("You feel fabulous"); + 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).fabsolVodka = true; + } + } +} \ No newline at end of file diff --git a/Buffs/FabsolVodka.png b/Buffs/FabsolVodka.png new file mode 100644 index 0000000000..1c9a31dd3c Binary files /dev/null and b/Buffs/FabsolVodka.png differ diff --git a/Buffs/FishAlert.cs b/Buffs/FishAlert.cs new file mode 100644 index 0000000000..4f0df49827 --- /dev/null +++ b/Buffs/FishAlert.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/FishAlert.png b/Buffs/FishAlert.png new file mode 100644 index 0000000000..5183a0dda2 Binary files /dev/null and b/Buffs/FishAlert.png differ diff --git a/Buffs/Fox.cs b/Buffs/Fox.cs new file mode 100644 index 0000000000..b58bf766c7 --- /dev/null +++ b/Buffs/Fox.cs @@ -0,0 +1,31 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Fox.png b/Buffs/Fox.png new file mode 100644 index 0000000000..3ce14d209a Binary files /dev/null and b/Buffs/Fox.png differ diff --git a/Buffs/FungalClump.cs b/Buffs/FungalClump.cs new file mode 100644 index 0000000000..ffcff9d8d1 --- /dev/null +++ b/Buffs/FungalClump.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class FungalClump : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + Description.SetDefault("The fungal clump will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 0) + { + modPlayer.fClump = true; + } + if (!modPlayer.fClump) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/FungalClump.png b/Buffs/FungalClump.png new file mode 100644 index 0000000000..d2ab50894f Binary files /dev/null and b/Buffs/FungalClump.png differ diff --git a/Buffs/GlacialState.cs b/Buffs/GlacialState.cs new file mode 100644 index 0000000000..dad38be9da --- /dev/null +++ b/Buffs/GlacialState.cs @@ -0,0 +1,32 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GlacialState : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Glacial State"); + Description.SetDefault("Cannot move and defense is shattered"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).gState = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).gState = true; + } + } +} \ No newline at end of file diff --git a/Buffs/GlacialState.png b/Buffs/GlacialState.png new file mode 100644 index 0000000000..f38b37b8bb Binary files /dev/null and b/Buffs/GlacialState.png differ diff --git a/Buffs/GodSlayerCooldown.cs b/Buffs/GodSlayerCooldown.cs new file mode 100644 index 0000000000..74fde54d7d --- /dev/null +++ b/Buffs/GodSlayerCooldown.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GodSlayerCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("God Slayer Cooldown"); + Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).godSlayerCooldown = true; + } + } +} \ No newline at end of file diff --git a/Buffs/GodSlayerCooldown.png b/Buffs/GodSlayerCooldown.png new file mode 100644 index 0000000000..6388658ff8 Binary files /dev/null and b/Buffs/GodSlayerCooldown.png differ diff --git a/Buffs/GodSlayerInferno.cs b/Buffs/GodSlayerInferno.cs new file mode 100644 index 0000000000..8d499acb07 --- /dev/null +++ b/Buffs/GodSlayerInferno.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/GodSlayerInferno.png b/Buffs/GodSlayerInferno.png new file mode 100644 index 0000000000..a976faf75c Binary files /dev/null and b/Buffs/GodSlayerInferno.png differ diff --git a/Buffs/GraxDefense.cs b/Buffs/GraxDefense.cs new file mode 100644 index 0000000000..af34777bf4 --- /dev/null +++ b/Buffs/GraxDefense.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/GraxDefense.png b/Buffs/GraxDefense.png new file mode 100644 index 0000000000..1542ee271c Binary files /dev/null and b/Buffs/GraxDefense.png differ diff --git a/Buffs/HeartAttack.cs b/Buffs/HeartAttack.cs new file mode 100644 index 0000000000..85ac07b132 --- /dev/null +++ b/Buffs/HeartAttack.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/HeartAttack.png b/Buffs/HeartAttack.png new file mode 100644 index 0000000000..bafad70a7b Binary files /dev/null and b/Buffs/HeartAttack.png differ diff --git a/Buffs/Herring.cs b/Buffs/Herring.cs new file mode 100644 index 0000000000..301d6c22ce --- /dev/null +++ b/Buffs/Herring.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Herring : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Herring"); + Description.SetDefault("The herring will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Herring")] > 0) + { + modPlayer.herring = true; + } + if (!modPlayer.herring) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Herring.png b/Buffs/Herring.png new file mode 100644 index 0000000000..aed61a6102 Binary files /dev/null and b/Buffs/Herring.png differ diff --git a/Buffs/HolyInferno.cs b/Buffs/HolyInferno.cs new file mode 100644 index 0000000000..40933320d1 --- /dev/null +++ b/Buffs/HolyInferno.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/HolyInferno.png b/Buffs/HolyInferno.png new file mode 100644 index 0000000000..9a2cf43a34 Binary files /dev/null and b/Buffs/HolyInferno.png differ diff --git a/Buffs/HolyLight.cs b/Buffs/HolyLight.cs new file mode 100644 index 0000000000..26fa4dbb76 --- /dev/null +++ b/Buffs/HolyLight.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/HolyLight.png b/Buffs/HolyLight.png new file mode 100644 index 0000000000..9a2cf43a34 Binary files /dev/null and b/Buffs/HolyLight.png differ diff --git a/Buffs/Horror.cs b/Buffs/Horror.cs new file mode 100644 index 0000000000..4930fc888e --- /dev/null +++ b/Buffs/Horror.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Horror.png b/Buffs/Horror.png new file mode 100644 index 0000000000..78b2160ee8 Binary files /dev/null and b/Buffs/Horror.png differ diff --git a/Buffs/IceClasper.cs b/Buffs/IceClasper.cs new file mode 100644 index 0000000000..efa3ab84c0 --- /dev/null +++ b/Buffs/IceClasper.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class IceClasper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Description.SetDefault("The ice clasper will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("IceClasper")] > 0) + { + modPlayer.iClasper = true; + } + if (!modPlayer.iClasper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/IceClasper.png b/Buffs/IceClasper.png new file mode 100644 index 0000000000..19db922ca6 Binary files /dev/null and b/Buffs/IceClasper.png differ diff --git a/Buffs/IceShieldBrokenBuff.cs b/Buffs/IceShieldBrokenBuff.cs new file mode 100644 index 0000000000..20de3ae9ed --- /dev/null +++ b/Buffs/IceShieldBrokenBuff.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class IceShieldBrokenBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Shield Cooldown"); + Description.SetDefault("The shield is regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).sirenIceCooldown = true; + } + } +} \ No newline at end of file diff --git a/Buffs/IceShieldBrokenBuff.png b/Buffs/IceShieldBrokenBuff.png new file mode 100644 index 0000000000..768add27b9 Binary files /dev/null and b/Buffs/IceShieldBrokenBuff.png differ diff --git a/Buffs/IceShieldBuff.cs b/Buffs/IceShieldBuff.cs new file mode 100644 index 0000000000..08bd14442a --- /dev/null +++ b/Buffs/IceShieldBuff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/IceShieldBuff.png b/Buffs/IceShieldBuff.png new file mode 100644 index 0000000000..5f6e561a40 Binary files /dev/null and b/Buffs/IceShieldBuff.png differ diff --git a/Buffs/Invincible.cs b/Buffs/Invincible.cs new file mode 100644 index 0000000000..c26bb7e2e4 --- /dev/null +++ b/Buffs/Invincible.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Invincible.png b/Buffs/Invincible.png new file mode 100644 index 0000000000..a9ad984c81 Binary files /dev/null and b/Buffs/Invincible.png differ diff --git a/Buffs/Irradiated.cs b/Buffs/Irradiated.cs new file mode 100644 index 0000000000..1fecf81a8a --- /dev/null +++ b/Buffs/Irradiated.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/Irradiated.png b/Buffs/Irradiated.png new file mode 100644 index 0000000000..3518163824 Binary files /dev/null and b/Buffs/Irradiated.png differ diff --git a/Buffs/Levi.cs b/Buffs/Levi.cs new file mode 100644 index 0000000000..d3ace67221 --- /dev/null +++ b/Buffs/Levi.cs @@ -0,0 +1,31 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Levi.png b/Buffs/Levi.png new file mode 100644 index 0000000000..0dbdae9065 Binary files /dev/null and b/Buffs/Levi.png differ diff --git a/Buffs/MarkedforDeath.cs b/Buffs/MarkedforDeath.cs new file mode 100644 index 0000000000..46401260c6 --- /dev/null +++ b/Buffs/MarkedforDeath.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/MarkedforDeath.png b/Buffs/MarkedforDeath.png new file mode 100644 index 0000000000..bf8208980e Binary files /dev/null and b/Buffs/MarkedforDeath.png differ diff --git a/Buffs/Mechworm.cs b/Buffs/Mechworm.cs new file mode 100644 index 0000000000..741f27e882 --- /dev/null +++ b/Buffs/Mechworm.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Mechworm : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mechworm"); + Description.SetDefault("The mechworm will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] > 0) + { + modPlayer.mWorm = true; + } + if (!modPlayer.mWorm) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Mechworm.png b/Buffs/Mechworm.png new file mode 100644 index 0000000000..ebdc6150b0 Binary files /dev/null and b/Buffs/Mechworm.png differ diff --git a/Buffs/Molten.cs b/Buffs/Molten.cs new file mode 100644 index 0000000000..e4c2197c0d --- /dev/null +++ b/Buffs/Molten.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Molten.png b/Buffs/Molten.png new file mode 100644 index 0000000000..59930acf0d Binary files /dev/null and b/Buffs/Molten.png differ diff --git a/Buffs/Mushy.cs b/Buffs/Mushy.cs new file mode 100644 index 0000000000..526729dd54 --- /dev/null +++ b/Buffs/Mushy.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/Mushy.png b/Buffs/Mushy.png new file mode 100644 index 0000000000..e31619540b Binary files /dev/null and b/Buffs/Mushy.png differ diff --git a/Buffs/NOU.cs b/Buffs/NOU.cs new file mode 100644 index 0000000000..8ba7318b53 --- /dev/null +++ b/Buffs/NOU.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/NOU.png b/Buffs/NOU.png new file mode 100644 index 0000000000..4d42ae73d5 Binary files /dev/null and b/Buffs/NOU.png differ diff --git a/Buffs/Nightwither.cs b/Buffs/Nightwither.cs new file mode 100644 index 0000000000..0dd4844a2d --- /dev/null +++ b/Buffs/Nightwither.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Nightwither.png b/Buffs/Nightwither.png new file mode 100644 index 0000000000..82322429f0 Binary files /dev/null and b/Buffs/Nightwither.png differ diff --git a/Buffs/Omniscience.cs b/Buffs/Omniscience.cs new file mode 100644 index 0000000000..d9f6dae148 --- /dev/null +++ b/Buffs/Omniscience.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Omniscience.png b/Buffs/Omniscience.png new file mode 100644 index 0000000000..d22d3d5ca2 Binary files /dev/null and b/Buffs/Omniscience.png differ diff --git a/Buffs/Permafrost/ConcoctionCooldown.cs b/Buffs/Permafrost/ConcoctionCooldown.cs new file mode 100644 index 0000000000..17d2f47c0c --- /dev/null +++ b/Buffs/Permafrost/ConcoctionCooldown.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/Permafrost/ConcoctionCooldown.png b/Buffs/Permafrost/ConcoctionCooldown.png new file mode 100644 index 0000000000..b102eb9da9 Binary files /dev/null and b/Buffs/Permafrost/ConcoctionCooldown.png differ diff --git a/Buffs/Permafrost/Encased.cs b/Buffs/Permafrost/Encased.cs new file mode 100644 index 0000000000..ee78e5c2b7 --- /dev/null +++ b/Buffs/Permafrost/Encased.cs @@ -0,0 +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; + } + } + } +} diff --git a/Buffs/Permafrost/Encased.png b/Buffs/Permafrost/Encased.png new file mode 100644 index 0000000000..e42acb62f5 Binary files /dev/null and b/Buffs/Permafrost/Encased.png differ diff --git a/Buffs/Phantom.cs b/Buffs/Phantom.cs new file mode 100644 index 0000000000..da0f3d9170 --- /dev/null +++ b/Buffs/Phantom.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Phantom : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Phantom"); + Description.SetDefault("The phantom will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("PhantomGuy")] > 0) + { + modPlayer.pGuy = true; + } + if (!modPlayer.pGuy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Phantom.png b/Buffs/Phantom.png new file mode 100644 index 0000000000..1c526c95a9 Binary files /dev/null and b/Buffs/Phantom.png differ diff --git a/Buffs/Plague.cs b/Buffs/Plague.cs new file mode 100644 index 0000000000..4a0962fbe7 --- /dev/null +++ b/Buffs/Plague.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/Plague.png b/Buffs/Plague.png new file mode 100644 index 0000000000..bf5d04b229 Binary files /dev/null and b/Buffs/Plague.png differ diff --git a/Buffs/RageMode.cs b/Buffs/RageMode.cs new file mode 100644 index 0000000000..980f9cfa3d --- /dev/null +++ b/Buffs/RageMode.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/RageMode.png b/Buffs/RageMode.png new file mode 100644 index 0000000000..d9a80f785b Binary files /dev/null and b/Buffs/RageMode.png differ diff --git a/Buffs/ReaverOrb.cs b/Buffs/ReaverOrb.cs new file mode 100644 index 0000000000..53684d4c44 --- /dev/null +++ b/Buffs/ReaverOrb.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ReaverOrb : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + Description.SetDefault("The reaver orb will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] > 0) + { + modPlayer.rOrb = true; + } + if (!modPlayer.rOrb) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/ReaverOrb.png b/Buffs/ReaverOrb.png new file mode 100644 index 0000000000..a8b08cc862 Binary files /dev/null and b/Buffs/ReaverOrb.png differ diff --git a/Buffs/ReaverRage.cs b/Buffs/ReaverRage.cs new file mode 100644 index 0000000000..8a6d04d7fd --- /dev/null +++ b/Buffs/ReaverRage.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/ReaverRage.png b/Buffs/ReaverRage.png new file mode 100644 index 0000000000..2193372b36 Binary files /dev/null and b/Buffs/ReaverRage.png differ diff --git a/Buffs/RedDevil.cs b/Buffs/RedDevil.cs new file mode 100644 index 0000000000..7ef907199c --- /dev/null +++ b/Buffs/RedDevil.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class RedDevil : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Red Devil"); + Description.SetDefault("The red devil will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] > 0) + { + modPlayer.rDevil = true; + } + if (!modPlayer.rDevil) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/RedDevil.png b/Buffs/RedDevil.png new file mode 100644 index 0000000000..2bf486ac3e Binary files /dev/null and b/Buffs/RedDevil.png differ diff --git a/Buffs/Sandnado.cs b/Buffs/Sandnado.cs new file mode 100644 index 0000000000..9b542ed46d --- /dev/null +++ b/Buffs/Sandnado.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Sandnado : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sandnado"); + Description.SetDefault("The sandnado will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Sandnado")] > 0) + { + modPlayer.sandnado = true; + } + if (!modPlayer.sandnado) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Sandnado.png b/Buffs/Sandnado.png new file mode 100644 index 0000000000..c107c8d631 Binary files /dev/null and b/Buffs/Sandnado.png differ diff --git a/Buffs/SandyWaifu.cs b/Buffs/SandyWaifu.cs new file mode 100644 index 0000000000..459e104f0c --- /dev/null +++ b/Buffs/SandyWaifu.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SandyWaifu.png b/Buffs/SandyWaifu.png new file mode 100644 index 0000000000..fa0be1df22 Binary files /dev/null and b/Buffs/SandyWaifu.png differ diff --git a/Buffs/ScarfCooldown.cs b/Buffs/ScarfCooldown.cs new file mode 100644 index 0000000000..083aa42fa2 --- /dev/null +++ b/Buffs/ScarfCooldown.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ScarfCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scarf Cooldown"); + Description.SetDefault("Your dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).scarfCooldown = true; + } + } +} \ No newline at end of file diff --git a/Buffs/ScarfCooldown.png b/Buffs/ScarfCooldown.png new file mode 100644 index 0000000000..bcafbb903a Binary files /dev/null and b/Buffs/ScarfCooldown.png differ diff --git a/Buffs/ScarfMeleeBoost.cs b/Buffs/ScarfMeleeBoost.cs new file mode 100644 index 0000000000..3da7d40ede --- /dev/null +++ b/Buffs/ScarfMeleeBoost.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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; + } + } +} \ No newline at end of file diff --git a/Buffs/ScarfMeleeBoost.png b/Buffs/ScarfMeleeBoost.png new file mode 100644 index 0000000000..a9b8e6c977 Binary files /dev/null and b/Buffs/ScarfMeleeBoost.png differ diff --git a/Buffs/ShellBoost.cs b/Buffs/ShellBoost.cs new file mode 100644 index 0000000000..98b94366b3 --- /dev/null +++ b/Buffs/ShellBoost.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/ShellBoost.png b/Buffs/ShellBoost.png new file mode 100644 index 0000000000..83be37bfc6 Binary files /dev/null and b/Buffs/ShellBoost.png differ diff --git a/Buffs/Shred.cs b/Buffs/Shred.cs new file mode 100644 index 0000000000..bfd93ca63c --- /dev/null +++ b/Buffs/Shred.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Shred.png b/Buffs/Shred.png new file mode 100644 index 0000000000..1dfc8bded6 Binary files /dev/null and b/Buffs/Shred.png differ diff --git a/Buffs/SilvaCrystal.cs b/Buffs/SilvaCrystal.cs new file mode 100644 index 0000000000..d3d0766f05 --- /dev/null +++ b/Buffs/SilvaCrystal.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SilvaCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Crystal"); + Description.SetDefault("The crystal will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] > 0) + { + modPlayer.sCrystal = true; + } + if (!modPlayer.sCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SilvaCrystal.png b/Buffs/SilvaCrystal.png new file mode 100644 index 0000000000..1f3176397c Binary files /dev/null and b/Buffs/SilvaCrystal.png differ diff --git a/Buffs/SilvaStun.cs b/Buffs/SilvaStun.cs new file mode 100644 index 0000000000..a8ab2002da --- /dev/null +++ b/Buffs/SilvaStun.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/SilvaStun.png b/Buffs/SilvaStun.png new file mode 100644 index 0000000000..3eff49329b Binary files /dev/null and b/Buffs/SilvaStun.png differ diff --git a/Buffs/SirenBobs.cs b/Buffs/SirenBobs.cs new file mode 100644 index 0000000000..7b8d8f51e0 --- /dev/null +++ b/Buffs/SirenBobs.cs @@ -0,0 +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--; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SirenBobs.png b/Buffs/SirenBobs.png new file mode 100644 index 0000000000..11e1933bb4 Binary files /dev/null and b/Buffs/SirenBobs.png differ diff --git a/Buffs/SirenBobsAlt.cs b/Buffs/SirenBobsAlt.cs new file mode 100644 index 0000000000..f4f6f21708 --- /dev/null +++ b/Buffs/SirenBobsAlt.cs @@ -0,0 +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--; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SirenBobsAlt.png b/Buffs/SirenBobsAlt.png new file mode 100644 index 0000000000..d5d30aa456 Binary files /dev/null and b/Buffs/SirenBobsAlt.png differ diff --git a/Buffs/SirenLure.cs b/Buffs/SirenLure.cs new file mode 100644 index 0000000000..2c2d13778f --- /dev/null +++ b/Buffs/SirenLure.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SirenLure.png b/Buffs/SirenLure.png new file mode 100644 index 0000000000..b9e9cafb73 Binary files /dev/null and b/Buffs/SirenLure.png differ diff --git a/Buffs/SirenWaterSpeed.cs b/Buffs/SirenWaterSpeed.cs new file mode 100644 index 0000000000..d0001aa99c --- /dev/null +++ b/Buffs/SirenWaterSpeed.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/SirenWaterSpeed.png b/Buffs/SirenWaterSpeed.png new file mode 100644 index 0000000000..97e6c6996a Binary files /dev/null and b/Buffs/SirenWaterSpeed.png differ diff --git a/Buffs/SlimeGod.cs b/Buffs/SlimeGod.cs new file mode 100644 index 0000000000..ff70719d10 --- /dev/null +++ b/Buffs/SlimeGod.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SlimeGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Baby Slime God"); + Description.SetDefault("The slime god will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] > 0) + { + modPlayer.sGod = true; + } + else if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] > 0) + { + modPlayer.sGod = true; + } + if (!modPlayer.sGod) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SlimeGod.png b/Buffs/SlimeGod.png new file mode 100644 index 0000000000..2adb11ba74 Binary files /dev/null and b/Buffs/SlimeGod.png differ diff --git a/Buffs/SolarSpirit.cs b/Buffs/SolarSpirit.cs new file mode 100644 index 0000000000..c108b9333b --- /dev/null +++ b/Buffs/SolarSpirit.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SolarSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar Spirit"); + Description.SetDefault("The solar spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("SolarPixie")] > 0) + { + modPlayer.SP = true; + } + if (!modPlayer.SP) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SolarSpirit.png b/Buffs/SolarSpirit.png new file mode 100644 index 0000000000..0246d10ca9 Binary files /dev/null and b/Buffs/SolarSpirit.png differ diff --git a/Buffs/SolarSpiritGod.cs b/Buffs/SolarSpiritGod.cs new file mode 100644 index 0000000000..6f8e31eecb --- /dev/null +++ b/Buffs/SolarSpiritGod.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SolarSpiritGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar God Spirit"); + Description.SetDefault("The solar god spirit will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("SolarGod")] > 0) + { + modPlayer.SPG = true; + } + if (!modPlayer.SPG) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/SolarSpiritGod.png b/Buffs/SolarSpiritGod.png new file mode 100644 index 0000000000..b2d6179f45 Binary files /dev/null and b/Buffs/SolarSpiritGod.png differ diff --git a/Buffs/SpiritGeneratorAtkBuff.cs b/Buffs/SpiritGeneratorAtkBuff.cs new file mode 100644 index 0000000000..deeb01f5f0 --- /dev/null +++ b/Buffs/SpiritGeneratorAtkBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/SpiritGeneratorAtkBuff.png b/Buffs/SpiritGeneratorAtkBuff.png new file mode 100644 index 0000000000..da169659f6 Binary files /dev/null and b/Buffs/SpiritGeneratorAtkBuff.png differ diff --git a/Buffs/SpiritGeneratorDefBuff.cs b/Buffs/SpiritGeneratorDefBuff.cs new file mode 100644 index 0000000000..aa1db864d3 --- /dev/null +++ b/Buffs/SpiritGeneratorDefBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/SpiritGeneratorDefBuff.png b/Buffs/SpiritGeneratorDefBuff.png new file mode 100644 index 0000000000..c4ecd4202b Binary files /dev/null and b/Buffs/SpiritGeneratorDefBuff.png differ diff --git a/Buffs/SpiritGeneratorRegenBuff.cs b/Buffs/SpiritGeneratorRegenBuff.cs new file mode 100644 index 0000000000..62183488e7 --- /dev/null +++ b/Buffs/SpiritGeneratorRegenBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/SpiritGeneratorRegenBuff.png b/Buffs/SpiritGeneratorRegenBuff.png new file mode 100644 index 0000000000..91fc97ad04 Binary files /dev/null and b/Buffs/SpiritGeneratorRegenBuff.png differ diff --git a/Buffs/SquishyBeanBuff.cs b/Buffs/SquishyBeanBuff.cs new file mode 100644 index 0000000000..8549e7e25f --- /dev/null +++ b/Buffs/SquishyBeanBuff.cs @@ -0,0 +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; + } + } +} diff --git a/Buffs/SquishyBeanBuff.png b/Buffs/SquishyBeanBuff.png new file mode 100644 index 0000000000..6af9f43a66 Binary files /dev/null and b/Buffs/SquishyBeanBuff.png differ diff --git a/Buffs/StrangeOrb.cs b/Buffs/StrangeOrb.cs new file mode 100644 index 0000000000..112dd4d8aa --- /dev/null +++ b/Buffs/StrangeOrb.cs @@ -0,0 +1,31 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/StrangeOrb.png b/Buffs/StrangeOrb.png new file mode 100644 index 0000000000..85758b072f Binary files /dev/null and b/Buffs/StrangeOrb.png differ diff --git a/Buffs/TarraLifeRegen.cs b/Buffs/TarraLifeRegen.cs new file mode 100644 index 0000000000..897ee22ec3 --- /dev/null +++ b/Buffs/TarraLifeRegen.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/TarraLifeRegen.png b/Buffs/TarraLifeRegen.png new file mode 100644 index 0000000000..648dc256df Binary files /dev/null and b/Buffs/TarraLifeRegen.png differ diff --git a/Buffs/TemporalSadness.cs b/Buffs/TemporalSadness.cs new file mode 100644 index 0000000000..beffbf113d --- /dev/null +++ b/Buffs/TemporalSadness.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/TemporalSadness.png b/Buffs/TemporalSadness.png new file mode 100644 index 0000000000..48d71f8a78 Binary files /dev/null and b/Buffs/TemporalSadness.png differ diff --git a/Buffs/TitanScale.cs b/Buffs/TitanScale.cs new file mode 100644 index 0000000000..2f07037ecc --- /dev/null +++ b/Buffs/TitanScale.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/TitanScale.png b/Buffs/TitanScale.png new file mode 100644 index 0000000000..1e4b1c637b Binary files /dev/null and b/Buffs/TitanScale.png differ diff --git a/Buffs/TyrantsFury.cs b/Buffs/TyrantsFury.cs new file mode 100644 index 0000000000..b6a1f14722 --- /dev/null +++ b/Buffs/TyrantsFury.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/TyrantsFury.png b/Buffs/TyrantsFury.png new file mode 100644 index 0000000000..9096c33cf5 Binary files /dev/null and b/Buffs/TyrantsFury.png differ diff --git a/Buffs/UHFMurasamaCooldown.png b/Buffs/UHFMurasamaCooldown.png new file mode 100644 index 0000000000..7640c31cfa Binary files /dev/null and b/Buffs/UHFMurasamaCooldown.png differ diff --git a/Buffs/Urchin.cs b/Buffs/Urchin.cs new file mode 100644 index 0000000000..f6f28bac89 --- /dev/null +++ b/Buffs/Urchin.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Urchin : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Urchin"); + Description.SetDefault("The urchin will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] > 0) + { + modPlayer.vUrchin = true; + } + if (!modPlayer.vUrchin) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Urchin.png b/Buffs/Urchin.png new file mode 100644 index 0000000000..9f8e4d0f53 Binary files /dev/null and b/Buffs/Urchin.png differ diff --git a/Buffs/Valkyrie.cs b/Buffs/Valkyrie.cs new file mode 100644 index 0000000000..89dd5d0b53 --- /dev/null +++ b/Buffs/Valkyrie.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Valkyrie : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Valkyrie"); + Description.SetDefault("The valkyrie will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] > 0) + { + modPlayer.aValkyrie = true; + } + if (!modPlayer.aValkyrie) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Valkyrie.png b/Buffs/Valkyrie.png new file mode 100644 index 0000000000..cf96d8137b Binary files /dev/null and b/Buffs/Valkyrie.png differ diff --git a/Buffs/VulnerabilityHex.cs b/Buffs/VulnerabilityHex.cs new file mode 100644 index 0000000000..1cc16b6502 --- /dev/null +++ b/Buffs/VulnerabilityHex.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/VulnerabilityHex.png b/Buffs/VulnerabilityHex.png new file mode 100644 index 0000000000..660f8448ab Binary files /dev/null and b/Buffs/VulnerabilityHex.png differ diff --git a/Buffs/Warped.cs b/Buffs/Warped.cs new file mode 100644 index 0000000000..233afb1ac7 --- /dev/null +++ b/Buffs/Warped.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/Warped.png b/Buffs/Warped.png new file mode 100644 index 0000000000..c02c223022 Binary files /dev/null and b/Buffs/Warped.png differ diff --git a/Buffs/WeakPetrification.cs b/Buffs/WeakPetrification.cs new file mode 100644 index 0000000000..22538abed6 --- /dev/null +++ b/Buffs/WeakPetrification.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Buffs/WeakPetrification.png b/Buffs/WeakPetrification.png new file mode 100644 index 0000000000..e767ea2fbb Binary files /dev/null and b/Buffs/WeakPetrification.png differ diff --git a/Buffs/WhisperingDeath.cs b/Buffs/WhisperingDeath.cs new file mode 100644 index 0000000000..6a6dc22dfb --- /dev/null +++ b/Buffs/WhisperingDeath.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/WhisperingDeath.png b/Buffs/WhisperingDeath.png new file mode 100644 index 0000000000..57f10f7cff Binary files /dev/null and b/Buffs/WhisperingDeath.png differ diff --git a/Buffs/XerocRage.cs b/Buffs/XerocRage.cs new file mode 100644 index 0000000000..5e055196e0 --- /dev/null +++ b/Buffs/XerocRage.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/XerocRage.png b/Buffs/XerocRage.png new file mode 100644 index 0000000000..b4dc31565c Binary files /dev/null and b/Buffs/XerocRage.png differ diff --git a/Buffs/XerocWrath.cs b/Buffs/XerocWrath.cs new file mode 100644 index 0000000000..30dd20842a --- /dev/null +++ b/Buffs/XerocWrath.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/XerocWrath.png b/Buffs/XerocWrath.png new file mode 100644 index 0000000000..e8f6d0c6c1 Binary files /dev/null and b/Buffs/XerocWrath.png differ diff --git a/Buffs/YharimPower.cs b/Buffs/YharimPower.cs new file mode 100644 index 0000000000..c0859c7571 --- /dev/null +++ b/Buffs/YharimPower.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/YharimPower.png b/Buffs/YharimPower.png new file mode 100644 index 0000000000..5bc24a71f1 Binary files /dev/null and b/Buffs/YharimPower.png differ diff --git a/Buffs/Zen.cs b/Buffs/Zen.cs new file mode 100644 index 0000000000..0bdea8c5ba --- /dev/null +++ b/Buffs/Zen.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Zen.png b/Buffs/Zen.png new file mode 100644 index 0000000000..6d71c48527 Binary files /dev/null and b/Buffs/Zen.png differ diff --git a/Buffs/Zerg.cs b/Buffs/Zerg.cs new file mode 100644 index 0000000000..135aa1e660 --- /dev/null +++ b/Buffs/Zerg.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class 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/Buffs/Zerg.png b/Buffs/Zerg.png new file mode 100644 index 0000000000..70410f5d48 Binary files /dev/null and b/Buffs/Zerg.png differ diff --git a/CalamityMod.cs b/CalamityMod.cs new file mode 100644 index 0000000000..d1258858c8 --- /dev/null +++ b/CalamityMod.cs @@ -0,0 +1,1869 @@ +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; + +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 CalamityMod Instance; + + 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"); + + 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(); + + 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() + { + 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; + } + } + } + } + + 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 + } +} \ No newline at end of file diff --git a/CalamityPlayer.cs b/CalamityPlayer.cs new file mode 100644 index 0000000000..d6774c1ac9 --- /dev/null +++ b/CalamityPlayer.cs @@ -0,0 +1,7262 @@ +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); + } + + public override void UpdateBiomes() + { + Point point = player.Center.ToTileCoordinates(); + ZoneCalamity = CalamityWorld.calamityTiles > 50; + ZoneAstral = CalamityWorld.astralTiles > 50; + //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"); + } + 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 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 + } +} diff --git a/CalamityWorld.cs b/CalamityWorld.cs new file mode 100644 index 0000000000..47222c9d51 --- /dev/null +++ b/CalamityWorld.cs @@ -0,0 +1,4108 @@ +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")]; + astralTiles = tileCounts[mod.TileType("AstralOre")]; + seaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("SeaPrism")]; + abyssTiles = tileCounts[mod.TileType("AbyssGravel")]; + sulphurTiles = tileCounts[mod.TileType("SulphurousSand")]; + } + #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); + } + return true; + } + #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 + } +} diff --git a/Dusts/AHSparkle.cs b/Dusts/AHSparkle.cs new file mode 100644 index 0000000000..13b408e409 --- /dev/null +++ b/Dusts/AHSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/AHSparkle.png b/Dusts/AHSparkle.png new file mode 100644 index 0000000000..8612764880 Binary files /dev/null and b/Dusts/AHSparkle.png differ diff --git a/Dusts/AWSparkle.cs b/Dusts/AWSparkle.cs new file mode 100644 index 0000000000..229b798c01 --- /dev/null +++ b/Dusts/AWSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/AWSparkle.png b/Dusts/AWSparkle.png new file mode 100644 index 0000000000..ae35500ffe Binary files /dev/null and b/Dusts/AWSparkle.png differ diff --git a/Dusts/BHSparkle.cs b/Dusts/BHSparkle.cs new file mode 100644 index 0000000000..98f03f63a9 --- /dev/null +++ b/Dusts/BHSparkle.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Dusts/BHSparkle.png b/Dusts/BHSparkle.png new file mode 100644 index 0000000000..4dc40fc695 Binary files /dev/null and b/Dusts/BHSparkle.png differ diff --git a/Dusts/BrimstoneFlame.cs b/Dusts/BrimstoneFlame.cs new file mode 100644 index 0000000000..79f1109381 --- /dev/null +++ b/Dusts/BrimstoneFlame.cs @@ -0,0 +1,40 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class BrimstoneFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } + + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.1f * strength, 0.025f * strength, 0.025f * strength); + } + return true; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } +} \ No newline at end of file diff --git a/Dusts/BrimstoneFlame.png b/Dusts/BrimstoneFlame.png new file mode 100644 index 0000000000..461bbb5d61 Binary files /dev/null and b/Dusts/BrimstoneFlame.png differ diff --git a/Dusts/CCSparkle.cs b/Dusts/CCSparkle.cs new file mode 100644 index 0000000000..a0da8311c4 --- /dev/null +++ b/Dusts/CCSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/CCSparkle.png b/Dusts/CCSparkle.png new file mode 100644 index 0000000000..38084330cd Binary files /dev/null and b/Dusts/CCSparkle.png differ diff --git a/Dusts/CESparkle.cs b/Dusts/CESparkle.cs new file mode 100644 index 0000000000..7a10e935ae --- /dev/null +++ b/Dusts/CESparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/CESparkle.png b/Dusts/CESparkle.png new file mode 100644 index 0000000000..647fab0f97 Binary files /dev/null and b/Dusts/CESparkle.png differ diff --git a/Dusts/DWSparkle.cs b/Dusts/DWSparkle.cs new file mode 100644 index 0000000000..158a462edf --- /dev/null +++ b/Dusts/DWSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/DWSparkle.png b/Dusts/DWSparkle.png new file mode 100644 index 0000000000..1d4374ac5f Binary files /dev/null and b/Dusts/DWSparkle.png differ diff --git a/Dusts/DarkManaFlame.cs b/Dusts/DarkManaFlame.cs new file mode 100644 index 0000000000..5636676f3e --- /dev/null +++ b/Dusts/DarkManaFlame.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Dusts/DarkManaFlame.png b/Dusts/DarkManaFlame.png new file mode 100644 index 0000000000..fac6d5108d Binary files /dev/null and b/Dusts/DarkManaFlame.png differ diff --git a/Dusts/GBSparkle.cs b/Dusts/GBSparkle.cs new file mode 100644 index 0000000000..a3d850e3bf --- /dev/null +++ b/Dusts/GBSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/GBSparkle.png b/Dusts/GBSparkle.png new file mode 100644 index 0000000000..62b0470918 Binary files /dev/null and b/Dusts/GBSparkle.png differ diff --git a/Dusts/GFSparkle.cs b/Dusts/GFSparkle.cs new file mode 100644 index 0000000000..9e9b5305bb --- /dev/null +++ b/Dusts/GFSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/GFSparkle.png b/Dusts/GFSparkle.png new file mode 100644 index 0000000000..3454cd740c Binary files /dev/null and b/Dusts/GFSparkle.png differ diff --git a/Dusts/HBSparkle.cs b/Dusts/HBSparkle.cs new file mode 100644 index 0000000000..6d6e18bc57 --- /dev/null +++ b/Dusts/HBSparkle.cs @@ -0,0 +1,31 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class HBSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.01f, 0.01f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; + } +}} \ No newline at end of file diff --git a/Dusts/HBSparkle.png b/Dusts/HBSparkle.png new file mode 100644 index 0000000000..27c16358e8 Binary files /dev/null and b/Dusts/HBSparkle.png differ diff --git a/Dusts/HSparkle.cs b/Dusts/HSparkle.cs new file mode 100644 index 0000000000..680b0380da --- /dev/null +++ b/Dusts/HSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/HSparkle.png b/Dusts/HSparkle.png new file mode 100644 index 0000000000..be440bf134 Binary files /dev/null and b/Dusts/HSparkle.png differ diff --git a/Dusts/HolyFlame.cs b/Dusts/HolyFlame.cs new file mode 100644 index 0000000000..9ba4e851f1 --- /dev/null +++ b/Dusts/HolyFlame.cs @@ -0,0 +1,40 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class HolyFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } + + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.25f * strength, 0.25f * strength, 0.1f * strength); + } + return true; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } +} \ No newline at end of file diff --git a/Dusts/HolyFlame.png b/Dusts/HolyFlame.png new file mode 100644 index 0000000000..8639fc8f9e Binary files /dev/null and b/Dusts/HolyFlame.png differ diff --git a/Dusts/MSparkle.cs b/Dusts/MSparkle.cs new file mode 100644 index 0000000000..0044fa7f17 --- /dev/null +++ b/Dusts/MSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/MSparkle.png b/Dusts/MSparkle.png new file mode 100644 index 0000000000..a03e17fb1f Binary files /dev/null and b/Dusts/MSparkle.png differ diff --git a/Dusts/NFSparkle.cs b/Dusts/NFSparkle.cs new file mode 100644 index 0000000000..a70dfac8f5 --- /dev/null +++ b/Dusts/NFSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/NFSparkle.png b/Dusts/NFSparkle.png new file mode 100644 index 0000000000..0f357e3818 Binary files /dev/null and b/Dusts/NFSparkle.png differ diff --git a/Dusts/OMGWTHSparkle.cs b/Dusts/OMGWTHSparkle.cs new file mode 100644 index 0000000000..3ca3879961 --- /dev/null +++ b/Dusts/OMGWTHSparkle.cs @@ -0,0 +1,31 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class OMGWTHSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.1f, 0.1f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; + } +}} \ No newline at end of file diff --git a/Dusts/OMGWTHSparkle.png b/Dusts/OMGWTHSparkle.png new file mode 100644 index 0000000000..8f545e859c Binary files /dev/null and b/Dusts/OMGWTHSparkle.png differ diff --git a/Dusts/PGSparkle.cs b/Dusts/PGSparkle.cs new file mode 100644 index 0000000000..2550bc48e9 --- /dev/null +++ b/Dusts/PGSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/PGSparkle.png b/Dusts/PGSparkle.png new file mode 100644 index 0000000000..e597dcf3cd Binary files /dev/null and b/Dusts/PGSparkle.png differ diff --git a/Dusts/SBSparkle.cs b/Dusts/SBSparkle.cs new file mode 100644 index 0000000000..950dcb8838 --- /dev/null +++ b/Dusts/SBSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/SBSparkle.png b/Dusts/SBSparkle.png new file mode 100644 index 0000000000..c7d4bfa80c Binary files /dev/null and b/Dusts/SBSparkle.png differ diff --git a/Dusts/SPSparkle.cs b/Dusts/SPSparkle.cs new file mode 100644 index 0000000000..6df5708388 --- /dev/null +++ b/Dusts/SPSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/SPSparkle.png b/Dusts/SPSparkle.png new file mode 100644 index 0000000000..d756c5c4d5 Binary files /dev/null and b/Dusts/SPSparkle.png differ diff --git a/Dusts/SWSparkle.cs b/Dusts/SWSparkle.cs new file mode 100644 index 0000000000..70259612de --- /dev/null +++ b/Dusts/SWSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/SWSparkle.png b/Dusts/SWSparkle.png new file mode 100644 index 0000000000..0d1a437d4c Binary files /dev/null and b/Dusts/SWSparkle.png differ diff --git a/Dusts/TCESparkle.cs b/Dusts/TCESparkle.cs new file mode 100644 index 0000000000..2b216baf84 --- /dev/null +++ b/Dusts/TCESparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/TCESparkle.png b/Dusts/TCESparkle.png new file mode 100644 index 0000000000..9cdc566adf Binary files /dev/null and b/Dusts/TCESparkle.png differ diff --git a/Dusts/TFSSparkle.cs b/Dusts/TFSSparkle.cs new file mode 100644 index 0000000000..0dea81d2ba --- /dev/null +++ b/Dusts/TFSSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/TFSSparkle.png b/Dusts/TFSSparkle.png new file mode 100644 index 0000000000..5bc988a7a1 Binary files /dev/null and b/Dusts/TFSSparkle.png differ diff --git a/Dusts/TMSparkle.cs b/Dusts/TMSparkle.cs new file mode 100644 index 0000000000..8c21f83e11 --- /dev/null +++ b/Dusts/TMSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/TMSparkle.png b/Dusts/TMSparkle.png new file mode 100644 index 0000000000..93ac6fb6a7 Binary files /dev/null and b/Dusts/TMSparkle.png differ diff --git a/Dusts/TWSparkle.cs b/Dusts/TWSparkle.cs new file mode 100644 index 0000000000..10161500fc --- /dev/null +++ b/Dusts/TWSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/TWSparkle.png b/Dusts/TWSparkle.png new file mode 100644 index 0000000000..6abb67fbd4 Binary files /dev/null and b/Dusts/TWSparkle.png differ diff --git a/Dusts/TYSSparkle.cs b/Dusts/TYSSparkle.cs new file mode 100644 index 0000000000..6fc98c528f --- /dev/null +++ b/Dusts/TYSSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/TYSSparkle.png b/Dusts/TYSSparkle.png new file mode 100644 index 0000000000..8f863054c1 Binary files /dev/null and b/Dusts/TYSSparkle.png differ diff --git a/Dusts/WBSparkle.cs b/Dusts/WBSparkle.cs new file mode 100644 index 0000000000..c6b831dcb6 --- /dev/null +++ b/Dusts/WBSparkle.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Dusts/WBSparkle.png b/Dusts/WBSparkle.png new file mode 100644 index 0000000000..171af301b7 Binary files /dev/null and b/Dusts/WBSparkle.png differ diff --git a/ExtraTextures/AuricCarpet.png b/ExtraTextures/AuricCarpet.png new file mode 100644 index 0000000000..e5644d2d19 Binary files /dev/null and b/ExtraTextures/AuricCarpet.png differ diff --git a/ExtraTextures/BlushieStaffAura.png b/ExtraTextures/BlushieStaffAura.png new file mode 100644 index 0000000000..7e6256396f Binary files /dev/null and b/ExtraTextures/BlushieStaffAura.png differ diff --git a/ExtraTextures/BlushieStaffChain.png b/ExtraTextures/BlushieStaffChain.png new file mode 100644 index 0000000000..04aab76a42 Binary files /dev/null and b/ExtraTextures/BlushieStaffChain.png differ diff --git a/ExtraTextures/BlushieStaffFire.png b/ExtraTextures/BlushieStaffFire.png new file mode 100644 index 0000000000..7e2e575592 Binary files /dev/null and b/ExtraTextures/BlushieStaffFire.png differ diff --git a/ExtraTextures/BlushieStaffGear.png b/ExtraTextures/BlushieStaffGear.png new file mode 100644 index 0000000000..983fce409b Binary files /dev/null and b/ExtraTextures/BlushieStaffGear.png differ diff --git a/ExtraTextures/Carpet.png b/ExtraTextures/Carpet.png new file mode 100644 index 0000000000..8630ed0cb3 Binary files /dev/null and b/ExtraTextures/Carpet.png differ diff --git a/ExtraTextures/Chains/BallOFuguChain.png b/ExtraTextures/Chains/BallOFuguChain.png new file mode 100644 index 0000000000..0a507b3c27 Binary files /dev/null and b/ExtraTextures/Chains/BallOFuguChain.png differ diff --git a/ExtraTextures/Chains/TumbleweedChain.png b/ExtraTextures/Chains/TumbleweedChain.png new file mode 100644 index 0000000000..ffa67f3223 Binary files /dev/null and b/ExtraTextures/Chains/TumbleweedChain.png differ diff --git a/ExtraTextures/Heart3.png b/ExtraTextures/Heart3.png new file mode 100644 index 0000000000..f61d962f3f Binary files /dev/null and b/ExtraTextures/Heart3.png differ diff --git a/ExtraTextures/Heart4.png b/ExtraTextures/Heart4.png new file mode 100644 index 0000000000..fc55418856 Binary files /dev/null and b/ExtraTextures/Heart4.png differ diff --git a/ExtraTextures/Heart5.png b/ExtraTextures/Heart5.png new file mode 100644 index 0000000000..383ac27108 Binary files /dev/null and b/ExtraTextures/Heart5.png differ diff --git a/ExtraTextures/Heart6.png b/ExtraTextures/Heart6.png new file mode 100644 index 0000000000..43018d08df Binary files /dev/null and b/ExtraTextures/Heart6.png differ diff --git a/ExtraTextures/HeartOriginal.png b/ExtraTextures/HeartOriginal.png new file mode 100644 index 0000000000..df47e59adb Binary files /dev/null and b/ExtraTextures/HeartOriginal.png differ diff --git a/ExtraTextures/HeartOriginal2.png b/ExtraTextures/HeartOriginal2.png new file mode 100644 index 0000000000..c9ca6a9a83 Binary files /dev/null and b/ExtraTextures/HeartOriginal2.png differ diff --git a/ExtraTextures/IceShield.png b/ExtraTextures/IceShield.png new file mode 100644 index 0000000000..83ae2213f7 Binary files /dev/null and b/ExtraTextures/IceShield.png differ diff --git a/ExtraTextures/IronHeart.png b/ExtraTextures/IronHeart.png new file mode 100644 index 0000000000..02a90d27e2 Binary files /dev/null and b/ExtraTextures/IronHeart.png differ diff --git a/ExtraTextures/Lasers/ProvidenceHolyRayEnd.png b/ExtraTextures/Lasers/ProvidenceHolyRayEnd.png new file mode 100644 index 0000000000..ff754f30de Binary files /dev/null and b/ExtraTextures/Lasers/ProvidenceHolyRayEnd.png differ diff --git a/ExtraTextures/Lasers/ProvidenceHolyRayMid.png b/ExtraTextures/Lasers/ProvidenceHolyRayMid.png new file mode 100644 index 0000000000..1734586b6e Binary files /dev/null and b/ExtraTextures/Lasers/ProvidenceHolyRayMid.png differ diff --git a/ExtraTextures/Mana2.png b/ExtraTextures/Mana2.png new file mode 100644 index 0000000000..00eca5ac6f Binary files /dev/null and b/ExtraTextures/Mana2.png differ diff --git a/ExtraTextures/Mana3.png b/ExtraTextures/Mana3.png new file mode 100644 index 0000000000..66a9e6b12c Binary files /dev/null and b/ExtraTextures/Mana3.png differ diff --git a/ExtraTextures/Mana4.png b/ExtraTextures/Mana4.png new file mode 100644 index 0000000000..a8e3454d64 Binary files /dev/null and b/ExtraTextures/Mana4.png differ diff --git a/ExtraTextures/ManaOriginal.png b/ExtraTextures/ManaOriginal.png new file mode 100644 index 0000000000..26f938cae2 Binary files /dev/null and b/ExtraTextures/ManaOriginal.png differ diff --git a/ExtraTextures/Rain3.png b/ExtraTextures/Rain3.png new file mode 100644 index 0000000000..636e82a5c1 Binary files /dev/null and b/ExtraTextures/Rain3.png differ diff --git a/ExtraTextures/RainOriginal.png b/ExtraTextures/RainOriginal.png new file mode 100644 index 0000000000..fcf8f439da Binary files /dev/null and b/ExtraTextures/RainOriginal.png differ diff --git a/ExtraTextures/UI/AstralArcanumCircles.png b/ExtraTextures/UI/AstralArcanumCircles.png new file mode 100644 index 0000000000..badfdb493a Binary files /dev/null and b/ExtraTextures/UI/AstralArcanumCircles.png differ diff --git a/ExtraTextures/UI/BarAdrenaline.png b/ExtraTextures/UI/BarAdrenaline.png new file mode 100644 index 0000000000..f89895646d Binary files /dev/null and b/ExtraTextures/UI/BarAdrenaline.png differ diff --git a/ExtraTextures/UI/BarStress.png b/ExtraTextures/UI/BarStress.png new file mode 100644 index 0000000000..9c10d1cc9b Binary files /dev/null and b/ExtraTextures/UI/BarStress.png differ diff --git a/ExtraTextures/UI/BarStressBorder.png b/ExtraTextures/UI/BarStressBorder.png new file mode 100644 index 0000000000..7770c7348c Binary files /dev/null and b/ExtraTextures/UI/BarStressBorder.png differ diff --git a/ExtraTextures/UI/BossHPComboBar.png b/ExtraTextures/UI/BossHPComboBar.png new file mode 100644 index 0000000000..340041e8bc Binary files /dev/null and b/ExtraTextures/UI/BossHPComboBar.png differ diff --git a/ExtraTextures/UI/BossHPMainBar.png b/ExtraTextures/UI/BossHPMainBar.png new file mode 100644 index 0000000000..d683d2f98b Binary files /dev/null and b/ExtraTextures/UI/BossHPMainBar.png differ diff --git a/ExtraTextures/UI/BossHPSeperatorBar.png b/ExtraTextures/UI/BossHPSeperatorBar.png new file mode 100644 index 0000000000..986a4425ab Binary files /dev/null and b/ExtraTextures/UI/BossHPSeperatorBar.png differ diff --git a/Fonts/HPBarFont.xnb b/Fonts/HPBarFont.xnb new file mode 100644 index 0000000000..d7a68cb938 Binary files /dev/null and b/Fonts/HPBarFont.xnb differ diff --git a/Gores/BrimstoneGore1.png b/Gores/BrimstoneGore1.png new file mode 100644 index 0000000000..ee9170aff2 Binary files /dev/null and b/Gores/BrimstoneGore1.png differ diff --git a/Gores/BrimstoneGore2.png b/Gores/BrimstoneGore2.png new file mode 100644 index 0000000000..b5130d3655 Binary files /dev/null and b/Gores/BrimstoneGore2.png differ diff --git a/Gores/BrimstoneGore3.png b/Gores/BrimstoneGore3.png new file mode 100644 index 0000000000..9552beb0dc Binary files /dev/null and b/Gores/BrimstoneGore3.png differ diff --git a/Gores/BrimstoneGore4.png b/Gores/BrimstoneGore4.png new file mode 100644 index 0000000000..1251ef51ef Binary files /dev/null and b/Gores/BrimstoneGore4.png differ diff --git a/Gores/BrimstoneGore5.png b/Gores/BrimstoneGore5.png new file mode 100644 index 0000000000..29a1a9c6e4 Binary files /dev/null and b/Gores/BrimstoneGore5.png differ diff --git a/Gores/BrimstoneGore6.png b/Gores/BrimstoneGore6.png new file mode 100644 index 0000000000..0b4f2df12a Binary files /dev/null and b/Gores/BrimstoneGore6.png differ diff --git a/Gores/BrimstoneGore7.png b/Gores/BrimstoneGore7.png new file mode 100644 index 0000000000..df4db97604 Binary files /dev/null and b/Gores/BrimstoneGore7.png differ diff --git a/Gores/BumbleHead.png b/Gores/BumbleHead.png new file mode 100644 index 0000000000..35dd05ffdb Binary files /dev/null and b/Gores/BumbleHead.png differ diff --git a/Gores/BumbleLeg.png b/Gores/BumbleLeg.png new file mode 100644 index 0000000000..0893d07660 Binary files /dev/null and b/Gores/BumbleLeg.png differ diff --git a/Gores/BumbleWing.png b/Gores/BumbleWing.png new file mode 100644 index 0000000000..ad84e202e3 Binary files /dev/null and b/Gores/BumbleWing.png differ diff --git a/Gores/CeaselessVoid.png b/Gores/CeaselessVoid.png new file mode 100644 index 0000000000..1bde2ba6b0 Binary files /dev/null and b/Gores/CeaselessVoid.png differ diff --git a/Gores/CeaselessVoid2.png b/Gores/CeaselessVoid2.png new file mode 100644 index 0000000000..04ab5206aa Binary files /dev/null and b/Gores/CeaselessVoid2.png differ diff --git a/Gores/CeaselessVoid3.png b/Gores/CeaselessVoid3.png new file mode 100644 index 0000000000..254a4bf9d0 Binary files /dev/null and b/Gores/CeaselessVoid3.png differ diff --git a/Gores/CeaselessVoid4.png b/Gores/CeaselessVoid4.png new file mode 100644 index 0000000000..95a61e7665 Binary files /dev/null and b/Gores/CeaselessVoid4.png differ diff --git a/Gores/CeaselessVoid5.png b/Gores/CeaselessVoid5.png new file mode 100644 index 0000000000..877a2dd894 Binary files /dev/null and b/Gores/CeaselessVoid5.png differ diff --git a/Gores/Crabulon.png b/Gores/Crabulon.png new file mode 100644 index 0000000000..5d919a2f75 Binary files /dev/null and b/Gores/Crabulon.png differ diff --git a/Gores/Crabulon2.png b/Gores/Crabulon2.png new file mode 100644 index 0000000000..d9b6871579 Binary files /dev/null and b/Gores/Crabulon2.png differ diff --git a/Gores/Crabulon3.png b/Gores/Crabulon3.png new file mode 100644 index 0000000000..adaa981bab Binary files /dev/null and b/Gores/Crabulon3.png differ diff --git a/Gores/Crabulon4.png b/Gores/Crabulon4.png new file mode 100644 index 0000000000..18d8219f04 Binary files /dev/null and b/Gores/Crabulon4.png differ diff --git a/Gores/Crabulon5.png b/Gores/Crabulon5.png new file mode 100644 index 0000000000..97826cb283 Binary files /dev/null and b/Gores/Crabulon5.png differ diff --git a/Gores/Crabulon6.png b/Gores/Crabulon6.png new file mode 100644 index 0000000000..c5fe3ba5e3 Binary files /dev/null and b/Gores/Crabulon6.png differ diff --git a/Gores/Crabulon7.png b/Gores/Crabulon7.png new file mode 100644 index 0000000000..80c327f411 Binary files /dev/null and b/Gores/Crabulon7.png differ diff --git a/Gores/CryoGore1.png b/Gores/CryoGore1.png new file mode 100644 index 0000000000..aa6a4d0f2b Binary files /dev/null and b/Gores/CryoGore1.png differ diff --git a/Gores/CryoGore10.png b/Gores/CryoGore10.png new file mode 100644 index 0000000000..c48f9449ca Binary files /dev/null and b/Gores/CryoGore10.png differ diff --git a/Gores/CryoGore2.png b/Gores/CryoGore2.png new file mode 100644 index 0000000000..1773da8509 Binary files /dev/null and b/Gores/CryoGore2.png differ diff --git a/Gores/CryoGore3.png b/Gores/CryoGore3.png new file mode 100644 index 0000000000..a1b065d30a Binary files /dev/null and b/Gores/CryoGore3.png differ diff --git a/Gores/CryoGore4.png b/Gores/CryoGore4.png new file mode 100644 index 0000000000..42d55c2032 Binary files /dev/null and b/Gores/CryoGore4.png differ diff --git a/Gores/CryoGore5.png b/Gores/CryoGore5.png new file mode 100644 index 0000000000..a903261431 Binary files /dev/null and b/Gores/CryoGore5.png differ diff --git a/Gores/CryoGore6.png b/Gores/CryoGore6.png new file mode 100644 index 0000000000..f975cb7084 Binary files /dev/null and b/Gores/CryoGore6.png differ diff --git a/Gores/CryoGore7.png b/Gores/CryoGore7.png new file mode 100644 index 0000000000..56dde6cf9a Binary files /dev/null and b/Gores/CryoGore7.png differ diff --git a/Gores/CryoGore8.png b/Gores/CryoGore8.png new file mode 100644 index 0000000000..cecad5837e Binary files /dev/null and b/Gores/CryoGore8.png differ diff --git a/Gores/CryoGore9.png b/Gores/CryoGore9.png new file mode 100644 index 0000000000..b821b01c11 Binary files /dev/null and b/Gores/CryoGore9.png differ diff --git a/Gores/DoGBody.png b/Gores/DoGBody.png new file mode 100644 index 0000000000..064f582d22 Binary files /dev/null and b/Gores/DoGBody.png differ diff --git a/Gores/DoGBody2.png b/Gores/DoGBody2.png new file mode 100644 index 0000000000..5c8002687d Binary files /dev/null and b/Gores/DoGBody2.png differ diff --git a/Gores/DoGBody3.png b/Gores/DoGBody3.png new file mode 100644 index 0000000000..a1cdb98387 Binary files /dev/null and b/Gores/DoGBody3.png differ diff --git a/Gores/DoGHead.png b/Gores/DoGHead.png new file mode 100644 index 0000000000..aa6e29d01c Binary files /dev/null and b/Gores/DoGHead.png differ diff --git a/Gores/DoGTail.png b/Gores/DoGTail.png new file mode 100644 index 0000000000..360c8bcb88 Binary files /dev/null and b/Gores/DoGTail.png differ diff --git a/Gores/Leviathangib1.png b/Gores/Leviathangib1.png new file mode 100644 index 0000000000..0ecb8917b0 Binary files /dev/null and b/Gores/Leviathangib1.png differ diff --git a/Gores/Leviathangib2.png b/Gores/Leviathangib2.png new file mode 100644 index 0000000000..439118a08d Binary files /dev/null and b/Gores/Leviathangib2.png differ diff --git a/Gores/Leviathangib3.png b/Gores/Leviathangib3.png new file mode 100644 index 0000000000..e574799f70 Binary files /dev/null and b/Gores/Leviathangib3.png differ diff --git a/Gores/Providence.png b/Gores/Providence.png new file mode 100644 index 0000000000..f3bedd6b08 Binary files /dev/null and b/Gores/Providence.png differ diff --git a/Gores/Providence2.png b/Gores/Providence2.png new file mode 100644 index 0000000000..672a5c0cae Binary files /dev/null and b/Gores/Providence2.png differ diff --git a/Gores/Providence3.png b/Gores/Providence3.png new file mode 100644 index 0000000000..bf191bdfcd Binary files /dev/null and b/Gores/Providence3.png differ diff --git a/Gores/Providence4.png b/Gores/Providence4.png new file mode 100644 index 0000000000..6fa4eccd3d Binary files /dev/null and b/Gores/Providence4.png differ diff --git a/Gores/SWArmor_Gore1.png b/Gores/SWArmor_Gore1.png new file mode 100644 index 0000000000..b0c93ce836 Binary files /dev/null and b/Gores/SWArmor_Gore1.png differ diff --git a/Gores/SWArmor_Gore2.png b/Gores/SWArmor_Gore2.png new file mode 100644 index 0000000000..d8c80c5da3 Binary files /dev/null and b/Gores/SWArmor_Gore2.png differ diff --git a/Gores/SWArmor_Gore3.png b/Gores/SWArmor_Gore3.png new file mode 100644 index 0000000000..e5180b4086 Binary files /dev/null and b/Gores/SWArmor_Gore3.png differ diff --git a/Gores/SWArmor_Gore4.png b/Gores/SWArmor_Gore4.png new file mode 100644 index 0000000000..33fff6bf81 Binary files /dev/null and b/Gores/SWArmor_Gore4.png differ diff --git a/Gores/SWArmor_Gore5.png b/Gores/SWArmor_Gore5.png new file mode 100644 index 0000000000..2a745c93d8 Binary files /dev/null and b/Gores/SWArmor_Gore5.png differ diff --git a/Gores/SWNude_Gore1.png b/Gores/SWNude_Gore1.png new file mode 100644 index 0000000000..4529134f6c Binary files /dev/null and b/Gores/SWNude_Gore1.png differ diff --git a/Gores/SWNude_Gore2.png b/Gores/SWNude_Gore2.png new file mode 100644 index 0000000000..e6df2fa593 Binary files /dev/null and b/Gores/SWNude_Gore2.png differ diff --git a/Gores/SWNude_Gore3.png b/Gores/SWNude_Gore3.png new file mode 100644 index 0000000000..6798db66c8 Binary files /dev/null and b/Gores/SWNude_Gore3.png differ diff --git a/Gores/SWNude_Gore4.png b/Gores/SWNude_Gore4.png new file mode 100644 index 0000000000..466f39086f Binary files /dev/null and b/Gores/SWNude_Gore4.png differ diff --git a/Gores/SWNude_Gore5.png b/Gores/SWNude_Gore5.png new file mode 100644 index 0000000000..45759858ff Binary files /dev/null and b/Gores/SWNude_Gore5.png differ diff --git a/Gores/ScourgeBody.png b/Gores/ScourgeBody.png new file mode 100644 index 0000000000..accaf65b82 Binary files /dev/null and b/Gores/ScourgeBody.png differ diff --git a/Gores/ScourgeBody2.png b/Gores/ScourgeBody2.png new file mode 100644 index 0000000000..b794713f53 Binary files /dev/null and b/Gores/ScourgeBody2.png differ diff --git a/Gores/ScourgeBody3.png b/Gores/ScourgeBody3.png new file mode 100644 index 0000000000..dac9809a08 Binary files /dev/null and b/Gores/ScourgeBody3.png differ diff --git a/Gores/ScourgeHead.png b/Gores/ScourgeHead.png new file mode 100644 index 0000000000..e8d61d2dc7 Binary files /dev/null and b/Gores/ScourgeHead.png differ diff --git a/Gores/ScourgeHead2.png b/Gores/ScourgeHead2.png new file mode 100644 index 0000000000..8510307c09 Binary files /dev/null and b/Gores/ScourgeHead2.png differ diff --git a/Gores/ScourgeTail.png b/Gores/ScourgeTail.png new file mode 100644 index 0000000000..6c89dc8498 Binary files /dev/null and b/Gores/ScourgeTail.png differ diff --git a/Gores/Signus.png b/Gores/Signus.png new file mode 100644 index 0000000000..0c7985a741 Binary files /dev/null and b/Gores/Signus.png differ diff --git a/Gores/Signus2.png b/Gores/Signus2.png new file mode 100644 index 0000000000..b2d660318f Binary files /dev/null and b/Gores/Signus2.png differ diff --git a/Gores/Signus3.png b/Gores/Signus3.png new file mode 100644 index 0000000000..b913a7117a Binary files /dev/null and b/Gores/Signus3.png differ diff --git a/Gores/Signus4.png b/Gores/Signus4.png new file mode 100644 index 0000000000..a998805cf3 Binary files /dev/null and b/Gores/Signus4.png differ diff --git a/Gores/Signus5.png b/Gores/Signus5.png new file mode 100644 index 0000000000..2b4596e608 Binary files /dev/null and b/Gores/Signus5.png differ diff --git a/Gores/TarraHeart.png b/Gores/TarraHeart.png new file mode 100644 index 0000000000..dc382d7695 Binary files /dev/null and b/Gores/TarraHeart.png differ diff --git a/Injections.cs b/Injections.cs new file mode 100644 index 0000000000..bd0842b2f4 --- /dev/null +++ b/Injections.cs @@ -0,0 +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; + } + } +} diff --git a/Items/AbyssItems/AbyssalAmulet.cs b/Items/AbyssItems/AbyssalAmulet.cs new file mode 100644 index 0000000000..1dbaf5a936 --- /dev/null +++ b/Items/AbyssItems/AbyssalAmulet.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AbyssalAmulet.png b/Items/AbyssItems/AbyssalAmulet.png new file mode 100644 index 0000000000..be96ac38b2 Binary files /dev/null and b/Items/AbyssItems/AbyssalAmulet.png differ diff --git a/Items/AbyssItems/AbyssalDivingGear.cs b/Items/AbyssItems/AbyssalDivingGear.cs new file mode 100644 index 0000000000..bc21596895 --- /dev/null +++ b/Items/AbyssItems/AbyssalDivingGear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/AbyssalDivingGear.png b/Items/AbyssItems/AbyssalDivingGear.png new file mode 100644 index 0000000000..a9fb6fc059 Binary files /dev/null and b/Items/AbyssItems/AbyssalDivingGear.png differ diff --git a/Items/AbyssItems/AbyssalDivingGear_Head.png b/Items/AbyssItems/AbyssalDivingGear_Head.png new file mode 100644 index 0000000000..4f71e2541b Binary files /dev/null and b/Items/AbyssItems/AbyssalDivingGear_Head.png differ diff --git a/Items/AbyssItems/AlluringBait.cs b/Items/AbyssItems/AlluringBait.cs new file mode 100644 index 0000000000..f49651c01a --- /dev/null +++ b/Items/AbyssItems/AlluringBait.cs @@ -0,0 +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; } + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/AlluringBait.png b/Items/AbyssItems/AlluringBait.png new file mode 100644 index 0000000000..0613840036 Binary files /dev/null and b/Items/AbyssItems/AlluringBait.png differ diff --git a/Items/AbyssItems/AnechoicPlating.cs b/Items/AbyssItems/AnechoicPlating.cs new file mode 100644 index 0000000000..8a46cbadef --- /dev/null +++ b/Items/AbyssItems/AnechoicPlating.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AnechoicPlating.png b/Items/AbyssItems/AnechoicPlating.png new file mode 100644 index 0000000000..cb4f22f0f8 Binary files /dev/null and b/Items/AbyssItems/AnechoicPlating.png differ diff --git a/Items/AbyssItems/CloakingGland.cs b/Items/AbyssItems/CloakingGland.cs new file mode 100644 index 0000000000..12672c973f --- /dev/null +++ b/Items/AbyssItems/CloakingGland.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/CloakingGland.png b/Items/AbyssItems/CloakingGland.png new file mode 100644 index 0000000000..a495200ecf Binary files /dev/null and b/Items/AbyssItems/CloakingGland.png differ diff --git a/Items/AbyssItems/DepthCells.cs b/Items/AbyssItems/DepthCells.cs new file mode 100644 index 0000000000..623e730583 --- /dev/null +++ b/Items/AbyssItems/DepthCells.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/DepthCells.png b/Items/AbyssItems/DepthCells.png new file mode 100644 index 0000000000..1475b534ef Binary files /dev/null and b/Items/AbyssItems/DepthCells.png differ diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs new file mode 100644 index 0000000000..c445944734 --- /dev/null +++ b/Items/AbyssItems/DepthCharm.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DepthCharm.png b/Items/AbyssItems/DepthCharm.png new file mode 100644 index 0000000000..ae87fb6c68 Binary files /dev/null and b/Items/AbyssItems/DepthCharm.png differ diff --git a/Items/AbyssItems/IronBoots.cs b/Items/AbyssItems/IronBoots.cs new file mode 100644 index 0000000000..c02ae2c835 --- /dev/null +++ b/Items/AbyssItems/IronBoots.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/IronBoots.png b/Items/AbyssItems/IronBoots.png new file mode 100644 index 0000000000..13da3613bb Binary files /dev/null and b/Items/AbyssItems/IronBoots.png differ diff --git a/Items/AbyssItems/Lumenite.cs b/Items/AbyssItems/Lumenite.cs new file mode 100644 index 0000000000..40dea3d744 --- /dev/null +++ b/Items/AbyssItems/Lumenite.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/Lumenite.png b/Items/AbyssItems/Lumenite.png new file mode 100644 index 0000000000..012625eb5d Binary files /dev/null and b/Items/AbyssItems/Lumenite.png differ diff --git a/Items/AbyssItems/LumenousAmulet.cs b/Items/AbyssItems/LumenousAmulet.cs new file mode 100644 index 0000000000..3a66fbb17b --- /dev/null +++ b/Items/AbyssItems/LumenousAmulet.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/LumenousAmulet.png b/Items/AbyssItems/LumenousAmulet.png new file mode 100644 index 0000000000..7d4f7e7172 Binary files /dev/null and b/Items/AbyssItems/LumenousAmulet.png differ diff --git a/Items/AbyssItems/ReaperTooth.cs b/Items/AbyssItems/ReaperTooth.cs new file mode 100644 index 0000000000..a9eea2f8f0 --- /dev/null +++ b/Items/AbyssItems/ReaperTooth.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/ReaperTooth.png b/Items/AbyssItems/ReaperTooth.png new file mode 100644 index 0000000000..32a9ce871a Binary files /dev/null and b/Items/AbyssItems/ReaperTooth.png differ diff --git a/Items/AbyssItems/ReaperToothNecklace.cs b/Items/AbyssItems/ReaperToothNecklace.cs new file mode 100644 index 0000000000..94aeebe0d9 --- /dev/null +++ b/Items/AbyssItems/ReaperToothNecklace.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/ReaperToothNecklace.png b/Items/AbyssItems/ReaperToothNecklace.png new file mode 100644 index 0000000000..d10a44bdcf Binary files /dev/null and b/Items/AbyssItems/ReaperToothNecklace.png differ diff --git a/Items/AbyssItems/StrangeOrb.cs b/Items/AbyssItems/StrangeOrb.cs new file mode 100644 index 0000000000..a168b28067 --- /dev/null +++ b/Items/AbyssItems/StrangeOrb.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/StrangeOrb.png b/Items/AbyssItems/StrangeOrb.png new file mode 100644 index 0000000000..7e552ad1b1 Binary files /dev/null and b/Items/AbyssItems/StrangeOrb.png differ diff --git a/Items/AbyssItems/SunkenStew.cs b/Items/AbyssItems/SunkenStew.cs new file mode 100644 index 0000000000..7537cb2669 --- /dev/null +++ b/Items/AbyssItems/SunkenStew.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/SunkenStew.png b/Items/AbyssItems/SunkenStew.png new file mode 100644 index 0000000000..df5da8ec18 Binary files /dev/null and b/Items/AbyssItems/SunkenStew.png differ diff --git a/Items/AbyssItems/TorrentialTear.cs b/Items/AbyssItems/TorrentialTear.cs new file mode 100644 index 0000000000..3cdcf4255e --- /dev/null +++ b/Items/AbyssItems/TorrentialTear.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.AbyssItems +{ + public class TorrentialTear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Torrential Tear"); + Tooltip.SetDefault("Summons the rain\n" + + "Rain will start some time after this item is used\n" + + "If used when raining the rain will stop some time after this item is used"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.slimeRain; + } + + public override bool UseItem(Player player) + { + if (!Main.raining) + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.Next(3) == 0) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.Next(4) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(5) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(6) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.Next(7) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.Next(8) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.Next(2) == 0) + { + num3 += 0.05f; + } + if (Main.rand.Next(3) == 0) + { + num3 += 0.1f; + } + if (Main.rand.Next(4) == 0) + { + num3 += 0.15f; + } + if (Main.rand.Next(5) == 0) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + return true; + } + } +} \ No newline at end of file diff --git a/Items/AbyssItems/TorrentialTear.png b/Items/AbyssItems/TorrentialTear.png new file mode 100644 index 0000000000..aed052e4ad Binary files /dev/null and b/Items/AbyssItems/TorrentialTear.png differ diff --git a/Items/AbyssalWarhammer.cs b/Items/AbyssalWarhammer.cs new file mode 100644 index 0000000000..c7884ca14a --- /dev/null +++ b/Items/AbyssalWarhammer.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/AbyssalWarhammer.png b/Items/AbyssalWarhammer.png new file mode 100644 index 0000000000..d97bc38be0 Binary files /dev/null and b/Items/AbyssalWarhammer.png differ diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs new file mode 100644 index 0000000000..35438013fb --- /dev/null +++ b/Items/Accessories/AlchemicalFlask.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AlchemicalFlask.png b/Items/Accessories/AlchemicalFlask.png new file mode 100644 index 0000000000..5842c55cd9 Binary files /dev/null and b/Items/Accessories/AlchemicalFlask.png differ diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs new file mode 100644 index 0000000000..7d902caeb7 --- /dev/null +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AmalgamatedBrain.png b/Items/Accessories/AmalgamatedBrain.png new file mode 100644 index 0000000000..a797ed20a0 Binary files /dev/null and b/Items/Accessories/AmalgamatedBrain.png differ diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs new file mode 100644 index 0000000000..b07a61eb15 --- /dev/null +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AmbrosialAmpoule.png b/Items/Accessories/AmbrosialAmpoule.png new file mode 100644 index 0000000000..0af3db041c Binary files /dev/null and b/Items/Accessories/AmbrosialAmpoule.png differ diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs new file mode 100644 index 0000000000..61eb70039a --- /dev/null +++ b/Items/Accessories/AmidiasSpark.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Accessories/AmidiasSpark.png b/Items/Accessories/AmidiasSpark.png new file mode 100644 index 0000000000..e398bf8076 Binary files /dev/null and b/Items/Accessories/AmidiasSpark.png differ diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs new file mode 100644 index 0000000000..9c58e7d53c --- /dev/null +++ b/Items/Accessories/AncientFossil.cs @@ -0,0 +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(); + } +}} \ No newline at end of file diff --git a/Items/Accessories/AncientFossil.png b/Items/Accessories/AncientFossil.png new file mode 100644 index 0000000000..990d472125 Binary files /dev/null and b/Items/Accessories/AncientFossil.png differ diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs new file mode 100644 index 0000000000..f9e3177dd9 --- /dev/null +++ b/Items/Accessories/AngelTreads.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AngelTreads.png b/Items/Accessories/AngelTreads.png new file mode 100644 index 0000000000..b3eb3b6477 Binary files /dev/null and b/Items/Accessories/AngelTreads.png differ diff --git a/Items/Accessories/AngelTreads_Shoes.png b/Items/Accessories/AngelTreads_Shoes.png new file mode 100644 index 0000000000..7b75c4e9ec Binary files /dev/null and b/Items/Accessories/AngelTreads_Shoes.png differ diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs new file mode 100644 index 0000000000..3fcc61285d --- /dev/null +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ArcanumoftheVoid.png b/Items/Accessories/ArcanumoftheVoid.png new file mode 100644 index 0000000000..0dea4e456d Binary files /dev/null and b/Items/Accessories/ArcanumoftheVoid.png differ diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs new file mode 100644 index 0000000000..5fecc1bea9 --- /dev/null +++ b/Items/Accessories/ArchaicPowder.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/ArchaicPowder.png b/Items/Accessories/ArchaicPowder.png new file mode 100644 index 0000000000..7a9bdb84a7 Binary files /dev/null and b/Items/Accessories/ArchaicPowder.png differ diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs new file mode 100644 index 0000000000..7bbbcef425 --- /dev/null +++ b/Items/Accessories/AsgardianAegis.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AsgardianAegis.png b/Items/Accessories/AsgardianAegis.png new file mode 100644 index 0000000000..652538ff9d Binary files /dev/null and b/Items/Accessories/AsgardianAegis.png differ diff --git a/Items/Accessories/AsgardianAegis_Shield.png b/Items/Accessories/AsgardianAegis_Shield.png new file mode 100644 index 0000000000..463df65127 Binary files /dev/null and b/Items/Accessories/AsgardianAegis_Shield.png differ diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs new file mode 100644 index 0000000000..0acf90f685 --- /dev/null +++ b/Items/Accessories/AsgardsValor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AsgardsValor.png b/Items/Accessories/AsgardsValor.png new file mode 100644 index 0000000000..6a56bed385 Binary files /dev/null and b/Items/Accessories/AsgardsValor.png differ diff --git a/Items/Accessories/AsgardsValor_Shield.png b/Items/Accessories/AsgardsValor_Shield.png new file mode 100644 index 0000000000..4815ca1dcf Binary files /dev/null and b/Items/Accessories/AsgardsValor_Shield.png differ diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs new file mode 100644 index 0000000000..458fab3dfe --- /dev/null +++ b/Items/Accessories/AstralArcanum.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AstralArcanum.png b/Items/Accessories/AstralArcanum.png new file mode 100644 index 0000000000..456ae3a2cd Binary files /dev/null and b/Items/Accessories/AstralArcanum.png differ diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs new file mode 100644 index 0000000000..f844766a09 --- /dev/null +++ b/Items/Accessories/AstralBulwark.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AstralBulwark.png b/Items/Accessories/AstralBulwark.png new file mode 100644 index 0000000000..71e53af765 Binary files /dev/null and b/Items/Accessories/AstralBulwark.png differ diff --git a/Items/Accessories/AureateWings.cs b/Items/Accessories/AureateWings.cs new file mode 100644 index 0000000000..60d3747837 --- /dev/null +++ b/Items/Accessories/AureateWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/AureateWings.png b/Items/Accessories/AureateWings.png new file mode 100644 index 0000000000..7a5fb3990e Binary files /dev/null and b/Items/Accessories/AureateWings.png differ diff --git a/Items/Accessories/AureateWings_Wings.png b/Items/Accessories/AureateWings_Wings.png new file mode 100644 index 0000000000..62a7e4ab38 Binary files /dev/null and b/Items/Accessories/AureateWings_Wings.png differ diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs new file mode 100644 index 0000000000..34ebb4f48f --- /dev/null +++ b/Items/Accessories/BadgeofBravery.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/BadgeofBravery.png b/Items/Accessories/BadgeofBravery.png new file mode 100644 index 0000000000..eb84be6d15 Binary files /dev/null and b/Items/Accessories/BadgeofBravery.png differ diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs new file mode 100644 index 0000000000..0d1971a0aa --- /dev/null +++ b/Items/Accessories/BloodflareCore.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/BloodflareCore.png b/Items/Accessories/BloodflareCore.png new file mode 100644 index 0000000000..69a8a4582e Binary files /dev/null and b/Items/Accessories/BloodflareCore.png differ diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs new file mode 100644 index 0000000000..7fc5729a4e --- /dev/null +++ b/Items/Accessories/BloodyWormScarf.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/BloodyWormScarf.png b/Items/Accessories/BloodyWormScarf.png new file mode 100644 index 0000000000..1821a0087c Binary files /dev/null and b/Items/Accessories/BloodyWormScarf.png differ diff --git a/Items/Accessories/BloodyWormScarf_Neck.png b/Items/Accessories/BloodyWormScarf_Neck.png new file mode 100644 index 0000000000..33cff67bf9 Binary files /dev/null and b/Items/Accessories/BloodyWormScarf_Neck.png differ diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs new file mode 100644 index 0000000000..a68aae4df5 --- /dev/null +++ b/Items/Accessories/BurdenBreaker.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/BurdenBreaker.png b/Items/Accessories/BurdenBreaker.png new file mode 100644 index 0000000000..c20fb03abc Binary files /dev/null and b/Items/Accessories/BurdenBreaker.png differ diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs new file mode 100644 index 0000000000..b38e4e2905 --- /dev/null +++ b/Items/Accessories/CelestialJewel.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CelestialJewel.png b/Items/Accessories/CelestialJewel.png new file mode 100644 index 0000000000..0684b983e7 Binary files /dev/null and b/Items/Accessories/CelestialJewel.png differ diff --git a/Items/Accessories/CelestialTracers.cs b/Items/Accessories/CelestialTracers.cs new file mode 100644 index 0000000000..66eb4fb3ce --- /dev/null +++ b/Items/Accessories/CelestialTracers.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CelestialTracers.png b/Items/Accessories/CelestialTracers.png new file mode 100644 index 0000000000..1608a8dc7c Binary files /dev/null and b/Items/Accessories/CelestialTracers.png differ diff --git a/Items/Accessories/CelestialTracers_Wings.png b/Items/Accessories/CelestialTracers_Wings.png new file mode 100644 index 0000000000..8d12052aa8 Binary files /dev/null and b/Items/Accessories/CelestialTracers_Wings.png differ diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs new file mode 100644 index 0000000000..28ff3202c4 --- /dev/null +++ b/Items/Accessories/ChaosAmulet.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/ChaosAmulet.png b/Items/Accessories/ChaosAmulet.png new file mode 100644 index 0000000000..23ed2a3e96 Binary files /dev/null and b/Items/Accessories/ChaosAmulet.png differ diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs new file mode 100644 index 0000000000..57c4c04054 --- /dev/null +++ b/Items/Accessories/CheatTestThing.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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); + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CheatTestThing.png b/Items/Accessories/CheatTestThing.png new file mode 100644 index 0000000000..a3aaf9f07f Binary files /dev/null and b/Items/Accessories/CheatTestThing.png differ diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs new file mode 100644 index 0000000000..ab12b8dee3 --- /dev/null +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CoreOfTheBloodGod.png b/Items/Accessories/CoreOfTheBloodGod.png new file mode 100644 index 0000000000..b3e2dfb3f3 Binary files /dev/null and b/Items/Accessories/CoreOfTheBloodGod.png differ diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs new file mode 100644 index 0000000000..a7b01c86c3 --- /dev/null +++ b/Items/Accessories/CorruptFlask.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CorruptFlask.png b/Items/Accessories/CorruptFlask.png new file mode 100644 index 0000000000..373c8d6896 Binary files /dev/null and b/Items/Accessories/CorruptFlask.png differ diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs new file mode 100644 index 0000000000..0125361c72 --- /dev/null +++ b/Items/Accessories/CounterScarf.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CounterScarf.png b/Items/Accessories/CounterScarf.png new file mode 100644 index 0000000000..4799798e1a Binary files /dev/null and b/Items/Accessories/CounterScarf.png differ diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs new file mode 100644 index 0000000000..ea1af3bfc2 --- /dev/null +++ b/Items/Accessories/CrawCarapace.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/CrawCarapace.png b/Items/Accessories/CrawCarapace.png new file mode 100644 index 0000000000..03e8927f35 Binary files /dev/null and b/Items/Accessories/CrawCarapace.png differ diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs new file mode 100644 index 0000000000..034a11dc67 --- /dev/null +++ b/Items/Accessories/CrimsonFlask.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CrimsonFlask.png b/Items/Accessories/CrimsonFlask.png new file mode 100644 index 0000000000..9ab724f8a2 Binary files /dev/null and b/Items/Accessories/CrimsonFlask.png differ diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs new file mode 100644 index 0000000000..cffbf171bc --- /dev/null +++ b/Items/Accessories/CrownJewel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/CrownJewel.png b/Items/Accessories/CrownJewel.png new file mode 100644 index 0000000000..326c657ab4 Binary files /dev/null and b/Items/Accessories/CrownJewel.png differ diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs new file mode 100644 index 0000000000..2c731286a5 --- /dev/null +++ b/Items/Accessories/DaedalusEmblem.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/DaedalusEmblem.png b/Items/Accessories/DaedalusEmblem.png new file mode 100644 index 0000000000..233491de85 Binary files /dev/null and b/Items/Accessories/DaedalusEmblem.png differ diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs new file mode 100644 index 0000000000..f690db9240 --- /dev/null +++ b/Items/Accessories/DarkSunRing.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/DarkSunRing.png b/Items/Accessories/DarkSunRing.png new file mode 100644 index 0000000000..deef093bf1 Binary files /dev/null and b/Items/Accessories/DarkSunRing.png differ diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs new file mode 100644 index 0000000000..251608a145 --- /dev/null +++ b/Items/Accessories/DeificAmulet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/DeificAmulet.png b/Items/Accessories/DeificAmulet.png new file mode 100644 index 0000000000..0594f60ad6 Binary files /dev/null and b/Items/Accessories/DeificAmulet.png differ diff --git a/Items/Accessories/DiscordianWings.cs b/Items/Accessories/DiscordianWings.cs new file mode 100644 index 0000000000..5691a8dbaa --- /dev/null +++ b/Items/Accessories/DiscordianWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/DiscordianWings.png b/Items/Accessories/DiscordianWings.png new file mode 100644 index 0000000000..724f184a91 Binary files /dev/null and b/Items/Accessories/DiscordianWings.png differ diff --git a/Items/Accessories/DiscordianWings_Wings.png b/Items/Accessories/DiscordianWings_Wings.png new file mode 100644 index 0000000000..32e387a8c1 Binary files /dev/null and b/Items/Accessories/DiscordianWings_Wings.png differ diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs new file mode 100644 index 0000000000..2e94e13d1c --- /dev/null +++ b/Items/Accessories/DraedonsHeart.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DraedonsHeart.png b/Items/Accessories/DraedonsHeart.png new file mode 100644 index 0000000000..7bf5f16738 Binary files /dev/null and b/Items/Accessories/DraedonsHeart.png differ diff --git a/Items/Accessories/DrewsWings.cs b/Items/Accessories/DrewsWings.cs new file mode 100644 index 0000000000..ededab2926 --- /dev/null +++ b/Items/Accessories/DrewsWings.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/DrewsWings.png b/Items/Accessories/DrewsWings.png new file mode 100644 index 0000000000..bd8707e1c3 Binary files /dev/null and b/Items/Accessories/DrewsWings.png differ diff --git a/Items/Accessories/DrewsWings_Wings.png b/Items/Accessories/DrewsWings_Wings.png new file mode 100644 index 0000000000..131487a6d7 Binary files /dev/null and b/Items/Accessories/DrewsWings_Wings.png differ diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs new file mode 100644 index 0000000000..6b05ae904a --- /dev/null +++ b/Items/Accessories/ElementalGauntlet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/ElementalGauntlet.png b/Items/Accessories/ElementalGauntlet.png new file mode 100644 index 0000000000..f036530101 Binary files /dev/null and b/Items/Accessories/ElementalGauntlet.png differ diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs new file mode 100644 index 0000000000..5e2e7c8cf3 --- /dev/null +++ b/Items/Accessories/ElementalQuiver.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/ElementalQuiver.png b/Items/Accessories/ElementalQuiver.png new file mode 100644 index 0000000000..97b8ee59f6 Binary files /dev/null and b/Items/Accessories/ElementalQuiver.png differ diff --git a/Items/Accessories/ElysianTracers.cs b/Items/Accessories/ElysianTracers.cs new file mode 100644 index 0000000000..f34e2de160 --- /dev/null +++ b/Items/Accessories/ElysianTracers.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/ElysianTracers.png b/Items/Accessories/ElysianTracers.png new file mode 100644 index 0000000000..4bb21bbcbf Binary files /dev/null and b/Items/Accessories/ElysianTracers.png differ diff --git a/Items/Accessories/ElysianTracers_Wings.png b/Items/Accessories/ElysianTracers_Wings.png new file mode 100644 index 0000000000..ea1286df90 Binary files /dev/null and b/Items/Accessories/ElysianTracers_Wings.png differ diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs new file mode 100644 index 0000000000..8a8a816d2e --- /dev/null +++ b/Items/Accessories/EtherealTalisman.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/EtherealTalisman.png b/Items/Accessories/EtherealTalisman.png new file mode 100644 index 0000000000..a6ba2417cf Binary files /dev/null and b/Items/Accessories/EtherealTalisman.png differ diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs new file mode 100644 index 0000000000..2fb118264c --- /dev/null +++ b/Items/Accessories/EyeoftheStorm.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/EyeoftheStorm.png b/Items/Accessories/EyeoftheStorm.png new file mode 100644 index 0000000000..94fa8bab77 Binary files /dev/null and b/Items/Accessories/EyeoftheStorm.png differ diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs new file mode 100644 index 0000000000..8f4b19eaee --- /dev/null +++ b/Items/Accessories/FrigidBulwark.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/FrigidBulwark.png b/Items/Accessories/FrigidBulwark.png new file mode 100644 index 0000000000..63f44d9187 Binary files /dev/null and b/Items/Accessories/FrigidBulwark.png differ diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs new file mode 100644 index 0000000000..d6cf559d3d --- /dev/null +++ b/Items/Accessories/FrostBarrier.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/FrostBarrier.png b/Items/Accessories/FrostBarrier.png new file mode 100644 index 0000000000..34c900609d Binary files /dev/null and b/Items/Accessories/FrostBarrier.png differ diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs new file mode 100644 index 0000000000..5f7d582894 --- /dev/null +++ b/Items/Accessories/FrostFlare.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/FrostFlare.png b/Items/Accessories/FrostFlare.png new file mode 100644 index 0000000000..e868973ad7 Binary files /dev/null and b/Items/Accessories/FrostFlare.png differ diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs new file mode 100644 index 0000000000..ce9afe3298 --- /dev/null +++ b/Items/Accessories/FungalCarapace.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/FungalCarapace.png b/Items/Accessories/FungalCarapace.png new file mode 100644 index 0000000000..8a6a96a438 Binary files /dev/null and b/Items/Accessories/FungalCarapace.png differ diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs new file mode 100644 index 0000000000..0ba8cca097 --- /dev/null +++ b/Items/Accessories/GiantShell.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/GiantShell.png b/Items/Accessories/GiantShell.png new file mode 100644 index 0000000000..84bb0188ba Binary files /dev/null and b/Items/Accessories/GiantShell.png differ diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs new file mode 100644 index 0000000000..6fbe08fc1a --- /dev/null +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/GiantTortoiseShell.png b/Items/Accessories/GiantTortoiseShell.png new file mode 100644 index 0000000000..daf93f5fcc Binary files /dev/null and b/Items/Accessories/GiantTortoiseShell.png differ diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs new file mode 100644 index 0000000000..54348f2902 --- /dev/null +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/GoldBurdenBreaker.png b/Items/Accessories/GoldBurdenBreaker.png new file mode 100644 index 0000000000..f8f2de910e Binary files /dev/null and b/Items/Accessories/GoldBurdenBreaker.png differ diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs new file mode 100644 index 0000000000..546199afd6 --- /dev/null +++ b/Items/Accessories/GrandGelatin.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/GrandGelatin.png b/Items/Accessories/GrandGelatin.png new file mode 100644 index 0000000000..1686452216 Binary files /dev/null and b/Items/Accessories/GrandGelatin.png differ diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs new file mode 100644 index 0000000000..eae7be81f2 --- /dev/null +++ b/Items/Accessories/HarpyRing.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/HarpyRing.png b/Items/Accessories/HarpyRing.png new file mode 100644 index 0000000000..b81411ba3a Binary files /dev/null and b/Items/Accessories/HarpyRing.png differ diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs new file mode 100644 index 0000000000..77b54fc22f --- /dev/null +++ b/Items/Accessories/HeartofDarkness.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/HeartofDarkness.png b/Items/Accessories/HeartofDarkness.png new file mode 100644 index 0000000000..b2b2517dd7 Binary files /dev/null and b/Items/Accessories/HeartofDarkness.png differ diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs new file mode 100644 index 0000000000..9a3465cf97 --- /dev/null +++ b/Items/Accessories/HeartoftheElements.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +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(); + } + } +} diff --git a/Items/Accessories/HeartoftheElements.png b/Items/Accessories/HeartoftheElements.png new file mode 100644 index 0000000000..09e0a4d876 Binary files /dev/null and b/Items/Accessories/HeartoftheElements.png differ diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs new file mode 100644 index 0000000000..2f6444ac11 --- /dev/null +++ b/Items/Accessories/HoneyDew.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/HoneyDew.png b/Items/Accessories/HoneyDew.png new file mode 100644 index 0000000000..0f4cd8b947 Binary files /dev/null and b/Items/Accessories/HoneyDew.png differ diff --git a/Items/Accessories/InfinityBoots.cs b/Items/Accessories/InfinityBoots.cs new file mode 100644 index 0000000000..0fdb196524 --- /dev/null +++ b/Items/Accessories/InfinityBoots.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/InfinityBoots.png b/Items/Accessories/InfinityBoots.png new file mode 100644 index 0000000000..ceb770eb52 Binary files /dev/null and b/Items/Accessories/InfinityBoots.png differ diff --git a/Items/Accessories/InfinityBoots_Shoes.png b/Items/Accessories/InfinityBoots_Shoes.png new file mode 100644 index 0000000000..8486547e6a Binary files /dev/null and b/Items/Accessories/InfinityBoots_Shoes.png differ diff --git a/Items/Accessories/InfinityBoots_Wings.png b/Items/Accessories/InfinityBoots_Wings.png new file mode 100644 index 0000000000..a45ea45837 Binary files /dev/null and b/Items/Accessories/InfinityBoots_Wings.png differ diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs new file mode 100644 index 0000000000..ec086688fc --- /dev/null +++ b/Items/Accessories/Laudanum.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/Laudanum.png b/Items/Accessories/Laudanum.png new file mode 100644 index 0000000000..92d5f60546 Binary files /dev/null and b/Items/Accessories/Laudanum.png differ diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs new file mode 100644 index 0000000000..d49d8636ec --- /dev/null +++ b/Items/Accessories/LeadCore.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Accessories/LeadCore.png b/Items/Accessories/LeadCore.png new file mode 100644 index 0000000000..f5ed74b3ef Binary files /dev/null and b/Items/Accessories/LeadCore.png differ diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs new file mode 100644 index 0000000000..be68250e25 --- /dev/null +++ b/Items/Accessories/LifeJelly.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/LifeJelly.png b/Items/Accessories/LifeJelly.png new file mode 100644 index 0000000000..fd5e502d8a Binary files /dev/null and b/Items/Accessories/LifeJelly.png differ diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs new file mode 100644 index 0000000000..57725ce397 --- /dev/null +++ b/Items/Accessories/LivingDew.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/LivingDew.png b/Items/Accessories/LivingDew.png new file mode 100644 index 0000000000..8ef949d3b5 Binary files /dev/null and b/Items/Accessories/LivingDew.png differ diff --git a/Items/Accessories/MLGRune.cs b/Items/Accessories/MLGRune.cs new file mode 100644 index 0000000000..ccd090e9e9 --- /dev/null +++ b/Items/Accessories/MLGRune.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/MLGRune.png b/Items/Accessories/MLGRune.png new file mode 100644 index 0000000000..573076e80f Binary files /dev/null and b/Items/Accessories/MLGRune.png differ diff --git a/Items/Accessories/MLGRune2.cs b/Items/Accessories/MLGRune2.cs new file mode 100644 index 0000000000..b521225c6f --- /dev/null +++ b/Items/Accessories/MLGRune2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/MLGRune2.png b/Items/Accessories/MLGRune2.png new file mode 100644 index 0000000000..bf03e60350 Binary files /dev/null and b/Items/Accessories/MLGRune2.png differ diff --git a/Items/Accessories/MOAB.cs b/Items/Accessories/MOAB.cs new file mode 100644 index 0000000000..5c5bcf6bab --- /dev/null +++ b/Items/Accessories/MOAB.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/MOAB.png b/Items/Accessories/MOAB.png new file mode 100644 index 0000000000..e67e251f22 Binary files /dev/null and b/Items/Accessories/MOAB.png differ diff --git a/Items/Accessories/MOAB_Wings.png b/Items/Accessories/MOAB_Wings.png new file mode 100644 index 0000000000..b7e594948f Binary files /dev/null and b/Items/Accessories/MOAB_Wings.png differ diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs new file mode 100644 index 0000000000..cceafe198e --- /dev/null +++ b/Items/Accessories/ManaJelly.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/ManaJelly.png b/Items/Accessories/ManaJelly.png new file mode 100644 index 0000000000..14cb0a92bb Binary files /dev/null and b/Items/Accessories/ManaJelly.png differ diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs new file mode 100644 index 0000000000..bbd7f9ae80 --- /dev/null +++ b/Items/Accessories/Nanotech.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/Nanotech.png b/Items/Accessories/Nanotech.png new file mode 100644 index 0000000000..cbbecde15f Binary files /dev/null and b/Items/Accessories/Nanotech.png differ diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs new file mode 100644 index 0000000000..00842ce427 --- /dev/null +++ b/Items/Accessories/NecklaceofVexation.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/NecklaceofVexation.png b/Items/Accessories/NecklaceofVexation.png new file mode 100644 index 0000000000..90a08102f4 Binary files /dev/null and b/Items/Accessories/NecklaceofVexation.png differ diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs new file mode 100644 index 0000000000..71ea7cf8b2 --- /dev/null +++ b/Items/Accessories/OrnateShield.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/OrnateShield.png b/Items/Accessories/OrnateShield.png new file mode 100644 index 0000000000..bb299c9657 Binary files /dev/null and b/Items/Accessories/OrnateShield.png differ diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs new file mode 100644 index 0000000000..f05820dd9e --- /dev/null +++ b/Items/Accessories/PlagueHive.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/PlagueHive.png b/Items/Accessories/PlagueHive.png new file mode 100644 index 0000000000..48e3845b9a Binary files /dev/null and b/Items/Accessories/PlagueHive.png differ diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs new file mode 100644 index 0000000000..2e6101da20 --- /dev/null +++ b/Items/Accessories/PsychoticAmulet.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/PsychoticAmulet.png b/Items/Accessories/PsychoticAmulet.png new file mode 100644 index 0000000000..25481d8485 Binary files /dev/null and b/Items/Accessories/PsychoticAmulet.png differ diff --git a/Items/Accessories/PusSac.png b/Items/Accessories/PusSac.png new file mode 100644 index 0000000000..b7e706c8d0 Binary files /dev/null and b/Items/Accessories/PusSac.png differ diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs new file mode 100644 index 0000000000..975d51981b --- /dev/null +++ b/Items/Accessories/RadiantOoze.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/RadiantOoze.png b/Items/Accessories/RadiantOoze.png new file mode 100644 index 0000000000..0ad7a72642 Binary files /dev/null and b/Items/Accessories/RadiantOoze.png differ diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs new file mode 100644 index 0000000000..e00657fcae --- /dev/null +++ b/Items/Accessories/RaidersTalisman.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RaidersTalisman.png b/Items/Accessories/RaidersTalisman.png new file mode 100644 index 0000000000..f861ee325f Binary files /dev/null and b/Items/Accessories/RaidersTalisman.png differ diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs new file mode 100644 index 0000000000..b0906886ca --- /dev/null +++ b/Items/Accessories/RampartofDeities.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RampartofDeities.png b/Items/Accessories/RampartofDeities.png new file mode 100644 index 0000000000..115623e6c8 Binary files /dev/null and b/Items/Accessories/RampartofDeities.png differ diff --git a/Items/Accessories/Revenge.cs b/Items/Accessories/Revenge.cs new file mode 100644 index 0000000000..a1d16b8c09 --- /dev/null +++ b/Items/Accessories/Revenge.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/Revenge.png b/Items/Accessories/Revenge.png new file mode 100644 index 0000000000..ea7bd87649 Binary files /dev/null and b/Items/Accessories/Revenge.png differ diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs new file mode 100644 index 0000000000..e6dd2d9573 --- /dev/null +++ b/Items/Accessories/SeaShell.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/SeaShell.png b/Items/Accessories/SeaShell.png new file mode 100644 index 0000000000..21fa8d2113 Binary files /dev/null and b/Items/Accessories/SeaShell.png differ diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs new file mode 100644 index 0000000000..0202ab28df --- /dev/null +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ShieldoftheOcean.png b/Items/Accessories/ShieldoftheOcean.png new file mode 100644 index 0000000000..980b833da7 Binary files /dev/null and b/Items/Accessories/ShieldoftheOcean.png differ diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs new file mode 100644 index 0000000000..dfc8cc746c --- /dev/null +++ b/Items/Accessories/SigilofCalamitas.cs @@ -0,0 +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 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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/SigilofCalamitas.png b/Items/Accessories/SigilofCalamitas.png new file mode 100644 index 0000000000..ae5c26b6bc Binary files /dev/null and b/Items/Accessories/SigilofCalamitas.png differ diff --git a/Items/Accessories/SkylineWings.cs b/Items/Accessories/SkylineWings.cs new file mode 100644 index 0000000000..d2d3adf99f --- /dev/null +++ b/Items/Accessories/SkylineWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/SkylineWings.png b/Items/Accessories/SkylineWings.png new file mode 100644 index 0000000000..e9afcbf6ef Binary files /dev/null and b/Items/Accessories/SkylineWings.png differ diff --git a/Items/Accessories/SkylineWings_Wings.png b/Items/Accessories/SkylineWings_Wings.png new file mode 100644 index 0000000000..8e4eee696b Binary files /dev/null and b/Items/Accessories/SkylineWings_Wings.png differ diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs new file mode 100644 index 0000000000..2d23462b34 --- /dev/null +++ b/Items/Accessories/SpiritGenerator.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SpiritGenerator.png b/Items/Accessories/SpiritGenerator.png new file mode 100644 index 0000000000..90b067dea0 Binary files /dev/null and b/Items/Accessories/SpiritGenerator.png differ diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs new file mode 100644 index 0000000000..f573fca8fa --- /dev/null +++ b/Items/Accessories/Sponge.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/Sponge.png b/Items/Accessories/Sponge.png new file mode 100644 index 0000000000..2ecec415ca Binary files /dev/null and b/Items/Accessories/Sponge.png differ diff --git a/Items/Accessories/StarlightWings.cs b/Items/Accessories/StarlightWings.cs new file mode 100644 index 0000000000..95ece47e4c --- /dev/null +++ b/Items/Accessories/StarlightWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/StarlightWings.png b/Items/Accessories/StarlightWings.png new file mode 100644 index 0000000000..cb65852d84 Binary files /dev/null and b/Items/Accessories/StarlightWings.png differ diff --git a/Items/Accessories/StarlightWings_Wings.png b/Items/Accessories/StarlightWings_Wings.png new file mode 100644 index 0000000000..89efffeb43 Binary files /dev/null and b/Items/Accessories/StarlightWings_Wings.png differ diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs new file mode 100644 index 0000000000..d74be4857b --- /dev/null +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/StatisBeltOfCurses.png b/Items/Accessories/StatisBeltOfCurses.png new file mode 100644 index 0000000000..1ff2d2136b Binary files /dev/null and b/Items/Accessories/StatisBeltOfCurses.png differ diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs new file mode 100644 index 0000000000..5ebc265c2c --- /dev/null +++ b/Items/Accessories/StatisBlessing.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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/StatisBlessing.png b/Items/Accessories/StatisBlessing.png new file mode 100644 index 0000000000..8aa689ce9c Binary files /dev/null and b/Items/Accessories/StatisBlessing.png differ diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs new file mode 100644 index 0000000000..9f5e495e9d --- /dev/null +++ b/Items/Accessories/StatisCurse.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/StatisCurse.png b/Items/Accessories/StatisCurse.png new file mode 100644 index 0000000000..7efa25c120 Binary files /dev/null and b/Items/Accessories/StatisCurse.png differ diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs new file mode 100644 index 0000000000..134c4c859f --- /dev/null +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/StatisNinjaBelt.png b/Items/Accessories/StatisNinjaBelt.png new file mode 100644 index 0000000000..93759296e4 Binary files /dev/null and b/Items/Accessories/StatisNinjaBelt.png differ diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs new file mode 100644 index 0000000000..f2140ffb61 --- /dev/null +++ b/Items/Accessories/StressPills.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/StressPills.png b/Items/Accessories/StressPills.png new file mode 100644 index 0000000000..b22a404a3c Binary files /dev/null and b/Items/Accessories/StressPills.png differ diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs new file mode 100644 index 0000000000..22b2a3525d --- /dev/null +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.png b/Items/Accessories/SupremeBaitTackleBoxFishingStation.png new file mode 100644 index 0000000000..a4a5e8deb1 Binary files /dev/null and b/Items/Accessories/SupremeBaitTackleBoxFishingStation.png differ diff --git a/Items/Accessories/TarragonWings.cs b/Items/Accessories/TarragonWings.cs new file mode 100644 index 0000000000..26bc524fd8 --- /dev/null +++ b/Items/Accessories/TarragonWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/TarragonWings.png b/Items/Accessories/TarragonWings.png new file mode 100644 index 0000000000..ab0253fdc7 Binary files /dev/null and b/Items/Accessories/TarragonWings.png differ diff --git a/Items/Accessories/TarragonWings_Wings.png b/Items/Accessories/TarragonWings_Wings.png new file mode 100644 index 0000000000..2241190fb1 Binary files /dev/null and b/Items/Accessories/TarragonWings_Wings.png differ diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs new file mode 100644 index 0000000000..ed3b1217cc --- /dev/null +++ b/Items/Accessories/TheAbsorber.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/TheAbsorber.png b/Items/Accessories/TheAbsorber.png new file mode 100644 index 0000000000..0fdf79b36c Binary files /dev/null and b/Items/Accessories/TheAbsorber.png differ diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs new file mode 100644 index 0000000000..5611c7b8bb --- /dev/null +++ b/Items/Accessories/TheAmalgam.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/TheAmalgam.png b/Items/Accessories/TheAmalgam.png new file mode 100644 index 0000000000..377c99bb59 Binary files /dev/null and b/Items/Accessories/TheAmalgam.png differ diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs new file mode 100644 index 0000000000..f6d9402cac --- /dev/null +++ b/Items/Accessories/TheCommunity.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Accessories/TheCommunity.png b/Items/Accessories/TheCommunity.png new file mode 100644 index 0000000000..b1f4fb0230 Binary files /dev/null and b/Items/Accessories/TheCommunity.png differ diff --git a/Items/Accessories/TheDeadlyMicrobe.png b/Items/Accessories/TheDeadlyMicrobe.png new file mode 100644 index 0000000000..13f9a9b669 Binary files /dev/null and b/Items/Accessories/TheDeadlyMicrobe.png differ diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs new file mode 100644 index 0000000000..b31f166bda --- /dev/null +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Accessories/TheFirstShadowflame.png b/Items/Accessories/TheFirstShadowflame.png new file mode 100644 index 0000000000..e01bdba740 Binary files /dev/null and b/Items/Accessories/TheFirstShadowflame.png differ diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs new file mode 100644 index 0000000000..a5b8a404c3 --- /dev/null +++ b/Items/Accessories/VitalJelly.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories +{ + 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/VitalJelly.png b/Items/Accessories/VitalJelly.png new file mode 100644 index 0000000000..0bdd413329 Binary files /dev/null and b/Items/Accessories/VitalJelly.png differ diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs new file mode 100644 index 0000000000..c7600e602b --- /dev/null +++ b/Items/Accessories/VoidofExtinction.cs @@ -0,0 +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; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/VoidofExtinction.png b/Items/Accessories/VoidofExtinction.png new file mode 100644 index 0000000000..10be0e7b83 Binary files /dev/null and b/Items/Accessories/VoidofExtinction.png differ diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs new file mode 100644 index 0000000000..bb33b30b02 --- /dev/null +++ b/Items/Accessories/WifeinaBottle.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/WifeinaBottle.png b/Items/Accessories/WifeinaBottle.png new file mode 100644 index 0000000000..bc29babf45 Binary files /dev/null and b/Items/Accessories/WifeinaBottle.png differ diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs new file mode 100644 index 0000000000..956691840f --- /dev/null +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/WifeinaBottlewithBoobs.png b/Items/Accessories/WifeinaBottlewithBoobs.png new file mode 100644 index 0000000000..e82ffdfbb2 Binary files /dev/null and b/Items/Accessories/WifeinaBottlewithBoobs.png differ diff --git a/Items/Accessories/XerocWings.cs b/Items/Accessories/XerocWings.cs new file mode 100644 index 0000000000..9a5ff580ce --- /dev/null +++ b/Items/Accessories/XerocWings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/XerocWings.png b/Items/Accessories/XerocWings.png new file mode 100644 index 0000000000..7e14b06cf9 Binary files /dev/null and b/Items/Accessories/XerocWings.png differ diff --git a/Items/Accessories/XerocWings_Wings.png b/Items/Accessories/XerocWings_Wings.png new file mode 100644 index 0000000000..62064efbca Binary files /dev/null and b/Items/Accessories/XerocWings_Wings.png differ diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs new file mode 100644 index 0000000000..4bc07625a2 --- /dev/null +++ b/Items/Accessories/YharimsInsignia.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Accessories/YharimsInsignia.png b/Items/Accessories/YharimsInsignia.png new file mode 100644 index 0000000000..3eefb92c96 Binary files /dev/null and b/Items/Accessories/YharimsInsignia.png differ diff --git a/Items/AerialHamaxe.cs b/Items/AerialHamaxe.cs new file mode 100644 index 0000000000..aeae907bf8 --- /dev/null +++ b/Items/AerialHamaxe.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/AerialHamaxe.png b/Items/AerialHamaxe.png new file mode 100644 index 0000000000..a191bfdd05 Binary files /dev/null and b/Items/AerialHamaxe.png differ diff --git a/Items/AerialiteBar.cs b/Items/AerialiteBar.cs new file mode 100644 index 0000000000..52e34c11b2 --- /dev/null +++ b/Items/AerialiteBar.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/AerialiteBar.png b/Items/AerialiteBar.png new file mode 100644 index 0000000000..0fc1daff42 Binary files /dev/null and b/Items/AerialiteBar.png differ diff --git a/Items/AncientBoneDust.cs b/Items/AncientBoneDust.cs new file mode 100644 index 0000000000..3421257f37 --- /dev/null +++ b/Items/AncientBoneDust.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/AncientBoneDust.png b/Items/AncientBoneDust.png new file mode 100644 index 0000000000..bfc4a93b0a Binary files /dev/null and b/Items/AncientBoneDust.png differ diff --git a/Items/AnechoicCoating.cs b/Items/AnechoicCoating.cs new file mode 100644 index 0000000000..c10c1fb6a6 --- /dev/null +++ b/Items/AnechoicCoating.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AnechoicCoating.png b/Items/AnechoicCoating.png new file mode 100644 index 0000000000..e243b145ff Binary files /dev/null and b/Items/AnechoicCoating.png differ diff --git a/Items/AquaticScourge/AquaticEmblem.cs b/Items/AquaticScourge/AquaticEmblem.cs new file mode 100644 index 0000000000..15bb75af12 --- /dev/null +++ b/Items/AquaticScourge/AquaticEmblem.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AquaticEmblem.png b/Items/AquaticScourge/AquaticEmblem.png new file mode 100644 index 0000000000..87efac762f Binary files /dev/null and b/Items/AquaticScourge/AquaticEmblem.png differ diff --git a/Items/AquaticScourge/AquaticScourgeBag.cs b/Items/AquaticScourge/AquaticScourgeBag.cs new file mode 100644 index 0000000000..2fa2d80bc7 --- /dev/null +++ b/Items/AquaticScourge/AquaticScourgeBag.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Items/AquaticScourge/AquaticScourgeBag.png b/Items/AquaticScourge/AquaticScourgeBag.png new file mode 100644 index 0000000000..a13c2514a9 Binary files /dev/null and b/Items/AquaticScourge/AquaticScourgeBag.png differ diff --git a/Items/AquaticScourge/BleachedPowder.png b/Items/AquaticScourge/BleachedPowder.png new file mode 100644 index 0000000000..46d1bb49eb Binary files /dev/null and b/Items/AquaticScourge/BleachedPowder.png differ diff --git a/Items/AquaticScourge/Seafood.cs b/Items/AquaticScourge/Seafood.cs new file mode 100644 index 0000000000..45d7b62b54 --- /dev/null +++ b/Items/AquaticScourge/Seafood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AquaticScourge/Seafood.png b/Items/AquaticScourge/Seafood.png new file mode 100644 index 0000000000..d8b63605d4 Binary files /dev/null and b/Items/AquaticScourge/Seafood.png differ diff --git a/Items/AquaticScourge/SulphuricPowder.png b/Items/AquaticScourge/SulphuricPowder.png new file mode 100644 index 0000000000..a8241aba56 Binary files /dev/null and b/Items/AquaticScourge/SulphuricPowder.png differ diff --git a/Items/AridArtifact.cs b/Items/AridArtifact.cs new file mode 100644 index 0000000000..56ce9cbb7c --- /dev/null +++ b/Items/AridArtifact.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AridArtifact.png b/Items/AridArtifact.png new file mode 100644 index 0000000000..ebb9253a69 Binary files /dev/null and b/Items/AridArtifact.png differ diff --git a/Items/Armageddon.cs b/Items/Armageddon.cs new file mode 100644 index 0000000000..549cccdebb --- /dev/null +++ b/Items/Armageddon.cs @@ -0,0 +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 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; + string key = "Mods.CalamityMod.ArmageddonText"; + 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); + } + } + else + { + CalamityWorld.armageddon = false; + string key = "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/Armageddon.png b/Items/Armageddon.png new file mode 100644 index 0000000000..fb6b5e3810 Binary files /dev/null and b/Items/Armageddon.png differ diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs new file mode 100644 index 0000000000..f351a62882 --- /dev/null +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Armor/AbyssalDivingSuit.png b/Items/Armor/AbyssalDivingSuit.png new file mode 100644 index 0000000000..2a59ff2b3e Binary files /dev/null and b/Items/Armor/AbyssalDivingSuit.png differ diff --git a/Items/Armor/AbyssalDivingSuit_Arms.png b/Items/Armor/AbyssalDivingSuit_Arms.png new file mode 100644 index 0000000000..917426661f Binary files /dev/null and b/Items/Armor/AbyssalDivingSuit_Arms.png differ diff --git a/Items/Armor/AbyssalDivingSuit_Body.png b/Items/Armor/AbyssalDivingSuit_Body.png new file mode 100644 index 0000000000..55d3b2a786 Binary files /dev/null and b/Items/Armor/AbyssalDivingSuit_Body.png differ diff --git a/Items/Armor/AbyssalDivingSuit_Head.png b/Items/Armor/AbyssalDivingSuit_Head.png new file mode 100644 index 0000000000..0318c9c127 Binary files /dev/null and b/Items/Armor/AbyssalDivingSuit_Head.png differ diff --git a/Items/Armor/AbyssalDivingSuit_Legs.png b/Items/Armor/AbyssalDivingSuit_Legs.png new file mode 100644 index 0000000000..6bc7fde9b5 Binary files /dev/null and b/Items/Armor/AbyssalDivingSuit_Legs.png differ diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs new file mode 100644 index 0000000000..ad60e5ccbb --- /dev/null +++ b/Items/Armor/AerospecBreastplate.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/AerospecBreastplate.png b/Items/Armor/AerospecBreastplate.png new file mode 100644 index 0000000000..633df0b377 Binary files /dev/null and b/Items/Armor/AerospecBreastplate.png differ diff --git a/Items/Armor/AerospecBreastplate_Arms.png b/Items/Armor/AerospecBreastplate_Arms.png new file mode 100644 index 0000000000..58fb868eab Binary files /dev/null and b/Items/Armor/AerospecBreastplate_Arms.png differ diff --git a/Items/Armor/AerospecBreastplate_Body.png b/Items/Armor/AerospecBreastplate_Body.png new file mode 100644 index 0000000000..0f1eb71595 Binary files /dev/null and b/Items/Armor/AerospecBreastplate_Body.png differ diff --git a/Items/Armor/AerospecBreastplate_FemaleBody.png b/Items/Armor/AerospecBreastplate_FemaleBody.png new file mode 100644 index 0000000000..490f54dfd8 Binary files /dev/null and b/Items/Armor/AerospecBreastplate_FemaleBody.png differ diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs new file mode 100644 index 0000000000..5fc6122785 --- /dev/null +++ b/Items/Armor/AerospecHat.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AerospecHat.png b/Items/Armor/AerospecHat.png new file mode 100644 index 0000000000..857a092fde Binary files /dev/null and b/Items/Armor/AerospecHat.png differ diff --git a/Items/Armor/AerospecHat_Head.png b/Items/Armor/AerospecHat_Head.png new file mode 100644 index 0000000000..ce553aa7a2 Binary files /dev/null and b/Items/Armor/AerospecHat_Head.png differ diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs new file mode 100644 index 0000000000..762ea65de3 --- /dev/null +++ b/Items/Armor/AerospecHeadgear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AerospecHeadgear.png b/Items/Armor/AerospecHeadgear.png new file mode 100644 index 0000000000..f15585afa8 Binary files /dev/null and b/Items/Armor/AerospecHeadgear.png differ diff --git a/Items/Armor/AerospecHeadgear_Head.png b/Items/Armor/AerospecHeadgear_Head.png new file mode 100644 index 0000000000..2cca11d903 Binary files /dev/null and b/Items/Armor/AerospecHeadgear_Head.png differ diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs new file mode 100644 index 0000000000..36b0b26b81 --- /dev/null +++ b/Items/Armor/AerospecHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AerospecHelm.png b/Items/Armor/AerospecHelm.png new file mode 100644 index 0000000000..bcb0738d7c Binary files /dev/null and b/Items/Armor/AerospecHelm.png differ diff --git a/Items/Armor/AerospecHelm_Head.png b/Items/Armor/AerospecHelm_Head.png new file mode 100644 index 0000000000..e1bb65fb33 Binary files /dev/null and b/Items/Armor/AerospecHelm_Head.png differ diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs new file mode 100644 index 0000000000..7d6693b8ee --- /dev/null +++ b/Items/Armor/AerospecHelmet.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/AerospecHelmet.png b/Items/Armor/AerospecHelmet.png new file mode 100644 index 0000000000..e01b6b1d75 Binary files /dev/null and b/Items/Armor/AerospecHelmet.png differ diff --git a/Items/Armor/AerospecHelmet_Head.png b/Items/Armor/AerospecHelmet_Head.png new file mode 100644 index 0000000000..b563e43d9d Binary files /dev/null and b/Items/Armor/AerospecHelmet_Head.png differ diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs new file mode 100644 index 0000000000..e26571db1d --- /dev/null +++ b/Items/Armor/AerospecHood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AerospecHood.png b/Items/Armor/AerospecHood.png new file mode 100644 index 0000000000..d2635accf9 Binary files /dev/null and b/Items/Armor/AerospecHood.png differ diff --git a/Items/Armor/AerospecHood_Head.png b/Items/Armor/AerospecHood_Head.png new file mode 100644 index 0000000000..2043801414 Binary files /dev/null and b/Items/Armor/AerospecHood_Head.png differ diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs new file mode 100644 index 0000000000..57bdd0e8e2 --- /dev/null +++ b/Items/Armor/AerospecLeggings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AerospecLeggings.png b/Items/Armor/AerospecLeggings.png new file mode 100644 index 0000000000..66026642d5 Binary files /dev/null and b/Items/Armor/AerospecLeggings.png differ diff --git a/Items/Armor/AerospecLeggings_Legs.png b/Items/Armor/AerospecLeggings_Legs.png new file mode 100644 index 0000000000..8122cffc13 Binary files /dev/null and b/Items/Armor/AerospecLeggings_Legs.png differ diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs new file mode 100644 index 0000000000..ddbd1dad61 --- /dev/null +++ b/Items/Armor/AstralBreastplate.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/AstralBreastplate.png b/Items/Armor/AstralBreastplate.png new file mode 100644 index 0000000000..d992543bbe Binary files /dev/null and b/Items/Armor/AstralBreastplate.png differ diff --git a/Items/Armor/AstralBreastplate_Arms.png b/Items/Armor/AstralBreastplate_Arms.png new file mode 100644 index 0000000000..177d9f11e1 Binary files /dev/null and b/Items/Armor/AstralBreastplate_Arms.png differ diff --git a/Items/Armor/AstralBreastplate_Body.png b/Items/Armor/AstralBreastplate_Body.png new file mode 100644 index 0000000000..2d52f31cc6 Binary files /dev/null and b/Items/Armor/AstralBreastplate_Body.png differ diff --git a/Items/Armor/AstralBreastplate_FemaleBody.png b/Items/Armor/AstralBreastplate_FemaleBody.png new file mode 100644 index 0000000000..2d52f31cc6 Binary files /dev/null and b/Items/Armor/AstralBreastplate_FemaleBody.png differ diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs new file mode 100644 index 0000000000..327b8647bd --- /dev/null +++ b/Items/Armor/AstralHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AstralHelm.png b/Items/Armor/AstralHelm.png new file mode 100644 index 0000000000..1ec3d0b161 Binary files /dev/null and b/Items/Armor/AstralHelm.png differ diff --git a/Items/Armor/AstralHelm_Head.png b/Items/Armor/AstralHelm_Head.png new file mode 100644 index 0000000000..7a546381a7 Binary files /dev/null and b/Items/Armor/AstralHelm_Head.png differ diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs new file mode 100644 index 0000000000..b68f11c58e --- /dev/null +++ b/Items/Armor/AstralLeggings.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AstralLeggings.png b/Items/Armor/AstralLeggings.png new file mode 100644 index 0000000000..20d4975eb7 Binary files /dev/null and b/Items/Armor/AstralLeggings.png differ diff --git a/Items/Armor/AstralLeggings_Legs.png b/Items/Armor/AstralLeggings_Legs.png new file mode 100644 index 0000000000..0aa56c9372 Binary files /dev/null and b/Items/Armor/AstralLeggings_Legs.png differ diff --git a/Items/Armor/AstrumDeusMask.cs b/Items/Armor/AstrumDeusMask.cs new file mode 100644 index 0000000000..ec21437344 --- /dev/null +++ b/Items/Armor/AstrumDeusMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AstrumDeusMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/AstrumDeusMask.png b/Items/Armor/AstrumDeusMask.png new file mode 100644 index 0000000000..a934cb6f7f Binary files /dev/null and b/Items/Armor/AstrumDeusMask.png differ diff --git a/Items/Armor/AstrumDeusMask_Head.png b/Items/Armor/AstrumDeusMask_Head.png new file mode 100644 index 0000000000..515506ea30 Binary files /dev/null and b/Items/Armor/AstrumDeusMask_Head.png differ diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs new file mode 100644 index 0000000000..539ef8be25 --- /dev/null +++ b/Items/Armor/AtaxiaArmor.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AtaxiaArmor.png b/Items/Armor/AtaxiaArmor.png new file mode 100644 index 0000000000..aa3ba89f66 Binary files /dev/null and b/Items/Armor/AtaxiaArmor.png differ diff --git a/Items/Armor/AtaxiaArmor_Arms.png b/Items/Armor/AtaxiaArmor_Arms.png new file mode 100644 index 0000000000..bf88d84419 Binary files /dev/null and b/Items/Armor/AtaxiaArmor_Arms.png differ diff --git a/Items/Armor/AtaxiaArmor_Body.png b/Items/Armor/AtaxiaArmor_Body.png new file mode 100644 index 0000000000..3e1a44d881 Binary files /dev/null and b/Items/Armor/AtaxiaArmor_Body.png differ diff --git a/Items/Armor/AtaxiaArmor_FemaleBody.png b/Items/Armor/AtaxiaArmor_FemaleBody.png new file mode 100644 index 0000000000..95de403c1b Binary files /dev/null and b/Items/Armor/AtaxiaArmor_FemaleBody.png differ diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs new file mode 100644 index 0000000000..209584b4b7 --- /dev/null +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AtaxiaHeadgear.png b/Items/Armor/AtaxiaHeadgear.png new file mode 100644 index 0000000000..8ef0bc79b0 Binary files /dev/null and b/Items/Armor/AtaxiaHeadgear.png differ diff --git a/Items/Armor/AtaxiaHeadgear_Head.png b/Items/Armor/AtaxiaHeadgear_Head.png new file mode 100644 index 0000000000..571817dfba Binary files /dev/null and b/Items/Armor/AtaxiaHeadgear_Head.png differ diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs new file mode 100644 index 0000000000..c0e4f7001b --- /dev/null +++ b/Items/Armor/AtaxiaHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AtaxiaHelm.png b/Items/Armor/AtaxiaHelm.png new file mode 100644 index 0000000000..186a7141d4 Binary files /dev/null and b/Items/Armor/AtaxiaHelm.png differ diff --git a/Items/Armor/AtaxiaHelm_Head.png b/Items/Armor/AtaxiaHelm_Head.png new file mode 100644 index 0000000000..5bbdca533b Binary files /dev/null and b/Items/Armor/AtaxiaHelm_Head.png differ diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs new file mode 100644 index 0000000000..988de99d94 --- /dev/null +++ b/Items/Armor/AtaxiaHelmet.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +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/AtaxiaHelmet.png b/Items/Armor/AtaxiaHelmet.png new file mode 100644 index 0000000000..8a4ee96897 Binary files /dev/null and b/Items/Armor/AtaxiaHelmet.png differ diff --git a/Items/Armor/AtaxiaHelmet_Head.png b/Items/Armor/AtaxiaHelmet_Head.png new file mode 100644 index 0000000000..2a4f5ac16a Binary files /dev/null and b/Items/Armor/AtaxiaHelmet_Head.png differ diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs new file mode 100644 index 0000000000..8eaccbd9fa --- /dev/null +++ b/Items/Armor/AtaxiaHood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AtaxiaHood.png b/Items/Armor/AtaxiaHood.png new file mode 100644 index 0000000000..f458d6a408 Binary files /dev/null and b/Items/Armor/AtaxiaHood.png differ diff --git a/Items/Armor/AtaxiaHood_Head.png b/Items/Armor/AtaxiaHood_Head.png new file mode 100644 index 0000000000..025d50fe93 Binary files /dev/null and b/Items/Armor/AtaxiaHood_Head.png differ diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs new file mode 100644 index 0000000000..2c0d96caa6 --- /dev/null +++ b/Items/Armor/AtaxiaMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AtaxiaMask.png b/Items/Armor/AtaxiaMask.png new file mode 100644 index 0000000000..e19479f6ce Binary files /dev/null and b/Items/Armor/AtaxiaMask.png differ diff --git a/Items/Armor/AtaxiaMask_Head.png b/Items/Armor/AtaxiaMask_Head.png new file mode 100644 index 0000000000..af7fc7a2ab Binary files /dev/null and b/Items/Armor/AtaxiaMask_Head.png differ diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs new file mode 100644 index 0000000000..dc103aa76b --- /dev/null +++ b/Items/Armor/AtaxiaSubligar.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/AtaxiaSubligar.png b/Items/Armor/AtaxiaSubligar.png new file mode 100644 index 0000000000..f9127a0acd Binary files /dev/null and b/Items/Armor/AtaxiaSubligar.png differ diff --git a/Items/Armor/AtaxiaSubligar_Legs.png b/Items/Armor/AtaxiaSubligar_Legs.png new file mode 100644 index 0000000000..09e2907d2b Binary files /dev/null and b/Items/Armor/AtaxiaSubligar_Legs.png differ diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs new file mode 100644 index 0000000000..60424effc8 --- /dev/null +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/AuricTeslaBodyArmor.png b/Items/Armor/AuricTeslaBodyArmor.png new file mode 100644 index 0000000000..fd2dd31497 Binary files /dev/null and b/Items/Armor/AuricTeslaBodyArmor.png differ diff --git a/Items/Armor/AuricTeslaBodyArmor_Arms.png b/Items/Armor/AuricTeslaBodyArmor_Arms.png new file mode 100644 index 0000000000..188055eba1 Binary files /dev/null and b/Items/Armor/AuricTeslaBodyArmor_Arms.png differ diff --git a/Items/Armor/AuricTeslaBodyArmor_Body.png b/Items/Armor/AuricTeslaBodyArmor_Body.png new file mode 100644 index 0000000000..e7cba1b99f Binary files /dev/null and b/Items/Armor/AuricTeslaBodyArmor_Body.png differ diff --git a/Items/Armor/AuricTeslaBodyArmor_FemaleBody.png b/Items/Armor/AuricTeslaBodyArmor_FemaleBody.png new file mode 100644 index 0000000000..be9790e1c7 Binary files /dev/null and b/Items/Armor/AuricTeslaBodyArmor_FemaleBody.png differ diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs new file mode 100644 index 0000000000..018538f048 --- /dev/null +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaCuisses.png b/Items/Armor/AuricTeslaCuisses.png new file mode 100644 index 0000000000..738d955d62 Binary files /dev/null and b/Items/Armor/AuricTeslaCuisses.png differ diff --git a/Items/Armor/AuricTeslaCuisses_Legs.png b/Items/Armor/AuricTeslaCuisses_Legs.png new file mode 100644 index 0000000000..e5b0fb491a Binary files /dev/null and b/Items/Armor/AuricTeslaCuisses_Legs.png differ diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs new file mode 100644 index 0000000000..464d4a1635 --- /dev/null +++ b/Items/Armor/AuricTeslaHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaHelm.png b/Items/Armor/AuricTeslaHelm.png new file mode 100644 index 0000000000..7a56edf6a4 Binary files /dev/null and b/Items/Armor/AuricTeslaHelm.png differ diff --git a/Items/Armor/AuricTeslaHelm_Head.png b/Items/Armor/AuricTeslaHelm_Head.png new file mode 100644 index 0000000000..86a6dfa628 Binary files /dev/null and b/Items/Armor/AuricTeslaHelm_Head.png differ diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs new file mode 100644 index 0000000000..f70f43edb6 --- /dev/null +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaHoodedFacemask.png b/Items/Armor/AuricTeslaHoodedFacemask.png new file mode 100644 index 0000000000..72a04b28b0 Binary files /dev/null and b/Items/Armor/AuricTeslaHoodedFacemask.png differ diff --git a/Items/Armor/AuricTeslaHoodedFacemask_Head.png b/Items/Armor/AuricTeslaHoodedFacemask_Head.png new file mode 100644 index 0000000000..bab96cdc84 Binary files /dev/null and b/Items/Armor/AuricTeslaHoodedFacemask_Head.png differ diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs new file mode 100644 index 0000000000..d83d5b41a2 --- /dev/null +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaPlumedHelm.png b/Items/Armor/AuricTeslaPlumedHelm.png new file mode 100644 index 0000000000..18a3e9f957 Binary files /dev/null and b/Items/Armor/AuricTeslaPlumedHelm.png differ diff --git a/Items/Armor/AuricTeslaPlumedHelm_Head.png b/Items/Armor/AuricTeslaPlumedHelm_Head.png new file mode 100644 index 0000000000..58199c5e88 Binary files /dev/null and b/Items/Armor/AuricTeslaPlumedHelm_Head.png differ diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs new file mode 100644 index 0000000000..5ae53acf86 --- /dev/null +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaSpaceHelmet.png b/Items/Armor/AuricTeslaSpaceHelmet.png new file mode 100644 index 0000000000..2d732d7ae3 Binary files /dev/null and b/Items/Armor/AuricTeslaSpaceHelmet.png differ diff --git a/Items/Armor/AuricTeslaSpaceHelmet_Head.png b/Items/Armor/AuricTeslaSpaceHelmet_Head.png new file mode 100644 index 0000000000..b25223324e Binary files /dev/null and b/Items/Armor/AuricTeslaSpaceHelmet_Head.png differ diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs new file mode 100644 index 0000000000..3d6e7ae1e3 --- /dev/null +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.png b/Items/Armor/AuricTeslaWireHemmedVisage.png new file mode 100644 index 0000000000..be58652461 Binary files /dev/null and b/Items/Armor/AuricTeslaWireHemmedVisage.png differ diff --git a/Items/Armor/AuricTeslaWireHemmedVisage_Head.png b/Items/Armor/AuricTeslaWireHemmedVisage_Head.png new file mode 100644 index 0000000000..a11c03134d Binary files /dev/null and b/Items/Armor/AuricTeslaWireHemmedVisage_Head.png differ diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs new file mode 100644 index 0000000000..27ff793c4b --- /dev/null +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/BloodflareBodyArmor.png b/Items/Armor/BloodflareBodyArmor.png new file mode 100644 index 0000000000..ed3eecb4a9 Binary files /dev/null and b/Items/Armor/BloodflareBodyArmor.png differ diff --git a/Items/Armor/BloodflareBodyArmor_Arms.png b/Items/Armor/BloodflareBodyArmor_Arms.png new file mode 100644 index 0000000000..394250f244 Binary files /dev/null and b/Items/Armor/BloodflareBodyArmor_Arms.png differ diff --git a/Items/Armor/BloodflareBodyArmor_Body.png b/Items/Armor/BloodflareBodyArmor_Body.png new file mode 100644 index 0000000000..8100aab0b2 Binary files /dev/null and b/Items/Armor/BloodflareBodyArmor_Body.png differ diff --git a/Items/Armor/BloodflareBodyArmor_FemaleBody.png b/Items/Armor/BloodflareBodyArmor_FemaleBody.png new file mode 100644 index 0000000000..8100aab0b2 Binary files /dev/null and b/Items/Armor/BloodflareBodyArmor_FemaleBody.png differ diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs new file mode 100644 index 0000000000..4535d7a3d3 --- /dev/null +++ b/Items/Armor/BloodflareCuisses.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/BloodflareCuisses.png b/Items/Armor/BloodflareCuisses.png new file mode 100644 index 0000000000..3198ee3a40 Binary files /dev/null and b/Items/Armor/BloodflareCuisses.png differ diff --git a/Items/Armor/BloodflareCuisses_Legs.png b/Items/Armor/BloodflareCuisses_Legs.png new file mode 100644 index 0000000000..bf5f44dc2e Binary files /dev/null and b/Items/Armor/BloodflareCuisses_Legs.png differ diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs new file mode 100644 index 0000000000..55370ceb83 --- /dev/null +++ b/Items/Armor/BloodflareHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/BloodflareHelm.png b/Items/Armor/BloodflareHelm.png new file mode 100644 index 0000000000..c6f2d9c5c1 Binary files /dev/null and b/Items/Armor/BloodflareHelm.png differ diff --git a/Items/Armor/BloodflareHelm_Head.png b/Items/Armor/BloodflareHelm_Head.png new file mode 100644 index 0000000000..57ffde4c45 Binary files /dev/null and b/Items/Armor/BloodflareHelm_Head.png differ diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs new file mode 100644 index 0000000000..d257c1fcf0 --- /dev/null +++ b/Items/Armor/BloodflareHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/BloodflareHelmet.png b/Items/Armor/BloodflareHelmet.png new file mode 100644 index 0000000000..25f57b47e6 Binary files /dev/null and b/Items/Armor/BloodflareHelmet.png differ diff --git a/Items/Armor/BloodflareHelmet_Head.png b/Items/Armor/BloodflareHelmet_Head.png new file mode 100644 index 0000000000..8bfbc17752 Binary files /dev/null and b/Items/Armor/BloodflareHelmet_Head.png differ diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs new file mode 100644 index 0000000000..42f111267f --- /dev/null +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/BloodflareHornedHelm.png b/Items/Armor/BloodflareHornedHelm.png new file mode 100644 index 0000000000..76774a6cff Binary files /dev/null and b/Items/Armor/BloodflareHornedHelm.png differ diff --git a/Items/Armor/BloodflareHornedHelm_Head.png b/Items/Armor/BloodflareHornedHelm_Head.png new file mode 100644 index 0000000000..3089bfae55 Binary files /dev/null and b/Items/Armor/BloodflareHornedHelm_Head.png differ diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs new file mode 100644 index 0000000000..a79149f062 --- /dev/null +++ b/Items/Armor/BloodflareHornedMask.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/BloodflareHornedMask.png b/Items/Armor/BloodflareHornedMask.png new file mode 100644 index 0000000000..071612ee3c Binary files /dev/null and b/Items/Armor/BloodflareHornedMask.png differ diff --git a/Items/Armor/BloodflareHornedMask_Head.png b/Items/Armor/BloodflareHornedMask_Head.png new file mode 100644 index 0000000000..adafe0d349 Binary files /dev/null and b/Items/Armor/BloodflareHornedMask_Head.png differ diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs new file mode 100644 index 0000000000..535c1d8cea --- /dev/null +++ b/Items/Armor/BloodflareMask.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +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/BloodflareMask.png b/Items/Armor/BloodflareMask.png new file mode 100644 index 0000000000..edd697c92d Binary files /dev/null and b/Items/Armor/BloodflareMask.png differ diff --git a/Items/Armor/BloodflareMask_Head.png b/Items/Armor/BloodflareMask_Head.png new file mode 100644 index 0000000000..5f127679a3 Binary files /dev/null and b/Items/Armor/BloodflareMask_Head.png differ diff --git a/Items/Armor/CalamitasMask.cs b/Items/Armor/CalamitasMask.cs new file mode 100644 index 0000000000..2f41170c44 --- /dev/null +++ b/Items/Armor/CalamitasMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CalamitasMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/CalamitasMask.png b/Items/Armor/CalamitasMask.png new file mode 100644 index 0000000000..c25a15bca1 Binary files /dev/null and b/Items/Armor/CalamitasMask.png differ diff --git a/Items/Armor/CalamitasMask_Head.png b/Items/Armor/CalamitasMask_Head.png new file mode 100644 index 0000000000..d2a71f543b Binary files /dev/null and b/Items/Armor/CalamitasMask_Head.png differ diff --git a/Items/Armor/CrabulonMask.cs b/Items/Armor/CrabulonMask.cs new file mode 100644 index 0000000000..bd509ccc53 --- /dev/null +++ b/Items/Armor/CrabulonMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CrabulonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/CrabulonMask.png b/Items/Armor/CrabulonMask.png new file mode 100644 index 0000000000..b56fde0a76 Binary files /dev/null and b/Items/Armor/CrabulonMask.png differ diff --git a/Items/Armor/CrabulonMask_Head.png b/Items/Armor/CrabulonMask_Head.png new file mode 100644 index 0000000000..b43adf55d3 Binary files /dev/null and b/Items/Armor/CrabulonMask_Head.png differ diff --git a/Items/Armor/CryogenMask.cs b/Items/Armor/CryogenMask.cs new file mode 100644 index 0000000000..bc215e1237 --- /dev/null +++ b/Items/Armor/CryogenMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CryogenMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/CryogenMask.png b/Items/Armor/CryogenMask.png new file mode 100644 index 0000000000..34a74d6572 Binary files /dev/null and b/Items/Armor/CryogenMask.png differ diff --git a/Items/Armor/CryogenMask_Head.png b/Items/Armor/CryogenMask_Head.png new file mode 100644 index 0000000000..797cf0a72c Binary files /dev/null and b/Items/Armor/CryogenMask_Head.png differ diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs new file mode 100644 index 0000000000..5904dab9a2 --- /dev/null +++ b/Items/Armor/DaedalusBreastplate.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/DaedalusBreastplate.png b/Items/Armor/DaedalusBreastplate.png new file mode 100644 index 0000000000..022b7214cb Binary files /dev/null and b/Items/Armor/DaedalusBreastplate.png differ diff --git a/Items/Armor/DaedalusBreastplate_Arms.png b/Items/Armor/DaedalusBreastplate_Arms.png new file mode 100644 index 0000000000..79fed3fa4b Binary files /dev/null and b/Items/Armor/DaedalusBreastplate_Arms.png differ diff --git a/Items/Armor/DaedalusBreastplate_Body.png b/Items/Armor/DaedalusBreastplate_Body.png new file mode 100644 index 0000000000..67ba7a041c Binary files /dev/null and b/Items/Armor/DaedalusBreastplate_Body.png differ diff --git a/Items/Armor/DaedalusBreastplate_FemaleBody.png b/Items/Armor/DaedalusBreastplate_FemaleBody.png new file mode 100644 index 0000000000..67ba7a041c Binary files /dev/null and b/Items/Armor/DaedalusBreastplate_FemaleBody.png differ diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs new file mode 100644 index 0000000000..1add94317b --- /dev/null +++ b/Items/Armor/DaedalusHat.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DaedalusHat.png b/Items/Armor/DaedalusHat.png new file mode 100644 index 0000000000..ff4a843fa5 Binary files /dev/null and b/Items/Armor/DaedalusHat.png differ diff --git a/Items/Armor/DaedalusHat_Head.png b/Items/Armor/DaedalusHat_Head.png new file mode 100644 index 0000000000..c9abf9872e Binary files /dev/null and b/Items/Armor/DaedalusHat_Head.png differ diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs new file mode 100644 index 0000000000..2fad49b7c8 --- /dev/null +++ b/Items/Armor/DaedalusHeadgear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DaedalusHeadgear.png b/Items/Armor/DaedalusHeadgear.png new file mode 100644 index 0000000000..8aa44f5809 Binary files /dev/null and b/Items/Armor/DaedalusHeadgear.png differ diff --git a/Items/Armor/DaedalusHeadgear_Head.png b/Items/Armor/DaedalusHeadgear_Head.png new file mode 100644 index 0000000000..ffe116773d Binary files /dev/null and b/Items/Armor/DaedalusHeadgear_Head.png differ diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs new file mode 100644 index 0000000000..b46418b05a --- /dev/null +++ b/Items/Armor/DaedalusHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DaedalusHelm.png b/Items/Armor/DaedalusHelm.png new file mode 100644 index 0000000000..c235f9fca7 Binary files /dev/null and b/Items/Armor/DaedalusHelm.png differ diff --git a/Items/Armor/DaedalusHelm_Head.png b/Items/Armor/DaedalusHelm_Head.png new file mode 100644 index 0000000000..59ae320ef5 Binary files /dev/null and b/Items/Armor/DaedalusHelm_Head.png differ diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs new file mode 100644 index 0000000000..3691a6000e --- /dev/null +++ b/Items/Armor/DaedalusHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DaedalusHelmet.png b/Items/Armor/DaedalusHelmet.png new file mode 100644 index 0000000000..46270799b2 Binary files /dev/null and b/Items/Armor/DaedalusHelmet.png differ diff --git a/Items/Armor/DaedalusHelmet_Head.png b/Items/Armor/DaedalusHelmet_Head.png new file mode 100644 index 0000000000..24e033643e Binary files /dev/null and b/Items/Armor/DaedalusHelmet_Head.png differ diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs new file mode 100644 index 0000000000..fdba5bb9f0 --- /dev/null +++ b/Items/Armor/DaedalusLeggings.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/DaedalusLeggings.png b/Items/Armor/DaedalusLeggings.png new file mode 100644 index 0000000000..673577869d Binary files /dev/null and b/Items/Armor/DaedalusLeggings.png differ diff --git a/Items/Armor/DaedalusLeggings_Legs.png b/Items/Armor/DaedalusLeggings_Legs.png new file mode 100644 index 0000000000..10c1832cad Binary files /dev/null and b/Items/Armor/DaedalusLeggings_Legs.png differ diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs new file mode 100644 index 0000000000..6d3f51b36e --- /dev/null +++ b/Items/Armor/DaedalusVisor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DaedalusVisor.png b/Items/Armor/DaedalusVisor.png new file mode 100644 index 0000000000..0df26558fb Binary files /dev/null and b/Items/Armor/DaedalusVisor.png differ diff --git a/Items/Armor/DaedalusVisor_Head.png b/Items/Armor/DaedalusVisor_Head.png new file mode 100644 index 0000000000..7053f4ce2c Binary files /dev/null and b/Items/Armor/DaedalusVisor_Head.png differ diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs new file mode 100644 index 0000000000..cccef92fed --- /dev/null +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DemonshadeBreastplate.png b/Items/Armor/DemonshadeBreastplate.png new file mode 100644 index 0000000000..25373fd9c9 Binary files /dev/null and b/Items/Armor/DemonshadeBreastplate.png differ diff --git a/Items/Armor/DemonshadeBreastplate_Arms.png b/Items/Armor/DemonshadeBreastplate_Arms.png new file mode 100644 index 0000000000..66769462ee Binary files /dev/null and b/Items/Armor/DemonshadeBreastplate_Arms.png differ diff --git a/Items/Armor/DemonshadeBreastplate_Body.png b/Items/Armor/DemonshadeBreastplate_Body.png new file mode 100644 index 0000000000..a4b030a1d6 Binary files /dev/null and b/Items/Armor/DemonshadeBreastplate_Body.png differ diff --git a/Items/Armor/DemonshadeBreastplate_FemaleBody.png b/Items/Armor/DemonshadeBreastplate_FemaleBody.png new file mode 100644 index 0000000000..ffa601b60f Binary files /dev/null and b/Items/Armor/DemonshadeBreastplate_FemaleBody.png differ diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs new file mode 100644 index 0000000000..6bf8630838 --- /dev/null +++ b/Items/Armor/DemonshadeGreaves.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DemonshadeGreaves.png b/Items/Armor/DemonshadeGreaves.png new file mode 100644 index 0000000000..6a6b653118 Binary files /dev/null and b/Items/Armor/DemonshadeGreaves.png differ diff --git a/Items/Armor/DemonshadeGreaves_Legs.png b/Items/Armor/DemonshadeGreaves_Legs.png new file mode 100644 index 0000000000..99a8862f64 Binary files /dev/null and b/Items/Armor/DemonshadeGreaves_Legs.png differ diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs new file mode 100644 index 0000000000..7b646f13b7 --- /dev/null +++ b/Items/Armor/DemonshadeHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/DemonshadeHelm.png b/Items/Armor/DemonshadeHelm.png new file mode 100644 index 0000000000..35f36b200b Binary files /dev/null and b/Items/Armor/DemonshadeHelm.png differ diff --git a/Items/Armor/DemonshadeHelm_Head.png b/Items/Armor/DemonshadeHelm_Head.png new file mode 100644 index 0000000000..dacfe2129f Binary files /dev/null and b/Items/Armor/DemonshadeHelm_Head.png differ diff --git a/Items/Armor/DesertScourgeMask.cs b/Items/Armor/DesertScourgeMask.cs new file mode 100644 index 0000000000..2a98f15446 --- /dev/null +++ b/Items/Armor/DesertScourgeMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DesertScourgeMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/DesertScourgeMask.png b/Items/Armor/DesertScourgeMask.png new file mode 100644 index 0000000000..5073e234f6 Binary files /dev/null and b/Items/Armor/DesertScourgeMask.png differ diff --git a/Items/Armor/DesertScourgeMask_Head.png b/Items/Armor/DesertScourgeMask_Head.png new file mode 100644 index 0000000000..f3b8e9cf1b Binary files /dev/null and b/Items/Armor/DesertScourgeMask_Head.png differ diff --git a/Items/Armor/DevourerofGodsMask.cs b/Items/Armor/DevourerofGodsMask.cs new file mode 100644 index 0000000000..54966f91a3 --- /dev/null +++ b/Items/Armor/DevourerofGodsMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DevourerofGodsMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Gods Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/DevourerofGodsMask.png b/Items/Armor/DevourerofGodsMask.png new file mode 100644 index 0000000000..d4ffe99b9e Binary files /dev/null and b/Items/Armor/DevourerofGodsMask.png differ diff --git a/Items/Armor/DevourerofGodsMask_Head.png b/Items/Armor/DevourerofGodsMask_Head.png new file mode 100644 index 0000000000..3f6d066edd Binary files /dev/null and b/Items/Armor/DevourerofGodsMask_Head.png differ diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs new file mode 100644 index 0000000000..36a71b0bde --- /dev/null +++ b/Items/Armor/GodSlayerChestplate.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerChestplate.png b/Items/Armor/GodSlayerChestplate.png new file mode 100644 index 0000000000..d619660b8d Binary files /dev/null and b/Items/Armor/GodSlayerChestplate.png differ diff --git a/Items/Armor/GodSlayerChestplate_Arms.png b/Items/Armor/GodSlayerChestplate_Arms.png new file mode 100644 index 0000000000..e23b3c2f64 Binary files /dev/null and b/Items/Armor/GodSlayerChestplate_Arms.png differ diff --git a/Items/Armor/GodSlayerChestplate_Body.png b/Items/Armor/GodSlayerChestplate_Body.png new file mode 100644 index 0000000000..1c6fa41d7f Binary files /dev/null and b/Items/Armor/GodSlayerChestplate_Body.png differ diff --git a/Items/Armor/GodSlayerChestplate_FemaleBody.png b/Items/Armor/GodSlayerChestplate_FemaleBody.png new file mode 100644 index 0000000000..6760d1eedf Binary files /dev/null and b/Items/Armor/GodSlayerChestplate_FemaleBody.png differ diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs new file mode 100644 index 0000000000..5908918303 --- /dev/null +++ b/Items/Armor/GodSlayerHelm.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerHelm.png b/Items/Armor/GodSlayerHelm.png new file mode 100644 index 0000000000..b5e5efe216 Binary files /dev/null and b/Items/Armor/GodSlayerHelm.png differ diff --git a/Items/Armor/GodSlayerHelm_Head.png b/Items/Armor/GodSlayerHelm_Head.png new file mode 100644 index 0000000000..ef1a029506 Binary files /dev/null and b/Items/Armor/GodSlayerHelm_Head.png differ diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs new file mode 100644 index 0000000000..5296c62521 --- /dev/null +++ b/Items/Armor/GodSlayerHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerHelmet.png b/Items/Armor/GodSlayerHelmet.png new file mode 100644 index 0000000000..e42a92cbfd Binary files /dev/null and b/Items/Armor/GodSlayerHelmet.png differ diff --git a/Items/Armor/GodSlayerHelmet_Head.png b/Items/Armor/GodSlayerHelmet_Head.png new file mode 100644 index 0000000000..55b53914b5 Binary files /dev/null and b/Items/Armor/GodSlayerHelmet_Head.png differ diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs new file mode 100644 index 0000000000..9e7df938bf --- /dev/null +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerHornedHelm.png b/Items/Armor/GodSlayerHornedHelm.png new file mode 100644 index 0000000000..8f98dc42a1 Binary files /dev/null and b/Items/Armor/GodSlayerHornedHelm.png differ diff --git a/Items/Armor/GodSlayerHornedHelm_Head.png b/Items/Armor/GodSlayerHornedHelm_Head.png new file mode 100644 index 0000000000..bb6e60caf0 Binary files /dev/null and b/Items/Armor/GodSlayerHornedHelm_Head.png differ diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs new file mode 100644 index 0000000000..ea2ffc5029 --- /dev/null +++ b/Items/Armor/GodSlayerLeggings.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/GodSlayerLeggings.png b/Items/Armor/GodSlayerLeggings.png new file mode 100644 index 0000000000..db62fff671 Binary files /dev/null and b/Items/Armor/GodSlayerLeggings.png differ diff --git a/Items/Armor/GodSlayerLeggings_Legs.png b/Items/Armor/GodSlayerLeggings_Legs.png new file mode 100644 index 0000000000..f9bb8eed2a Binary files /dev/null and b/Items/Armor/GodSlayerLeggings_Legs.png differ diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs new file mode 100644 index 0000000000..f77cdf6f47 --- /dev/null +++ b/Items/Armor/GodSlayerMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerMask.png b/Items/Armor/GodSlayerMask.png new file mode 100644 index 0000000000..da5a1986d1 Binary files /dev/null and b/Items/Armor/GodSlayerMask.png differ diff --git a/Items/Armor/GodSlayerMask_Head.png b/Items/Armor/GodSlayerMask_Head.png new file mode 100644 index 0000000000..c720a99ea9 Binary files /dev/null and b/Items/Armor/GodSlayerMask_Head.png differ diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs new file mode 100644 index 0000000000..baf5aee07b --- /dev/null +++ b/Items/Armor/GodSlayerVisage.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/GodSlayerVisage.png b/Items/Armor/GodSlayerVisage.png new file mode 100644 index 0000000000..941e7d35f8 Binary files /dev/null and b/Items/Armor/GodSlayerVisage.png differ diff --git a/Items/Armor/GodSlayerVisage_Head.png b/Items/Armor/GodSlayerVisage_Head.png new file mode 100644 index 0000000000..5debb668c8 Binary files /dev/null and b/Items/Armor/GodSlayerVisage_Head.png differ diff --git a/Items/Armor/HiveMindMask.cs b/Items/Armor/HiveMindMask.cs new file mode 100644 index 0000000000..01a88d0bfa --- /dev/null +++ b/Items/Armor/HiveMindMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class HiveMindMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Mind Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/HiveMindMask.png b/Items/Armor/HiveMindMask.png new file mode 100644 index 0000000000..7d575df3c7 Binary files /dev/null and b/Items/Armor/HiveMindMask.png differ diff --git a/Items/Armor/HiveMindMask_Head.png b/Items/Armor/HiveMindMask_Head.png new file mode 100644 index 0000000000..5caf675ccb Binary files /dev/null and b/Items/Armor/HiveMindMask_Head.png differ diff --git a/Items/Armor/LeviathanMask.cs b/Items/Armor/LeviathanMask.cs new file mode 100644 index 0000000000..727e659f3a --- /dev/null +++ b/Items/Armor/LeviathanMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class LeviathanMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/LeviathanMask.png b/Items/Armor/LeviathanMask.png new file mode 100644 index 0000000000..cc7e565bfc Binary files /dev/null and b/Items/Armor/LeviathanMask.png differ diff --git a/Items/Armor/LeviathanMask_Head.png b/Items/Armor/LeviathanMask_Head.png new file mode 100644 index 0000000000..28b1546778 Binary files /dev/null and b/Items/Armor/LeviathanMask_Head.png differ diff --git a/Items/Armor/PerforatorMask.cs b/Items/Armor/PerforatorMask.cs new file mode 100644 index 0000000000..0e69f86ece --- /dev/null +++ b/Items/Armor/PerforatorMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PerforatorMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/PerforatorMask.png b/Items/Armor/PerforatorMask.png new file mode 100644 index 0000000000..c961bf4011 Binary files /dev/null and b/Items/Armor/PerforatorMask.png differ diff --git a/Items/Armor/PerforatorMask_Head.png b/Items/Armor/PerforatorMask_Head.png new file mode 100644 index 0000000000..c787fc96e8 Binary files /dev/null and b/Items/Armor/PerforatorMask_Head.png differ diff --git a/Items/Armor/PlaguebringerGoliathMask.cs b/Items/Armor/PlaguebringerGoliathMask.cs new file mode 100644 index 0000000000..b4e45ce4f2 --- /dev/null +++ b/Items/Armor/PlaguebringerGoliathMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PlaguebringerGoliathMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Goliath Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/PlaguebringerGoliathMask.png b/Items/Armor/PlaguebringerGoliathMask.png new file mode 100644 index 0000000000..083b2ecb40 Binary files /dev/null and b/Items/Armor/PlaguebringerGoliathMask.png differ diff --git a/Items/Armor/PlaguebringerGoliathMask_Head.png b/Items/Armor/PlaguebringerGoliathMask_Head.png new file mode 100644 index 0000000000..c7e780a171 Binary files /dev/null and b/Items/Armor/PlaguebringerGoliathMask_Head.png differ diff --git a/Items/Armor/ProvidenceMask.cs b/Items/Armor/ProvidenceMask.cs new file mode 100644 index 0000000000..da96d0a4bb --- /dev/null +++ b/Items/Armor/ProvidenceMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ProvidenceMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/ProvidenceMask.png b/Items/Armor/ProvidenceMask.png new file mode 100644 index 0000000000..3eb2c42b9d Binary files /dev/null and b/Items/Armor/ProvidenceMask.png differ diff --git a/Items/Armor/ProvidenceMask_Head.png b/Items/Armor/ProvidenceMask_Head.png new file mode 100644 index 0000000000..91ce4b416b Binary files /dev/null and b/Items/Armor/ProvidenceMask_Head.png differ diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs new file mode 100644 index 0000000000..7c13b9daa3 --- /dev/null +++ b/Items/Armor/ReaverCap.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/ReaverCap.png b/Items/Armor/ReaverCap.png new file mode 100644 index 0000000000..f854e583da Binary files /dev/null and b/Items/Armor/ReaverCap.png differ diff --git a/Items/Armor/ReaverCap_Head.png b/Items/Armor/ReaverCap_Head.png new file mode 100644 index 0000000000..e50da65d12 Binary files /dev/null and b/Items/Armor/ReaverCap_Head.png differ diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs new file mode 100644 index 0000000000..9fd1762b68 --- /dev/null +++ b/Items/Armor/ReaverCuisses.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/ReaverCuisses.png b/Items/Armor/ReaverCuisses.png new file mode 100644 index 0000000000..09b237afba Binary files /dev/null and b/Items/Armor/ReaverCuisses.png differ diff --git a/Items/Armor/ReaverCuisses_Legs.png b/Items/Armor/ReaverCuisses_Legs.png new file mode 100644 index 0000000000..844ac58554 Binary files /dev/null and b/Items/Armor/ReaverCuisses_Legs.png differ diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs new file mode 100644 index 0000000000..619a65d501 --- /dev/null +++ b/Items/Armor/ReaverHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/ReaverHelm.png b/Items/Armor/ReaverHelm.png new file mode 100644 index 0000000000..82e97502ac Binary files /dev/null and b/Items/Armor/ReaverHelm.png differ diff --git a/Items/Armor/ReaverHelm_Head.png b/Items/Armor/ReaverHelm_Head.png new file mode 100644 index 0000000000..6ac90bf026 Binary files /dev/null and b/Items/Armor/ReaverHelm_Head.png differ diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs new file mode 100644 index 0000000000..d3f2aba01b --- /dev/null +++ b/Items/Armor/ReaverHelmet.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/ReaverHelmet.png b/Items/Armor/ReaverHelmet.png new file mode 100644 index 0000000000..a0854bb0c1 Binary files /dev/null and b/Items/Armor/ReaverHelmet.png differ diff --git a/Items/Armor/ReaverHelmet_Head.png b/Items/Armor/ReaverHelmet_Head.png new file mode 100644 index 0000000000..f6c57632bf Binary files /dev/null and b/Items/Armor/ReaverHelmet_Head.png differ diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs new file mode 100644 index 0000000000..3687712c83 --- /dev/null +++ b/Items/Armor/ReaverMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/ReaverMask.png b/Items/Armor/ReaverMask.png new file mode 100644 index 0000000000..9bef9127fb Binary files /dev/null and b/Items/Armor/ReaverMask.png differ diff --git a/Items/Armor/ReaverMask_Head.png b/Items/Armor/ReaverMask_Head.png new file mode 100644 index 0000000000..edcdcfc7e6 Binary files /dev/null and b/Items/Armor/ReaverMask_Head.png differ diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs new file mode 100644 index 0000000000..6016612135 --- /dev/null +++ b/Items/Armor/ReaverScaleMail.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/ReaverScaleMail.png b/Items/Armor/ReaverScaleMail.png new file mode 100644 index 0000000000..424da62e05 Binary files /dev/null and b/Items/Armor/ReaverScaleMail.png differ diff --git a/Items/Armor/ReaverScaleMail_Arms.png b/Items/Armor/ReaverScaleMail_Arms.png new file mode 100644 index 0000000000..ac9f5006ff Binary files /dev/null and b/Items/Armor/ReaverScaleMail_Arms.png differ diff --git a/Items/Armor/ReaverScaleMail_Body.png b/Items/Armor/ReaverScaleMail_Body.png new file mode 100644 index 0000000000..858a7c533e Binary files /dev/null and b/Items/Armor/ReaverScaleMail_Body.png differ diff --git a/Items/Armor/ReaverScaleMail_FemaleBody.png b/Items/Armor/ReaverScaleMail_FemaleBody.png new file mode 100644 index 0000000000..858a7c533e Binary files /dev/null and b/Items/Armor/ReaverScaleMail_FemaleBody.png differ diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs new file mode 100644 index 0000000000..7e854a0585 --- /dev/null +++ b/Items/Armor/ReaverVisage.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/ReaverVisage.png b/Items/Armor/ReaverVisage.png new file mode 100644 index 0000000000..a45d8c6d82 Binary files /dev/null and b/Items/Armor/ReaverVisage.png differ diff --git a/Items/Armor/ReaverVisage_Head.png b/Items/Armor/ReaverVisage_Head.png new file mode 100644 index 0000000000..6b0ce53bc9 Binary files /dev/null and b/Items/Armor/ReaverVisage_Head.png differ diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs new file mode 100644 index 0000000000..944251a430 --- /dev/null +++ b/Items/Armor/ShroomiteVisage.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ShroomiteVisage.png b/Items/Armor/ShroomiteVisage.png new file mode 100644 index 0000000000..1ad5fe600e Binary files /dev/null and b/Items/Armor/ShroomiteVisage.png differ diff --git a/Items/Armor/ShroomiteVisage_Head.png b/Items/Armor/ShroomiteVisage_Head.png new file mode 100644 index 0000000000..7a6ab7cef8 Binary files /dev/null and b/Items/Armor/ShroomiteVisage_Head.png differ diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs new file mode 100644 index 0000000000..417e2a431b --- /dev/null +++ b/Items/Armor/SilvaArmor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaArmor.png b/Items/Armor/SilvaArmor.png new file mode 100644 index 0000000000..0cd055a933 Binary files /dev/null and b/Items/Armor/SilvaArmor.png differ diff --git a/Items/Armor/SilvaArmor_Arms.png b/Items/Armor/SilvaArmor_Arms.png new file mode 100644 index 0000000000..f029d4c336 Binary files /dev/null and b/Items/Armor/SilvaArmor_Arms.png differ diff --git a/Items/Armor/SilvaArmor_Body.png b/Items/Armor/SilvaArmor_Body.png new file mode 100644 index 0000000000..95a19f3ea3 Binary files /dev/null and b/Items/Armor/SilvaArmor_Body.png differ diff --git a/Items/Armor/SilvaArmor_FemaleBody.png b/Items/Armor/SilvaArmor_FemaleBody.png new file mode 100644 index 0000000000..6ca78b705d Binary files /dev/null and b/Items/Armor/SilvaArmor_FemaleBody.png differ diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs new file mode 100644 index 0000000000..a38942bcc2 --- /dev/null +++ b/Items/Armor/SilvaHelm.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +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/SilvaHelm.png b/Items/Armor/SilvaHelm.png new file mode 100644 index 0000000000..2f20b54283 Binary files /dev/null and b/Items/Armor/SilvaHelm.png differ diff --git a/Items/Armor/SilvaHelm_Head.png b/Items/Armor/SilvaHelm_Head.png new file mode 100644 index 0000000000..24a69fe34d Binary files /dev/null and b/Items/Armor/SilvaHelm_Head.png differ diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs new file mode 100644 index 0000000000..a3580e90ef --- /dev/null +++ b/Items/Armor/SilvaHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaHelmet.png b/Items/Armor/SilvaHelmet.png new file mode 100644 index 0000000000..5670c7839b Binary files /dev/null and b/Items/Armor/SilvaHelmet.png differ diff --git a/Items/Armor/SilvaHelmet_Head.png b/Items/Armor/SilvaHelmet_Head.png new file mode 100644 index 0000000000..451e16e2a1 Binary files /dev/null and b/Items/Armor/SilvaHelmet_Head.png differ diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs new file mode 100644 index 0000000000..a2bd66b437 --- /dev/null +++ b/Items/Armor/SilvaHornedHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaHornedHelm.png b/Items/Armor/SilvaHornedHelm.png new file mode 100644 index 0000000000..29cec41391 Binary files /dev/null and b/Items/Armor/SilvaHornedHelm.png differ diff --git a/Items/Armor/SilvaHornedHelm_Head.png b/Items/Armor/SilvaHornedHelm_Head.png new file mode 100644 index 0000000000..6030b50ab5 Binary files /dev/null and b/Items/Armor/SilvaHornedHelm_Head.png differ diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs new file mode 100644 index 0000000000..ee9c94c797 --- /dev/null +++ b/Items/Armor/SilvaLeggings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaLeggings.png b/Items/Armor/SilvaLeggings.png new file mode 100644 index 0000000000..7878fea27f Binary files /dev/null and b/Items/Armor/SilvaLeggings.png differ diff --git a/Items/Armor/SilvaLeggings_Legs.png b/Items/Armor/SilvaLeggings_Legs.png new file mode 100644 index 0000000000..9b20c294a0 Binary files /dev/null and b/Items/Armor/SilvaLeggings_Legs.png differ diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs new file mode 100644 index 0000000000..2084647525 --- /dev/null +++ b/Items/Armor/SilvaMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaMask.png b/Items/Armor/SilvaMask.png new file mode 100644 index 0000000000..b53e7539fb Binary files /dev/null and b/Items/Armor/SilvaMask.png differ diff --git a/Items/Armor/SilvaMask_Head.png b/Items/Armor/SilvaMask_Head.png new file mode 100644 index 0000000000..6721d7d41e Binary files /dev/null and b/Items/Armor/SilvaMask_Head.png differ diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs new file mode 100644 index 0000000000..16bd811a9a --- /dev/null +++ b/Items/Armor/SilvaMaskedCap.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/SilvaMaskedCap.png b/Items/Armor/SilvaMaskedCap.png new file mode 100644 index 0000000000..6309811b86 Binary files /dev/null and b/Items/Armor/SilvaMaskedCap.png differ diff --git a/Items/Armor/SilvaMaskedCap_Head.png b/Items/Armor/SilvaMaskedCap_Head.png new file mode 100644 index 0000000000..dcab255b58 Binary files /dev/null and b/Items/Armor/SilvaMaskedCap_Head.png differ diff --git a/Items/Armor/SirenTransAlt_Arms.png b/Items/Armor/SirenTransAlt_Arms.png new file mode 100644 index 0000000000..06431b524d Binary files /dev/null and b/Items/Armor/SirenTransAlt_Arms.png differ diff --git a/Items/Armor/SirenTransAlt_Body.png b/Items/Armor/SirenTransAlt_Body.png new file mode 100644 index 0000000000..c984cf2a81 Binary files /dev/null and b/Items/Armor/SirenTransAlt_Body.png differ diff --git a/Items/Armor/SirenTransAlt_Head.png b/Items/Armor/SirenTransAlt_Head.png new file mode 100644 index 0000000000..3278a8408a Binary files /dev/null and b/Items/Armor/SirenTransAlt_Head.png differ diff --git a/Items/Armor/SirenTransAlt_Legs.png b/Items/Armor/SirenTransAlt_Legs.png new file mode 100644 index 0000000000..f3c1b0e62a Binary files /dev/null and b/Items/Armor/SirenTransAlt_Legs.png differ diff --git a/Items/Armor/SirenTrans_Arms.png b/Items/Armor/SirenTrans_Arms.png new file mode 100644 index 0000000000..845a4b811d Binary files /dev/null and b/Items/Armor/SirenTrans_Arms.png differ diff --git a/Items/Armor/SirenTrans_Body.png b/Items/Armor/SirenTrans_Body.png new file mode 100644 index 0000000000..aea053cf33 Binary files /dev/null and b/Items/Armor/SirenTrans_Body.png differ diff --git a/Items/Armor/SirenTrans_Head.png b/Items/Armor/SirenTrans_Head.png new file mode 100644 index 0000000000..a7dab5908b Binary files /dev/null and b/Items/Armor/SirenTrans_Head.png differ diff --git a/Items/Armor/SirenTrans_Legs.png b/Items/Armor/SirenTrans_Legs.png new file mode 100644 index 0000000000..a20136af42 Binary files /dev/null and b/Items/Armor/SirenTrans_Legs.png differ diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs new file mode 100644 index 0000000000..7b465c5081 --- /dev/null +++ b/Items/Armor/SirensHeart.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Armor/SirensHeart.png b/Items/Armor/SirensHeart.png new file mode 100644 index 0000000000..6ff2787a67 Binary files /dev/null and b/Items/Armor/SirensHeart.png differ diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs new file mode 100644 index 0000000000..1ab3374421 --- /dev/null +++ b/Items/Armor/SirensHeartAlt.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Armor/SirensHeartAlt.png b/Items/Armor/SirensHeartAlt.png new file mode 100644 index 0000000000..6ff2787a67 Binary files /dev/null and b/Items/Armor/SirensHeartAlt.png differ diff --git a/Items/Armor/SlimeGodMask.cs b/Items/Armor/SlimeGodMask.cs new file mode 100644 index 0000000000..b30aeb1338 --- /dev/null +++ b/Items/Armor/SlimeGodMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SlimeGodMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/SlimeGodMask.png b/Items/Armor/SlimeGodMask.png new file mode 100644 index 0000000000..8e36266e68 Binary files /dev/null and b/Items/Armor/SlimeGodMask.png differ diff --git a/Items/Armor/SlimeGodMask2.cs b/Items/Armor/SlimeGodMask2.cs new file mode 100644 index 0000000000..e7fae5ecf4 --- /dev/null +++ b/Items/Armor/SlimeGodMask2.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SlimeGodMask2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/SlimeGodMask2.png b/Items/Armor/SlimeGodMask2.png new file mode 100644 index 0000000000..bd1260d848 Binary files /dev/null and b/Items/Armor/SlimeGodMask2.png differ diff --git a/Items/Armor/SlimeGodMask2_Head.png b/Items/Armor/SlimeGodMask2_Head.png new file mode 100644 index 0000000000..9b7bd19a50 Binary files /dev/null and b/Items/Armor/SlimeGodMask2_Head.png differ diff --git a/Items/Armor/SlimeGodMask_Head.png b/Items/Armor/SlimeGodMask_Head.png new file mode 100644 index 0000000000..b42fe6d491 Binary files /dev/null and b/Items/Armor/SlimeGodMask_Head.png differ diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs new file mode 100644 index 0000000000..03ecc80e39 --- /dev/null +++ b/Items/Armor/StatigelArmor.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/StatigelArmor.png b/Items/Armor/StatigelArmor.png new file mode 100644 index 0000000000..c15870cb00 Binary files /dev/null and b/Items/Armor/StatigelArmor.png differ diff --git a/Items/Armor/StatigelArmor_Arms.png b/Items/Armor/StatigelArmor_Arms.png new file mode 100644 index 0000000000..25165de9bb Binary files /dev/null and b/Items/Armor/StatigelArmor_Arms.png differ diff --git a/Items/Armor/StatigelArmor_Body.png b/Items/Armor/StatigelArmor_Body.png new file mode 100644 index 0000000000..ce63d10b45 Binary files /dev/null and b/Items/Armor/StatigelArmor_Body.png differ diff --git a/Items/Armor/StatigelArmor_FemaleBody.png b/Items/Armor/StatigelArmor_FemaleBody.png new file mode 100644 index 0000000000..ce63d10b45 Binary files /dev/null and b/Items/Armor/StatigelArmor_FemaleBody.png differ diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs new file mode 100644 index 0000000000..3fb8b0abc3 --- /dev/null +++ b/Items/Armor/StatigelCap.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelCap.png b/Items/Armor/StatigelCap.png new file mode 100644 index 0000000000..79edd56be1 Binary files /dev/null and b/Items/Armor/StatigelCap.png differ diff --git a/Items/Armor/StatigelCap_Head.png b/Items/Armor/StatigelCap_Head.png new file mode 100644 index 0000000000..1a32daaa44 Binary files /dev/null and b/Items/Armor/StatigelCap_Head.png differ diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs new file mode 100644 index 0000000000..e86ae55276 --- /dev/null +++ b/Items/Armor/StatigelGreaves.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelGreaves.png b/Items/Armor/StatigelGreaves.png new file mode 100644 index 0000000000..e3e3d08c8b Binary files /dev/null and b/Items/Armor/StatigelGreaves.png differ diff --git a/Items/Armor/StatigelGreaves_Legs.png b/Items/Armor/StatigelGreaves_Legs.png new file mode 100644 index 0000000000..705da9cee3 Binary files /dev/null and b/Items/Armor/StatigelGreaves_Legs.png differ diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs new file mode 100644 index 0000000000..a546bc2889 --- /dev/null +++ b/Items/Armor/StatigelHeadgear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelHeadgear.png b/Items/Armor/StatigelHeadgear.png new file mode 100644 index 0000000000..b45e698cd2 Binary files /dev/null and b/Items/Armor/StatigelHeadgear.png differ diff --git a/Items/Armor/StatigelHeadgear_Head.png b/Items/Armor/StatigelHeadgear_Head.png new file mode 100644 index 0000000000..96866db026 Binary files /dev/null and b/Items/Armor/StatigelHeadgear_Head.png differ diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs new file mode 100644 index 0000000000..57f2b3a9e1 --- /dev/null +++ b/Items/Armor/StatigelHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelHelm.png b/Items/Armor/StatigelHelm.png new file mode 100644 index 0000000000..457fb982ad Binary files /dev/null and b/Items/Armor/StatigelHelm.png differ diff --git a/Items/Armor/StatigelHelm_Head.png b/Items/Armor/StatigelHelm_Head.png new file mode 100644 index 0000000000..3b59eff6e4 Binary files /dev/null and b/Items/Armor/StatigelHelm_Head.png differ diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs new file mode 100644 index 0000000000..b6b8c59bb7 --- /dev/null +++ b/Items/Armor/StatigelHood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelHood.png b/Items/Armor/StatigelHood.png new file mode 100644 index 0000000000..be631c665e Binary files /dev/null and b/Items/Armor/StatigelHood.png differ diff --git a/Items/Armor/StatigelHood_Head.png b/Items/Armor/StatigelHood_Head.png new file mode 100644 index 0000000000..84acdb5c82 Binary files /dev/null and b/Items/Armor/StatigelHood_Head.png differ diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs new file mode 100644 index 0000000000..3e8a20bfed --- /dev/null +++ b/Items/Armor/StatigelMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/StatigelMask.png b/Items/Armor/StatigelMask.png new file mode 100644 index 0000000000..db03ae1fa1 Binary files /dev/null and b/Items/Armor/StatigelMask.png differ diff --git a/Items/Armor/StatigelMask_Head.png b/Items/Armor/StatigelMask_Head.png new file mode 100644 index 0000000000..f1a7d5f7ab Binary files /dev/null and b/Items/Armor/StatigelMask_Head.png differ diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs new file mode 100644 index 0000000000..8b4b06abf6 --- /dev/null +++ b/Items/Armor/TarragonBreastplate.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonBreastplate.png b/Items/Armor/TarragonBreastplate.png new file mode 100644 index 0000000000..c41ca85408 Binary files /dev/null and b/Items/Armor/TarragonBreastplate.png differ diff --git a/Items/Armor/TarragonBreastplate_Arms.png b/Items/Armor/TarragonBreastplate_Arms.png new file mode 100644 index 0000000000..aeed272d72 Binary files /dev/null and b/Items/Armor/TarragonBreastplate_Arms.png differ diff --git a/Items/Armor/TarragonBreastplate_Body.png b/Items/Armor/TarragonBreastplate_Body.png new file mode 100644 index 0000000000..c72497c9d1 Binary files /dev/null and b/Items/Armor/TarragonBreastplate_Body.png differ diff --git a/Items/Armor/TarragonBreastplate_FemaleBody.png b/Items/Armor/TarragonBreastplate_FemaleBody.png new file mode 100644 index 0000000000..c72497c9d1 Binary files /dev/null and b/Items/Armor/TarragonBreastplate_FemaleBody.png differ diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs new file mode 100644 index 0000000000..de195d8781 --- /dev/null +++ b/Items/Armor/TarragonHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonHelm.png b/Items/Armor/TarragonHelm.png new file mode 100644 index 0000000000..83ebda3858 Binary files /dev/null and b/Items/Armor/TarragonHelm.png differ diff --git a/Items/Armor/TarragonHelm_Head.png b/Items/Armor/TarragonHelm_Head.png new file mode 100644 index 0000000000..71433a937d Binary files /dev/null and b/Items/Armor/TarragonHelm_Head.png differ diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs new file mode 100644 index 0000000000..0ba95cbdf8 --- /dev/null +++ b/Items/Armor/TarragonHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonHelmet.png b/Items/Armor/TarragonHelmet.png new file mode 100644 index 0000000000..2765f267fe Binary files /dev/null and b/Items/Armor/TarragonHelmet.png differ diff --git a/Items/Armor/TarragonHelmet_Head.png b/Items/Armor/TarragonHelmet_Head.png new file mode 100644 index 0000000000..4468d96679 Binary files /dev/null and b/Items/Armor/TarragonHelmet_Head.png differ diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs new file mode 100644 index 0000000000..70d86aeed3 --- /dev/null +++ b/Items/Armor/TarragonHornedHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonHornedHelm.png b/Items/Armor/TarragonHornedHelm.png new file mode 100644 index 0000000000..1aa5e38d9e Binary files /dev/null and b/Items/Armor/TarragonHornedHelm.png differ diff --git a/Items/Armor/TarragonHornedHelm_Head.png b/Items/Armor/TarragonHornedHelm_Head.png new file mode 100644 index 0000000000..9d471eae38 Binary files /dev/null and b/Items/Armor/TarragonHornedHelm_Head.png differ diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs new file mode 100644 index 0000000000..5cbc70212f --- /dev/null +++ b/Items/Armor/TarragonLeggings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonLeggings.png b/Items/Armor/TarragonLeggings.png new file mode 100644 index 0000000000..fc9508c927 Binary files /dev/null and b/Items/Armor/TarragonLeggings.png differ diff --git a/Items/Armor/TarragonLeggings_Legs.png b/Items/Armor/TarragonLeggings_Legs.png new file mode 100644 index 0000000000..1a4c0b0367 Binary files /dev/null and b/Items/Armor/TarragonLeggings_Legs.png differ diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs new file mode 100644 index 0000000000..5c91b6fb2c --- /dev/null +++ b/Items/Armor/TarragonMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonMask.png b/Items/Armor/TarragonMask.png new file mode 100644 index 0000000000..c0a5f18a16 Binary files /dev/null and b/Items/Armor/TarragonMask.png differ diff --git a/Items/Armor/TarragonMask_Head.png b/Items/Armor/TarragonMask_Head.png new file mode 100644 index 0000000000..c77eb3af99 Binary files /dev/null and b/Items/Armor/TarragonMask_Head.png differ diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs new file mode 100644 index 0000000000..754f540904 --- /dev/null +++ b/Items/Armor/TarragonVisage.cs @@ -0,0 +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.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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/TarragonVisage.png b/Items/Armor/TarragonVisage.png new file mode 100644 index 0000000000..05aa2b48e4 Binary files /dev/null and b/Items/Armor/TarragonVisage.png differ diff --git a/Items/Armor/TarragonVisage_Head.png b/Items/Armor/TarragonVisage_Head.png new file mode 100644 index 0000000000..de4e64a472 Binary files /dev/null and b/Items/Armor/TarragonVisage_Head.png differ diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs new file mode 100644 index 0000000000..403c6412ba --- /dev/null +++ b/Items/Armor/VictideBreastplate.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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/VictideBreastplate.png b/Items/Armor/VictideBreastplate.png new file mode 100644 index 0000000000..47ea04a593 Binary files /dev/null and b/Items/Armor/VictideBreastplate.png differ diff --git a/Items/Armor/VictideBreastplate_Arms.png b/Items/Armor/VictideBreastplate_Arms.png new file mode 100644 index 0000000000..cbcbd2a812 Binary files /dev/null and b/Items/Armor/VictideBreastplate_Arms.png differ diff --git a/Items/Armor/VictideBreastplate_Body.png b/Items/Armor/VictideBreastplate_Body.png new file mode 100644 index 0000000000..8b32daba02 Binary files /dev/null and b/Items/Armor/VictideBreastplate_Body.png differ diff --git a/Items/Armor/VictideBreastplate_FemaleBody.png b/Items/Armor/VictideBreastplate_FemaleBody.png new file mode 100644 index 0000000000..c369a3a50f Binary files /dev/null and b/Items/Armor/VictideBreastplate_FemaleBody.png differ diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs new file mode 100644 index 0000000000..ee325c2207 --- /dev/null +++ b/Items/Armor/VictideHeadgear.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/VictideHeadgear.png b/Items/Armor/VictideHeadgear.png new file mode 100644 index 0000000000..d08f35078b Binary files /dev/null and b/Items/Armor/VictideHeadgear.png differ diff --git a/Items/Armor/VictideHeadgear_Head.png b/Items/Armor/VictideHeadgear_Head.png new file mode 100644 index 0000000000..c6b67fd783 Binary files /dev/null and b/Items/Armor/VictideHeadgear_Head.png differ diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs new file mode 100644 index 0000000000..6e7454bf3c --- /dev/null +++ b/Items/Armor/VictideHelm.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/VictideHelm.png b/Items/Armor/VictideHelm.png new file mode 100644 index 0000000000..a0dc8cdd11 Binary files /dev/null and b/Items/Armor/VictideHelm.png differ diff --git a/Items/Armor/VictideHelm_Head.png b/Items/Armor/VictideHelm_Head.png new file mode 100644 index 0000000000..debf620aab Binary files /dev/null and b/Items/Armor/VictideHelm_Head.png differ diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs new file mode 100644 index 0000000000..34d28c04d7 --- /dev/null +++ b/Items/Armor/VictideHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/VictideHelmet.png b/Items/Armor/VictideHelmet.png new file mode 100644 index 0000000000..a52ccecf57 Binary files /dev/null and b/Items/Armor/VictideHelmet.png differ diff --git a/Items/Armor/VictideHelmet_Head.png b/Items/Armor/VictideHelmet_Head.png new file mode 100644 index 0000000000..e4901eaecf Binary files /dev/null and b/Items/Armor/VictideHelmet_Head.png differ diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs new file mode 100644 index 0000000000..b0854c04d3 --- /dev/null +++ b/Items/Armor/VictideLeggings.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/VictideLeggings.png b/Items/Armor/VictideLeggings.png new file mode 100644 index 0000000000..50d79a9707 Binary files /dev/null and b/Items/Armor/VictideLeggings.png differ diff --git a/Items/Armor/VictideLeggings_Legs.png b/Items/Armor/VictideLeggings_Legs.png new file mode 100644 index 0000000000..58ae99512f Binary files /dev/null and b/Items/Armor/VictideLeggings_Legs.png differ diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs new file mode 100644 index 0000000000..ae30d0ad13 --- /dev/null +++ b/Items/Armor/VictideMask.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/VictideMask.png b/Items/Armor/VictideMask.png new file mode 100644 index 0000000000..223b316ac5 Binary files /dev/null and b/Items/Armor/VictideMask.png differ diff --git a/Items/Armor/VictideMask_Head.png b/Items/Armor/VictideMask_Head.png new file mode 100644 index 0000000000..633c427676 Binary files /dev/null and b/Items/Armor/VictideMask_Head.png differ diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs new file mode 100644 index 0000000000..5f02794ece --- /dev/null +++ b/Items/Armor/VictideVisage.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/VictideVisage.png b/Items/Armor/VictideVisage.png new file mode 100644 index 0000000000..0bc956740e Binary files /dev/null and b/Items/Armor/VictideVisage.png differ diff --git a/Items/Armor/VictideVisage_Head.png b/Items/Armor/VictideVisage_Head.png new file mode 100644 index 0000000000..ae98fd02a4 Binary files /dev/null and b/Items/Armor/VictideVisage_Head.png differ diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs new file mode 100644 index 0000000000..5ccd5b17fb --- /dev/null +++ b/Items/Armor/WulfrumArmor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumArmor.png b/Items/Armor/WulfrumArmor.png new file mode 100644 index 0000000000..6b588b347a Binary files /dev/null and b/Items/Armor/WulfrumArmor.png differ diff --git a/Items/Armor/WulfrumArmor_Arms.png b/Items/Armor/WulfrumArmor_Arms.png new file mode 100644 index 0000000000..f4658bd88d Binary files /dev/null and b/Items/Armor/WulfrumArmor_Arms.png differ diff --git a/Items/Armor/WulfrumArmor_Body.png b/Items/Armor/WulfrumArmor_Body.png new file mode 100644 index 0000000000..44e60bb227 Binary files /dev/null and b/Items/Armor/WulfrumArmor_Body.png differ diff --git a/Items/Armor/WulfrumArmor_FemaleBody.png b/Items/Armor/WulfrumArmor_FemaleBody.png new file mode 100644 index 0000000000..44e60bb227 Binary files /dev/null and b/Items/Armor/WulfrumArmor_FemaleBody.png differ diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs new file mode 100644 index 0000000000..5eac51d970 --- /dev/null +++ b/Items/Armor/WulfrumHeadgear.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumHeadgear.png b/Items/Armor/WulfrumHeadgear.png new file mode 100644 index 0000000000..671c39b7f4 Binary files /dev/null and b/Items/Armor/WulfrumHeadgear.png differ diff --git a/Items/Armor/WulfrumHeadgear_Head.png b/Items/Armor/WulfrumHeadgear_Head.png new file mode 100644 index 0000000000..4ea3156130 Binary files /dev/null and b/Items/Armor/WulfrumHeadgear_Head.png differ diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs new file mode 100644 index 0000000000..21b1d9a1d7 --- /dev/null +++ b/Items/Armor/WulfrumHelm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumHelm.png b/Items/Armor/WulfrumHelm.png new file mode 100644 index 0000000000..500b44d32a Binary files /dev/null and b/Items/Armor/WulfrumHelm.png differ diff --git a/Items/Armor/WulfrumHelm_Head.png b/Items/Armor/WulfrumHelm_Head.png new file mode 100644 index 0000000000..1498d2b0be Binary files /dev/null and b/Items/Armor/WulfrumHelm_Head.png differ diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs new file mode 100644 index 0000000000..4f273109b7 --- /dev/null +++ b/Items/Armor/WulfrumHelmet.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumHelmet.png b/Items/Armor/WulfrumHelmet.png new file mode 100644 index 0000000000..a531fdf4a6 Binary files /dev/null and b/Items/Armor/WulfrumHelmet.png differ diff --git a/Items/Armor/WulfrumHelmet_Head.png b/Items/Armor/WulfrumHelmet_Head.png new file mode 100644 index 0000000000..a62f01cf1d Binary files /dev/null and b/Items/Armor/WulfrumHelmet_Head.png differ diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs new file mode 100644 index 0000000000..a2491c17cc --- /dev/null +++ b/Items/Armor/WulfrumHood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumHood.png b/Items/Armor/WulfrumHood.png new file mode 100644 index 0000000000..73ea374b5a Binary files /dev/null and b/Items/Armor/WulfrumHood.png differ diff --git a/Items/Armor/WulfrumHood_Head.png b/Items/Armor/WulfrumHood_Head.png new file mode 100644 index 0000000000..dc5bcd550e Binary files /dev/null and b/Items/Armor/WulfrumHood_Head.png differ diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs new file mode 100644 index 0000000000..cb1eb9bdca --- /dev/null +++ b/Items/Armor/WulfrumLeggings.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumLeggings.png b/Items/Armor/WulfrumLeggings.png new file mode 100644 index 0000000000..6ed06d8882 Binary files /dev/null and b/Items/Armor/WulfrumLeggings.png differ diff --git a/Items/Armor/WulfrumLeggings_Legs.png b/Items/Armor/WulfrumLeggings_Legs.png new file mode 100644 index 0000000000..56268cf5de Binary files /dev/null and b/Items/Armor/WulfrumLeggings_Legs.png differ diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs new file mode 100644 index 0000000000..d77ffb10ec --- /dev/null +++ b/Items/Armor/WulfrumMask.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/WulfrumMask.png b/Items/Armor/WulfrumMask.png new file mode 100644 index 0000000000..81852ac847 Binary files /dev/null and b/Items/Armor/WulfrumMask.png differ diff --git a/Items/Armor/WulfrumMask_Head.png b/Items/Armor/WulfrumMask_Head.png new file mode 100644 index 0000000000..77d7eabf9f Binary files /dev/null and b/Items/Armor/WulfrumMask_Head.png differ diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs new file mode 100644 index 0000000000..d1fc30459e --- /dev/null +++ b/Items/Armor/XerocCuisses.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/XerocCuisses.png b/Items/Armor/XerocCuisses.png new file mode 100644 index 0000000000..b2a9795649 Binary files /dev/null and b/Items/Armor/XerocCuisses.png differ diff --git a/Items/Armor/XerocCuisses_Legs.png b/Items/Armor/XerocCuisses_Legs.png new file mode 100644 index 0000000000..38062343b0 Binary files /dev/null and b/Items/Armor/XerocCuisses_Legs.png differ diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs new file mode 100644 index 0000000000..43190883da --- /dev/null +++ b/Items/Armor/XerocMask.cs @@ -0,0 +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 +2 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/XerocMask.png b/Items/Armor/XerocMask.png new file mode 100644 index 0000000000..7fc3160e93 Binary files /dev/null and b/Items/Armor/XerocMask.png differ diff --git a/Items/Armor/XerocMask_Head.png b/Items/Armor/XerocMask_Head.png new file mode 100644 index 0000000000..b7555ffc81 Binary files /dev/null and b/Items/Armor/XerocMask_Head.png differ diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs new file mode 100644 index 0000000000..8ba60825d2 --- /dev/null +++ b/Items/Armor/XerocPlateMail.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.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/XerocPlateMail.png b/Items/Armor/XerocPlateMail.png new file mode 100644 index 0000000000..df27234edb Binary files /dev/null and b/Items/Armor/XerocPlateMail.png differ diff --git a/Items/Armor/XerocPlateMail_Arms.png b/Items/Armor/XerocPlateMail_Arms.png new file mode 100644 index 0000000000..bba2164400 Binary files /dev/null and b/Items/Armor/XerocPlateMail_Arms.png differ diff --git a/Items/Armor/XerocPlateMail_Body.png b/Items/Armor/XerocPlateMail_Body.png new file mode 100644 index 0000000000..6fe45adf32 Binary files /dev/null and b/Items/Armor/XerocPlateMail_Body.png differ diff --git a/Items/Armor/XerocPlateMail_FemaleBody.png b/Items/Armor/XerocPlateMail_FemaleBody.png new file mode 100644 index 0000000000..6fe45adf32 Binary files /dev/null and b/Items/Armor/XerocPlateMail_FemaleBody.png differ diff --git a/Items/Armor/YharonMask.cs b/Items/Armor/YharonMask.cs new file mode 100644 index 0000000000..39c63691c4 --- /dev/null +++ b/Items/Armor/YharonMask.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class YharonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Armor/YharonMask.png b/Items/Armor/YharonMask.png new file mode 100644 index 0000000000..b308d8b1d8 Binary files /dev/null and b/Items/Armor/YharonMask.png differ diff --git a/Items/Armor/YharonMask_Head.png b/Items/Armor/YharonMask_Head.png new file mode 100644 index 0000000000..8449df88e0 Binary files /dev/null and b/Items/Armor/YharonMask_Head.png differ diff --git a/Items/AshenKey.cs b/Items/AshenKey.cs new file mode 100644 index 0000000000..cacf072e16 --- /dev/null +++ b/Items/AshenKey.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/AshenKey.png b/Items/AshenKey.png new file mode 100644 index 0000000000..22332b8bbb Binary files /dev/null and b/Items/AshenKey.png differ diff --git a/Items/Astrageldon/AstrageldonBag.cs b/Items/Astrageldon/AstrageldonBag.cs new file mode 100644 index 0000000000..e30de459ba --- /dev/null +++ b/Items/Astrageldon/AstrageldonBag.cs @@ -0,0 +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")); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Astrageldon/AstrageldonBag.png b/Items/Astrageldon/AstrageldonBag.png new file mode 100644 index 0000000000..5bbffab635 Binary files /dev/null and b/Items/Astrageldon/AstrageldonBag.png differ diff --git a/Items/Astrageldon/AstralChunk.cs b/Items/Astrageldon/AstralChunk.cs new file mode 100644 index 0000000000..5f477bba3e --- /dev/null +++ b/Items/Astrageldon/AstralChunk.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Astrageldon/AstralChunk.png b/Items/Astrageldon/AstralChunk.png new file mode 100644 index 0000000000..8becd26e1f Binary files /dev/null and b/Items/Astrageldon/AstralChunk.png differ diff --git a/Items/Astrageldon/AstralJelly.cs b/Items/Astrageldon/AstralJelly.cs new file mode 100644 index 0000000000..40e465a07f --- /dev/null +++ b/Items/Astrageldon/AstralJelly.cs @@ -0,0 +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("Astral Jelly"); + 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/Astrageldon/AstralJelly.png b/Items/Astrageldon/AstralJelly.png new file mode 100644 index 0000000000..063ac2fd6d Binary files /dev/null and b/Items/Astrageldon/AstralJelly.png differ diff --git a/Items/AstralBar.cs b/Items/AstralBar.cs new file mode 100644 index 0000000000..88e780a7cc --- /dev/null +++ b/Items/AstralBar.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +public class AstralBar : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = 58750; + item.rare = 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 12); + recipe.AddIngredient(null, "AstralOre", 8); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } +}} \ No newline at end of file diff --git a/Items/AstralBar.png b/Items/AstralBar.png new file mode 100644 index 0000000000..cd4d832df7 Binary files /dev/null and b/Items/AstralBar.png differ diff --git a/Items/AstralHamaxe.cs b/Items/AstralHamaxe.cs new file mode 100644 index 0000000000..d736963493 --- /dev/null +++ b/Items/AstralHamaxe.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +public class AstralHamaxe : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Hamaxe"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.crit += 25; + item.melee = true; + item.width = 38; + item.height = 36; + item.useTime = 10; + item.useAnimation = 20; + item.useTurn = true; + item.axe = 30; + item.hammer = 150; + item.useStyle = 1; + item.knockBack = 5f; + item.value = 350000; + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 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, 173); + } + } + + 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/AstralHamaxe.png b/Items/AstralHamaxe.png new file mode 100644 index 0000000000..a2b8d31471 Binary files /dev/null and b/Items/AstralHamaxe.png differ diff --git a/Items/AstralPickaxe.cs b/Items/AstralPickaxe.cs new file mode 100644 index 0000000000..8b68ea3535 --- /dev/null +++ b/Items/AstralPickaxe.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +public class AstralPickaxe : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Pickaxe"); + } + + public override void SetDefaults() + { + item.damage = 58; + item.crit += 25; + item.melee = true; + item.width = 36; + item.height = 36; + item.useTime = 5; + item.useAnimation = 10; + item.useTurn = true; + item.pick = 200; + item.useStyle = 1; + item.knockBack = 5f; + item.value = 350000; + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 3; + } + + 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 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, 173); + } + } +}} \ No newline at end of file diff --git a/Items/AstralPickaxe.png b/Items/AstralPickaxe.png new file mode 100644 index 0000000000..411b31984c Binary files /dev/null and b/Items/AstralPickaxe.png differ diff --git a/Items/AstrumDeus/AstrumDeusBag.cs b/Items/AstrumDeus/AstrumDeusBag.cs new file mode 100644 index 0000000000..9103512333 --- /dev/null +++ b/Items/AstrumDeus/AstrumDeusBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/AstrumDeus/AstrumDeusBag.png b/Items/AstrumDeus/AstrumDeusBag.png new file mode 100644 index 0000000000..8ea95b3ee3 Binary files /dev/null and b/Items/AstrumDeus/AstrumDeusBag.png differ diff --git a/Items/AstrumDeus/Starcore.cs b/Items/AstrumDeus/Starcore.cs new file mode 100644 index 0000000000..f6ae5041b1 --- /dev/null +++ b/Items/AstrumDeus/Starcore.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/AstrumDeus/Starcore.png b/Items/AstrumDeus/Starcore.png new file mode 100644 index 0000000000..c0281857ef Binary files /dev/null and b/Items/AstrumDeus/Starcore.png differ diff --git a/Items/BarofLife.cs b/Items/BarofLife.cs new file mode 100644 index 0000000000..66dc38c464 --- /dev/null +++ b/Items/BarofLife.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/BarofLife.png b/Items/BarofLife.png new file mode 100644 index 0000000000..7fb3151147 Binary files /dev/null and b/Items/BarofLife.png differ diff --git a/Items/BeastialPickaxe.cs b/Items/BeastialPickaxe.cs new file mode 100644 index 0000000000..4014c59cb0 --- /dev/null +++ b/Items/BeastialPickaxe.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/BeastialPickaxe.png b/Items/BeastialPickaxe.png new file mode 100644 index 0000000000..81263f15d4 Binary files /dev/null and b/Items/BeastialPickaxe.png differ diff --git a/Items/BeetleJuice.cs b/Items/BeetleJuice.cs new file mode 100644 index 0000000000..5dc6adf73f --- /dev/null +++ b/Items/BeetleJuice.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/BeetleJuice.png b/Items/BeetleJuice.png new file mode 100644 index 0000000000..b7e16e4f54 Binary files /dev/null and b/Items/BeetleJuice.png differ diff --git a/Items/BerserkerWaraxe.cs b/Items/BerserkerWaraxe.cs new file mode 100644 index 0000000000..fde07e1185 --- /dev/null +++ b/Items/BerserkerWaraxe.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/BerserkerWaraxe.png b/Items/BerserkerWaraxe.png new file mode 100644 index 0000000000..b70ecfc363 Binary files /dev/null and b/Items/BerserkerWaraxe.png differ diff --git a/Items/BlightedLens.cs b/Items/BlightedLens.cs new file mode 100644 index 0000000000..aaf42afd5f --- /dev/null +++ b/Items/BlightedLens.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/BlightedLens.png b/Items/BlightedLens.png new file mode 100644 index 0000000000..a8c1e84eea Binary files /dev/null and b/Items/BlightedLens.png differ diff --git a/Items/BloodIdol.cs b/Items/BloodIdol.cs new file mode 100644 index 0000000000..6a7a9126f2 --- /dev/null +++ b/Items/BloodIdol.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent.Events; + +namespace CalamityMod.Items +{ + public class BloodIdol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Relic"); + Tooltip.SetDefault("Summons a blood moon"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !Main.bloodMoon && !Main.dayTime; + } + + public override bool UseItem(Player player) + { + Main.bloodMoon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodlettingEssence", 2); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FetidEssence", 2); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/BloodIdol.png b/Items/BloodIdol.png new file mode 100644 index 0000000000..6fea635e5d Binary files /dev/null and b/Items/BloodIdol.png differ diff --git a/Items/BloodOrange.cs b/Items/BloodOrange.cs new file mode 100644 index 0000000000..3a088bc2c8 --- /dev/null +++ b/Items/BloodOrange.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class BloodOrange : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orange"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.bOrange || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bOrange = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/BloodOrange.png b/Items/BloodOrange.png new file mode 100644 index 0000000000..f59f5fac56 Binary files /dev/null and b/Items/BloodOrange.png differ diff --git a/Items/BloodOrb.cs b/Items/BloodOrb.cs new file mode 100644 index 0000000000..a8c8f511c7 --- /dev/null +++ b/Items/BloodOrb.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/BloodOrb.png b/Items/BloodOrb.png new file mode 100644 index 0000000000..2c44ef6550 Binary files /dev/null and b/Items/BloodOrb.png differ diff --git a/Items/BloodlettingEssence.cs b/Items/BloodlettingEssence.cs new file mode 100644 index 0000000000..b95d12bdf0 --- /dev/null +++ b/Items/BloodlettingEssence.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/BloodlettingEssence.png b/Items/BloodlettingEssence.png new file mode 100644 index 0000000000..1cfb76aa4e Binary files /dev/null and b/Items/BloodlettingEssence.png differ diff --git a/Items/Bloodstone.cs b/Items/Bloodstone.cs new file mode 100644 index 0000000000..f55e862f77 --- /dev/null +++ b/Items/Bloodstone.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Bloodstone.png b/Items/Bloodstone.png new file mode 100644 index 0000000000..d80fd83ee5 Binary files /dev/null and b/Items/Bloodstone.png differ diff --git a/Items/BloodstoneCore.cs b/Items/BloodstoneCore.cs new file mode 100644 index 0000000000..d4a5a9ef53 --- /dev/null +++ b/Items/BloodstoneCore.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/BloodstoneCore.png b/Items/BloodstoneCore.png new file mode 100644 index 0000000000..75b36dec3d Binary files /dev/null and b/Items/BloodstoneCore.png differ diff --git a/Items/BlossomPickaxe.cs b/Items/BlossomPickaxe.cs new file mode 100644 index 0000000000..d8995449bb --- /dev/null +++ b/Items/BlossomPickaxe.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/BlossomPickaxe.png b/Items/BlossomPickaxe.png new file mode 100644 index 0000000000..a0d84ae984 Binary files /dev/null and b/Items/BlossomPickaxe.png differ diff --git a/Items/BossRush.cs b/Items/BossRush.cs new file mode 100644 index 0000000000..6b9556b1fd --- /dev/null +++ b/Items/BossRush.cs @@ -0,0 +1,81 @@ +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(); + } + } +} \ No newline at end of file diff --git a/Items/BossRush.png b/Items/BossRush.png new file mode 100644 index 0000000000..1f2977cc99 Binary files /dev/null and b/Items/BossRush.png differ diff --git a/Items/Brimrose.cs b/Items/Brimrose.cs new file mode 100644 index 0000000000..4860a73ee5 --- /dev/null +++ b/Items/Brimrose.cs @@ -0,0 +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"); + } + } +} diff --git a/Items/Brimrose.png b/Items/Brimrose.png new file mode 100644 index 0000000000..1bdd103f8c Binary files /dev/null and b/Items/Brimrose.png differ diff --git a/Items/BrimstoneKey.cs b/Items/BrimstoneKey.cs new file mode 100644 index 0000000000..67ea78004a --- /dev/null +++ b/Items/BrimstoneKey.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/BrimstoneKey.png b/Items/BrimstoneKey.png new file mode 100644 index 0000000000..163771776b Binary files /dev/null and b/Items/BrimstoneKey.png differ diff --git a/Items/BrimstoneWaifu/Abaddon.cs b/Items/BrimstoneWaifu/Abaddon.cs new file mode 100644 index 0000000000..6839d3c1b0 --- /dev/null +++ b/Items/BrimstoneWaifu/Abaddon.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Abaddon.png b/Items/BrimstoneWaifu/Abaddon.png new file mode 100644 index 0000000000..ca24f6874e Binary files /dev/null and b/Items/BrimstoneWaifu/Abaddon.png differ diff --git a/Items/BrimstoneWaifu/Abaddon_Head.png b/Items/BrimstoneWaifu/Abaddon_Head.png new file mode 100644 index 0000000000..4b6e75247b Binary files /dev/null and b/Items/BrimstoneWaifu/Abaddon_Head.png differ diff --git a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs new file mode 100644 index 0000000000..756a43104a --- /dev/null +++ b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs @@ -0,0 +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")); + } + } + } + } +} \ No newline at end of file diff --git a/Items/BrimstoneWaifu/BrimstoneWaifuBag.png b/Items/BrimstoneWaifu/BrimstoneWaifuBag.png new file mode 100644 index 0000000000..8f6d012556 Binary files /dev/null and b/Items/BrimstoneWaifu/BrimstoneWaifuBag.png differ diff --git a/Items/BrimstoneWaifu/CharredIdol.cs b/Items/BrimstoneWaifu/CharredIdol.cs new file mode 100644 index 0000000000..fd9ff6b250 --- /dev/null +++ b/Items/BrimstoneWaifu/CharredIdol.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/BrimstoneWaifu/CharredIdol.png b/Items/BrimstoneWaifu/CharredIdol.png new file mode 100644 index 0000000000..fa72cc99cb Binary files /dev/null and b/Items/BrimstoneWaifu/CharredIdol.png differ diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs new file mode 100644 index 0000000000..03cee30964 --- /dev/null +++ b/Items/BrimstoneWaifu/Gehenna.cs @@ -0,0 +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; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/BrimstoneWaifu/Gehenna.png b/Items/BrimstoneWaifu/Gehenna.png new file mode 100644 index 0000000000..d40c246f8c Binary files /dev/null and b/Items/BrimstoneWaifu/Gehenna.png differ diff --git a/Items/BrimstoneWaifu/RoseStone.cs b/Items/BrimstoneWaifu/RoseStone.cs new file mode 100644 index 0000000000..14ef9a6b9f --- /dev/null +++ b/Items/BrimstoneWaifu/RoseStone.cs @@ -0,0 +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); + } + } + } + } +} diff --git a/Items/BrimstoneWaifu/RoseStone.png b/Items/BrimstoneWaifu/RoseStone.png new file mode 100644 index 0000000000..e9c3023762 Binary files /dev/null and b/Items/BrimstoneWaifu/RoseStone.png differ diff --git a/Items/BulbofDoom.cs b/Items/BulbofDoom.cs new file mode 100644 index 0000000000..6cf183aa39 --- /dev/null +++ b/Items/BulbofDoom.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/BulbofDoom.png b/Items/BulbofDoom.png new file mode 100644 index 0000000000..561f824b4f Binary files /dev/null and b/Items/BulbofDoom.png differ diff --git a/Items/Bumblefuck/BirbPheromones.cs b/Items/Bumblefuck/BirbPheromones.cs new file mode 100644 index 0000000000..27796e0bfa --- /dev/null +++ b/Items/Bumblefuck/BirbPheromones.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Bumblefuck +{ + public class BirbPheromones : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Birb Pheromones"); + Tooltip.SetDefault("Attracts the bumbling birb"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 10; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Bumblefuck")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 3); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Bumblefuck/BirbPheromones.png b/Items/Bumblefuck/BirbPheromones.png new file mode 100644 index 0000000000..5aad15004d Binary files /dev/null and b/Items/Bumblefuck/BirbPheromones.png differ diff --git a/Items/Bumblefuck/BumblebirbBag.cs b/Items/Bumblefuck/BumblebirbBag.cs new file mode 100644 index 0000000000..5ca8fc008c --- /dev/null +++ b/Items/Bumblefuck/BumblebirbBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/Bumblefuck/BumblebirbBag.png b/Items/Bumblefuck/BumblebirbBag.png new file mode 100644 index 0000000000..58e88f3e17 Binary files /dev/null and b/Items/Bumblefuck/BumblebirbBag.png differ diff --git a/Items/Bumblefuck/EffulgentFeather.cs b/Items/Bumblefuck/EffulgentFeather.cs new file mode 100644 index 0000000000..6c024ed90e --- /dev/null +++ b/Items/Bumblefuck/EffulgentFeather.cs @@ -0,0 +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); + } + } + } +}} \ No newline at end of file diff --git a/Items/Bumblefuck/EffulgentFeather.png b/Items/Bumblefuck/EffulgentFeather.png new file mode 100644 index 0000000000..ba8e7f88dc Binary files /dev/null and b/Items/Bumblefuck/EffulgentFeather.png differ diff --git a/Items/CadencePotion.cs b/Items/CadencePotion.cs new file mode 100644 index 0000000000..6bf49b87d5 --- /dev/null +++ b/Items/CadencePotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/CadencePotion.png b/Items/CadencePotion.png new file mode 100644 index 0000000000..fe7763574b Binary files /dev/null and b/Items/CadencePotion.png differ diff --git a/Items/Calamitas/BlightedEyeball.cs b/Items/Calamitas/BlightedEyeball.cs new file mode 100644 index 0000000000..8a9ec57a04 --- /dev/null +++ b/Items/Calamitas/BlightedEyeball.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Calamitas/BlightedEyeball.png b/Items/Calamitas/BlightedEyeball.png new file mode 100644 index 0000000000..4c9f5f4bd7 Binary files /dev/null and b/Items/Calamitas/BlightedEyeball.png differ diff --git a/Items/Calamitas/CalamitasBag.cs b/Items/Calamitas/CalamitasBag.cs new file mode 100644 index 0000000000..33a7df9dc3 --- /dev/null +++ b/Items/Calamitas/CalamitasBag.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Items/Calamitas/CalamitasBag.png b/Items/Calamitas/CalamitasBag.png new file mode 100644 index 0000000000..b41a82cfc3 Binary files /dev/null and b/Items/Calamitas/CalamitasBag.png differ diff --git a/Items/Calamitas/CalamityDust.cs b/Items/Calamitas/CalamityDust.cs new file mode 100644 index 0000000000..8ce6901df2 --- /dev/null +++ b/Items/Calamitas/CalamityDust.cs @@ -0,0 +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.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/CalamityDust.png b/Items/Calamitas/CalamityDust.png new file mode 100644 index 0000000000..74b83459a5 Binary files /dev/null and b/Items/Calamitas/CalamityDust.png differ diff --git a/Items/Calamitas/CalamityRing.cs b/Items/Calamitas/CalamityRing.cs new file mode 100644 index 0000000000..df066abed9 --- /dev/null +++ b/Items/Calamitas/CalamityRing.cs @@ -0,0 +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; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/Calamitas/CalamityRing.png b/Items/Calamitas/CalamityRing.png new file mode 100644 index 0000000000..3f939973d3 Binary files /dev/null and b/Items/Calamitas/CalamityRing.png differ diff --git a/Items/Calamitas/ChaosStone.cs b/Items/Calamitas/ChaosStone.cs new file mode 100644 index 0000000000..97dd973615 --- /dev/null +++ b/Items/Calamitas/ChaosStone.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Calamitas/ChaosStone.png b/Items/Calamitas/ChaosStone.png new file mode 100644 index 0000000000..217c6bdadb Binary files /dev/null and b/Items/Calamitas/ChaosStone.png differ diff --git a/Items/CalamitasBrew.cs b/Items/CalamitasBrew.cs new file mode 100644 index 0000000000..c34729f4b2 --- /dev/null +++ b/Items/CalamitasBrew.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/CalamitasBrew.png b/Items/CalamitasBrew.png new file mode 100644 index 0000000000..45c4fbce88 Binary files /dev/null and b/Items/CalamitasBrew.png differ diff --git a/Items/CalamitousEssence.cs b/Items/CalamitousEssence.cs new file mode 100644 index 0000000000..0aedb61677 --- /dev/null +++ b/Items/CalamitousEssence.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/CalamitousEssence.png b/Items/CalamitousEssence.png new file mode 100644 index 0000000000..478348014d Binary files /dev/null and b/Items/CalamitousEssence.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs new file mode 100644 index 0000000000..cd58f4a809 --- /dev/null +++ b/Items/CalamityGlobalItem.cs @@ -0,0 +1,268 @@ +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; + } + } + } +} diff --git a/Items/ChaoswarpedSlashaxe.cs b/Items/ChaoswarpedSlashaxe.cs new file mode 100644 index 0000000000..9b7fb82109 --- /dev/null +++ b/Items/ChaoswarpedSlashaxe.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/ChaoswarpedSlashaxe.png b/Items/ChaoswarpedSlashaxe.png new file mode 100644 index 0000000000..d1a24fcf59 Binary files /dev/null and b/Items/ChaoswarpedSlashaxe.png differ diff --git a/Items/CharredRelic.cs b/Items/CharredRelic.cs new file mode 100644 index 0000000000..aeecae70cd --- /dev/null +++ b/Items/CharredRelic.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/CharredRelic.png b/Items/CharredRelic.png new file mode 100644 index 0000000000..2a6f082959 Binary files /dev/null and b/Items/CharredRelic.png differ diff --git a/Items/CometShard.cs b/Items/CometShard.cs new file mode 100644 index 0000000000..64933e18fc --- /dev/null +++ b/Items/CometShard.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class CometShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet Shard"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.cShard) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.cShard = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddIngredient(null, "Stardust", 150); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/CometShard.png b/Items/CometShard.png new file mode 100644 index 0000000000..08643ddbc0 Binary files /dev/null and b/Items/CometShard.png differ diff --git a/Items/CoreofCalamity.cs b/Items/CoreofCalamity.cs new file mode 100644 index 0000000000..3acdfdd08e --- /dev/null +++ b/Items/CoreofCalamity.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/CoreofCalamity.png b/Items/CoreofCalamity.png new file mode 100644 index 0000000000..7059397125 Binary files /dev/null and b/Items/CoreofCalamity.png differ diff --git a/Items/CoreofChaos.cs b/Items/CoreofChaos.cs new file mode 100644 index 0000000000..7fdf1ec804 --- /dev/null +++ b/Items/CoreofChaos.cs @@ -0,0 +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(); + } +}} \ No newline at end of file diff --git a/Items/CoreofChaos.png b/Items/CoreofChaos.png new file mode 100644 index 0000000000..8a8c22e1e7 Binary files /dev/null and b/Items/CoreofChaos.png differ diff --git a/Items/CoreofCinder.cs b/Items/CoreofCinder.cs new file mode 100644 index 0000000000..ca03d3ff30 --- /dev/null +++ b/Items/CoreofCinder.cs @@ -0,0 +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(); + } +}} \ No newline at end of file diff --git a/Items/CoreofCinder.png b/Items/CoreofCinder.png new file mode 100644 index 0000000000..75db717209 Binary files /dev/null and b/Items/CoreofCinder.png differ diff --git a/Items/CoreofEleum.cs b/Items/CoreofEleum.cs new file mode 100644 index 0000000000..a85e5b67ea --- /dev/null +++ b/Items/CoreofEleum.cs @@ -0,0 +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(); + } +}} \ No newline at end of file diff --git a/Items/CoreofEleum.png b/Items/CoreofEleum.png new file mode 100644 index 0000000000..2946529c2c Binary files /dev/null and b/Items/CoreofEleum.png differ diff --git a/Items/CosmicPlushie.cs b/Items/CosmicPlushie.cs new file mode 100644 index 0000000000..a7920fbae4 --- /dev/null +++ b/Items/CosmicPlushie.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/CosmicPlushie.png b/Items/CosmicPlushie.png new file mode 100644 index 0000000000..b6d17860be Binary files /dev/null and b/Items/CosmicPlushie.png differ diff --git a/Items/Cosmolight.cs b/Items/Cosmolight.cs new file mode 100644 index 0000000000..bfea1334a7 --- /dev/null +++ b/Items/Cosmolight.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Cosmolight.png b/Items/Cosmolight.png new file mode 100644 index 0000000000..3f1e46b678 Binary files /dev/null and b/Items/Cosmolight.png differ diff --git a/Items/Crabulon/CrabulonBag.cs b/Items/Crabulon/CrabulonBag.cs new file mode 100644 index 0000000000..82c7a41ec0 --- /dev/null +++ b/Items/Crabulon/CrabulonBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/Crabulon/CrabulonBag.png b/Items/Crabulon/CrabulonBag.png new file mode 100644 index 0000000000..fcf379f9b8 Binary files /dev/null and b/Items/Crabulon/CrabulonBag.png differ diff --git a/Items/Crabulon/DecapoditaSprout.cs b/Items/Crabulon/DecapoditaSprout.cs new file mode 100644 index 0000000000..c867339bb4 --- /dev/null +++ b/Items/Crabulon/DecapoditaSprout.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Crabulon/DecapoditaSprout.png b/Items/Crabulon/DecapoditaSprout.png new file mode 100644 index 0000000000..0915fab5fd Binary files /dev/null and b/Items/Crabulon/DecapoditaSprout.png differ diff --git a/Items/Crabulon/FungalClump.cs b/Items/Crabulon/FungalClump.cs new file mode 100644 index 0000000000..ec5b68c20f --- /dev/null +++ b/Items/Crabulon/FungalClump.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Crabulon/FungalClump.png b/Items/Crabulon/FungalClump.png new file mode 100644 index 0000000000..6a150e9a15 Binary files /dev/null and b/Items/Crabulon/FungalClump.png differ diff --git a/Items/CruptixBar.cs b/Items/CruptixBar.cs new file mode 100644 index 0000000000..20e69415ce --- /dev/null +++ b/Items/CruptixBar.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/CruptixBar.png b/Items/CruptixBar.png new file mode 100644 index 0000000000..28ecb825d7 Binary files /dev/null and b/Items/CruptixBar.png differ diff --git a/Items/Cryogen/CryoBar.cs b/Items/Cryogen/CryoBar.cs new file mode 100644 index 0000000000..53c1d45865 --- /dev/null +++ b/Items/Cryogen/CryoBar.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Cryogen/CryoBar.png b/Items/Cryogen/CryoBar.png new file mode 100644 index 0000000000..c5ca9a3c1d Binary files /dev/null and b/Items/Cryogen/CryoBar.png differ diff --git a/Items/Cryogen/CryoKey.cs b/Items/Cryogen/CryoKey.cs new file mode 100644 index 0000000000..4fd00a7fb3 --- /dev/null +++ b/Items/Cryogen/CryoKey.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Cryogen/CryoKey.png b/Items/Cryogen/CryoKey.png new file mode 100644 index 0000000000..c92ac1e684 Binary files /dev/null and b/Items/Cryogen/CryoKey.png differ diff --git a/Items/Cryogen/CryoStone.cs b/Items/Cryogen/CryoStone.cs new file mode 100644 index 0000000000..0ace91cfb6 --- /dev/null +++ b/Items/Cryogen/CryoStone.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Cryogen/CryoStone.png b/Items/Cryogen/CryoStone.png new file mode 100644 index 0000000000..996686a0cb Binary files /dev/null and b/Items/Cryogen/CryoStone.png differ diff --git a/Items/Cryogen/CryogenBag.cs b/Items/Cryogen/CryogenBag.cs new file mode 100644 index 0000000000..b4fd3647c8 --- /dev/null +++ b/Items/Cryogen/CryogenBag.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/Cryogen/CryogenBag.png b/Items/Cryogen/CryogenBag.png new file mode 100644 index 0000000000..fce610a0a5 Binary files /dev/null and b/Items/Cryogen/CryogenBag.png differ diff --git a/Items/Cryogen/SoulofCryogen.cs b/Items/Cryogen/SoulofCryogen.cs new file mode 100644 index 0000000000..bd23e21d6f --- /dev/null +++ b/Items/Cryogen/SoulofCryogen.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Cryogen/SoulofCryogen.png b/Items/Cryogen/SoulofCryogen.png new file mode 100644 index 0000000000..712c79d439 Binary files /dev/null and b/Items/Cryogen/SoulofCryogen.png differ diff --git a/Items/Cryogen/SoulofCryogen_Wings.png b/Items/Cryogen/SoulofCryogen_Wings.png new file mode 100644 index 0000000000..1b813281fc Binary files /dev/null and b/Items/Cryogen/SoulofCryogen_Wings.png differ diff --git a/Items/CrystylCrusher.cs b/Items/CrystylCrusher.cs new file mode 100644 index 0000000000..c69c032f4d --- /dev/null +++ b/Items/CrystylCrusher.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/CrystylCrusher.png b/Items/CrystylCrusher.png new file mode 100644 index 0000000000..69e3328db4 Binary files /dev/null and b/Items/CrystylCrusher.png differ diff --git a/Items/DarksunFragment.cs b/Items/DarksunFragment.cs new file mode 100644 index 0000000000..efe371c194 --- /dev/null +++ b/Items/DarksunFragment.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.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/DarksunFragment.png b/Items/DarksunFragment.png new file mode 100644 index 0000000000..4166bc4a94 Binary files /dev/null and b/Items/DarksunFragment.png differ diff --git a/Items/Daylight.cs b/Items/Daylight.cs new file mode 100644 index 0000000000..5be1c149d7 --- /dev/null +++ b/Items/Daylight.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Daylight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daylight"); + Tooltip.SetDefault("Summons the sun"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } + + public override bool UseItem(Player player) + { + Main.dayTime = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofLight, 7); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Daylight.png b/Items/Daylight.png new file mode 100644 index 0000000000..7889c347a1 Binary files /dev/null and b/Items/Daylight.png differ diff --git a/Items/Death.cs b/Items/Death.cs new file mode 100644 index 0000000000..37d7a4ce81 --- /dev/null +++ b/Items/Death.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Death.png b/Items/Death.png new file mode 100644 index 0000000000..1f2977cc99 Binary files /dev/null and b/Items/Death.png differ diff --git a/Items/DefiledRune.cs b/Items/DefiledRune.cs new file mode 100644 index 0000000000..6e6ef50f76 --- /dev/null +++ b/Items/DefiledRune.cs @@ -0,0 +1,86 @@ +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; + } + } +} \ No newline at end of file diff --git a/Items/DefiledRune.png b/Items/DefiledRune.png new file mode 100644 index 0000000000..57f505d468 Binary files /dev/null and b/Items/DefiledRune.png differ diff --git a/Items/DemonicBoneAsh.cs b/Items/DemonicBoneAsh.cs new file mode 100644 index 0000000000..d3f943d7ae --- /dev/null +++ b/Items/DemonicBoneAsh.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/DemonicBoneAsh.png b/Items/DemonicBoneAsh.png new file mode 100644 index 0000000000..443bd79461 Binary files /dev/null and b/Items/DemonicBoneAsh.png differ diff --git a/Items/DesertFeather.cs b/Items/DesertFeather.cs new file mode 100644 index 0000000000..e68e09cd49 --- /dev/null +++ b/Items/DesertFeather.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/DesertFeather.png b/Items/DesertFeather.png new file mode 100644 index 0000000000..e2495cde51 Binary files /dev/null and b/Items/DesertFeather.png differ diff --git a/Items/DesertScourge/AeroStone.cs b/Items/DesertScourge/AeroStone.cs new file mode 100644 index 0000000000..e0a0507a68 --- /dev/null +++ b/Items/DesertScourge/AeroStone.cs @@ -0,0 +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; + } + } +} diff --git a/Items/DesertScourge/AeroStone.png b/Items/DesertScourge/AeroStone.png new file mode 100644 index 0000000000..90940f54ed Binary files /dev/null and b/Items/DesertScourge/AeroStone.png differ diff --git a/Items/DesertScourge/DesertScourgeBag.cs b/Items/DesertScourge/DesertScourgeBag.cs new file mode 100644 index 0000000000..91eb31f13d --- /dev/null +++ b/Items/DesertScourge/DesertScourgeBag.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Items/DesertScourge/DesertScourgeBag.png b/Items/DesertScourge/DesertScourgeBag.png new file mode 100644 index 0000000000..a9c824361c Binary files /dev/null and b/Items/DesertScourge/DesertScourgeBag.png differ diff --git a/Items/DesertScourge/DriedSeafood.cs b/Items/DesertScourge/DriedSeafood.cs new file mode 100644 index 0000000000..41230915b7 --- /dev/null +++ b/Items/DesertScourge/DriedSeafood.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/DesertScourge/DriedSeafood.png b/Items/DesertScourge/DriedSeafood.png new file mode 100644 index 0000000000..3a2c76cd5e Binary files /dev/null and b/Items/DesertScourge/DriedSeafood.png differ diff --git a/Items/DesertScourge/OceanCrest.cs b/Items/DesertScourge/OceanCrest.cs new file mode 100644 index 0000000000..5a3cf16c89 --- /dev/null +++ b/Items/DesertScourge/OceanCrest.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/OceanCrest.png b/Items/DesertScourge/OceanCrest.png new file mode 100644 index 0000000000..066591297d Binary files /dev/null and b/Items/DesertScourge/OceanCrest.png differ diff --git a/Items/DesertScourge/VictoryShard.cs b/Items/DesertScourge/VictoryShard.cs new file mode 100644 index 0000000000..80de2d7d0b --- /dev/null +++ b/Items/DesertScourge/VictoryShard.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/DesertScourge/VictoryShard.png b/Items/DesertScourge/VictoryShard.png new file mode 100644 index 0000000000..2494cc399a Binary files /dev/null and b/Items/DesertScourge/VictoryShard.png differ diff --git a/Items/DevourerMunsters/ArmoredShell.cs b/Items/DevourerMunsters/ArmoredShell.cs new file mode 100644 index 0000000000..950dfaf828 --- /dev/null +++ b/Items/DevourerMunsters/ArmoredShell.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ArmoredShell.png b/Items/DevourerMunsters/ArmoredShell.png new file mode 100644 index 0000000000..0ccc8967b3 Binary files /dev/null and b/Items/DevourerMunsters/ArmoredShell.png differ diff --git a/Items/DevourerMunsters/DarkPlasma.cs b/Items/DevourerMunsters/DarkPlasma.cs new file mode 100644 index 0000000000..99ad63971f --- /dev/null +++ b/Items/DevourerMunsters/DarkPlasma.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/DevourerMunsters/DarkPlasma.png b/Items/DevourerMunsters/DarkPlasma.png new file mode 100644 index 0000000000..8afb7c0d43 Binary files /dev/null and b/Items/DevourerMunsters/DarkPlasma.png differ diff --git a/Items/DevourerMunsters/RuneofCos.cs b/Items/DevourerMunsters/RuneofCos.cs new file mode 100644 index 0000000000..d632c0927c --- /dev/null +++ b/Items/DevourerMunsters/RuneofCos.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/DevourerMunsters/RuneofCos.png b/Items/DevourerMunsters/RuneofCos.png new file mode 100644 index 0000000000..7d64693e1b Binary files /dev/null and b/Items/DevourerMunsters/RuneofCos.png differ diff --git a/Items/DevourerMunsters/TwistingNether.cs b/Items/DevourerMunsters/TwistingNether.cs new file mode 100644 index 0000000000..3593773858 --- /dev/null +++ b/Items/DevourerMunsters/TwistingNether.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DevourerMunsters/TwistingNether.png b/Items/DevourerMunsters/TwistingNether.png new file mode 100644 index 0000000000..1ceb17a60e Binary files /dev/null and b/Items/DevourerMunsters/TwistingNether.png differ diff --git a/Items/DimensionalSoulArtifact.cs b/Items/DimensionalSoulArtifact.cs new file mode 100644 index 0000000000..58b352b162 --- /dev/null +++ b/Items/DimensionalSoulArtifact.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/DimensionalSoulArtifact.png b/Items/DimensionalSoulArtifact.png new file mode 100644 index 0000000000..ea2c011444 Binary files /dev/null and b/Items/DimensionalSoulArtifact.png differ diff --git a/Items/DraedonBar.cs b/Items/DraedonBar.cs new file mode 100644 index 0000000000..9edc9c7e3e --- /dev/null +++ b/Items/DraedonBar.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/DraedonBar.png b/Items/DraedonBar.png new file mode 100644 index 0000000000..d52629e174 Binary files /dev/null and b/Items/DraedonBar.png differ diff --git a/Items/DraedonsRemote.cs b/Items/DraedonsRemote.cs new file mode 100644 index 0000000000..20672b3877 --- /dev/null +++ b/Items/DraedonsRemote.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/DraedonsRemote.png b/Items/DraedonsRemote.png new file mode 100644 index 0000000000..85bf33a230 Binary files /dev/null and b/Items/DraedonsRemote.png differ diff --git a/Items/Dragonfruit.cs b/Items/Dragonfruit.cs new file mode 100644 index 0000000000..d887b89910 --- /dev/null +++ b/Items/Dragonfruit.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Dragonfruit.png b/Items/Dragonfruit.png new file mode 100644 index 0000000000..0040545e75 Binary files /dev/null and b/Items/Dragonfruit.png differ diff --git a/Items/EbonianGel.cs b/Items/EbonianGel.cs new file mode 100644 index 0000000000..9e3dcadc4c --- /dev/null +++ b/Items/EbonianGel.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/EbonianGel.png b/Items/EbonianGel.png new file mode 100644 index 0000000000..8dee0f7737 Binary files /dev/null and b/Items/EbonianGel.png differ diff --git a/Items/Ectoblood.cs b/Items/Ectoblood.cs new file mode 100644 index 0000000000..9e813b1b6b --- /dev/null +++ b/Items/Ectoblood.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Ectoblood.png b/Items/Ectoblood.png new file mode 100644 index 0000000000..cabab923fb Binary files /dev/null and b/Items/Ectoblood.png differ diff --git a/Items/Ectoheart.cs b/Items/Ectoheart.cs new file mode 100644 index 0000000000..d118720ecf --- /dev/null +++ b/Items/Ectoheart.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Ectoheart.png b/Items/Ectoheart.png new file mode 100644 index 0000000000..e501a96419 Binary files /dev/null and b/Items/Ectoheart.png differ diff --git a/Items/EidolonTablet.cs b/Items/EidolonTablet.cs new file mode 100644 index 0000000000..b48a5271bc --- /dev/null +++ b/Items/EidolonTablet.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/EidolonTablet.png b/Items/EidolonTablet.png new file mode 100644 index 0000000000..4383b9ec72 Binary files /dev/null and b/Items/EidolonTablet.png differ diff --git a/Items/Elderberry.cs b/Items/Elderberry.cs new file mode 100644 index 0000000000..bc329e1add --- /dev/null +++ b/Items/Elderberry.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Elderberry : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elderberry"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.eBerry || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eBerry = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "UeliaceBar", 10); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(null, "UnholyEssence", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Elderberry.png b/Items/Elderberry.png new file mode 100644 index 0000000000..4014076ac5 Binary files /dev/null and b/Items/Elderberry.png differ diff --git a/Items/EldritchSoulArtifact.cs b/Items/EldritchSoulArtifact.cs new file mode 100644 index 0000000000..70fd7d897c --- /dev/null +++ b/Items/EldritchSoulArtifact.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/EldritchSoulArtifact.png b/Items/EldritchSoulArtifact.png new file mode 100644 index 0000000000..0fc8022c9d Binary files /dev/null and b/Items/EldritchSoulArtifact.png differ diff --git a/Items/ElectrolyteGelPack.cs b/Items/ElectrolyteGelPack.cs new file mode 100644 index 0000000000..aca289ec1b --- /dev/null +++ b/Items/ElectrolyteGelPack.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class ElectrolyteGelPack : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electrolyte Gel Pack"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 4; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.adrenalineBoostOne) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.adrenalineBoostOne = true; + } + return true; + } + } +} \ No newline at end of file diff --git a/Items/ElectrolyteGelPack.png b/Items/ElectrolyteGelPack.png new file mode 100644 index 0000000000..3a24a05948 Binary files /dev/null and b/Items/ElectrolyteGelPack.png differ diff --git a/Items/EndothermicEnergy.cs b/Items/EndothermicEnergy.cs new file mode 100644 index 0000000000..2ffc65f8a0 --- /dev/null +++ b/Items/EndothermicEnergy.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.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/EndothermicEnergy.png b/Items/EndothermicEnergy.png new file mode 100644 index 0000000000..2bd4629779 Binary files /dev/null and b/Items/EndothermicEnergy.png differ diff --git a/Items/EssenceofChaos.cs b/Items/EssenceofChaos.cs new file mode 100644 index 0000000000..c6a15ea39d --- /dev/null +++ b/Items/EssenceofChaos.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +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/EssenceofChaos.png b/Items/EssenceofChaos.png new file mode 100644 index 0000000000..11769b92d3 Binary files /dev/null and b/Items/EssenceofChaos.png differ diff --git a/Items/EssenceofCinder.cs b/Items/EssenceofCinder.cs new file mode 100644 index 0000000000..718ee806a6 --- /dev/null +++ b/Items/EssenceofCinder.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +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/EssenceofCinder.png b/Items/EssenceofCinder.png new file mode 100644 index 0000000000..284db040ae Binary files /dev/null and b/Items/EssenceofCinder.png differ diff --git a/Items/EssenceofEleum.cs b/Items/EssenceofEleum.cs new file mode 100644 index 0000000000..d340d97b53 --- /dev/null +++ b/Items/EssenceofEleum.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.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/EssenceofEleum.png b/Items/EssenceofEleum.png new file mode 100644 index 0000000000..7d304ee8a8 Binary files /dev/null and b/Items/EssenceofEleum.png differ diff --git a/Items/EtherealCore.cs b/Items/EtherealCore.cs new file mode 100644 index 0000000000..26711afc63 --- /dev/null +++ b/Items/EtherealCore.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class EtherealCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ethereal Core"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.eCore) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eCore = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddIngredient(null, "AstralBar", 25); + recipe.AddIngredient(ItemID.FragmentNebula, 20); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/EtherealCore.png b/Items/EtherealCore.png new file mode 100644 index 0000000000..31e343aac5 Binary files /dev/null and b/Items/EtherealCore.png differ diff --git a/Items/Fabsol.cs b/Items/Fabsol.cs new file mode 100644 index 0000000000..745b6e16db --- /dev/null +++ b/Items/Fabsol.cs @@ -0,0 +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"); + } + } +} diff --git a/Items/Fabsol.png b/Items/Fabsol.png new file mode 100644 index 0000000000..485a6245d0 Binary files /dev/null and b/Items/Fabsol.png differ diff --git a/Items/FabsolsVodka.cs b/Items/FabsolsVodka.cs new file mode 100644 index 0000000000..04289697ec --- /dev/null +++ b/Items/FabsolsVodka.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + 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 = 10000; + } + + 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/FabsolsVodka.png b/Items/FabsolsVodka.png new file mode 100644 index 0000000000..e7658efa01 Binary files /dev/null and b/Items/FabsolsVodka.png differ diff --git a/Items/FetidEssence.cs b/Items/FetidEssence.cs new file mode 100644 index 0000000000..f5a1a392e9 --- /dev/null +++ b/Items/FetidEssence.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/FetidEssence.png b/Items/FetidEssence.png new file mode 100644 index 0000000000..b809905a44 Binary files /dev/null and b/Items/FetidEssence.png differ diff --git a/Items/FlamebeakHampick.cs b/Items/FlamebeakHampick.cs new file mode 100644 index 0000000000..39207c4259 --- /dev/null +++ b/Items/FlamebeakHampick.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/FlamebeakHampick.png b/Items/FlamebeakHampick.png new file mode 100644 index 0000000000..eca12bd743 Binary files /dev/null and b/Items/FlamebeakHampick.png differ diff --git a/Items/FoxDrive.cs b/Items/FoxDrive.cs new file mode 100644 index 0000000000..8302e39dc6 --- /dev/null +++ b/Items/FoxDrive.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/FoxDrive.png b/Items/FoxDrive.png new file mode 100644 index 0000000000..fd660431cb Binary files /dev/null and b/Items/FoxDrive.png differ diff --git a/Items/GalacticaSingularity.cs b/Items/GalacticaSingularity.cs new file mode 100644 index 0000000000..5f542a1447 --- /dev/null +++ b/Items/GalacticaSingularity.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/GalacticaSingularity.png b/Items/GalacticaSingularity.png new file mode 100644 index 0000000000..6eead90363 Binary files /dev/null and b/Items/GalacticaSingularity.png differ diff --git a/Items/GallantPickaxe.cs b/Items/GallantPickaxe.cs new file mode 100644 index 0000000000..f78d7bd87d --- /dev/null +++ b/Items/GallantPickaxe.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/GallantPickaxe.png b/Items/GallantPickaxe.png new file mode 100644 index 0000000000..c61cc5f0ab Binary files /dev/null and b/Items/GallantPickaxe.png differ diff --git a/Items/Gelpick.cs b/Items/Gelpick.cs new file mode 100644 index 0000000000..b412a82004 --- /dev/null +++ b/Items/Gelpick.cs @@ -0,0 +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); + } +}} \ No newline at end of file diff --git a/Items/Gelpick.png b/Items/Gelpick.png new file mode 100644 index 0000000000..44160277c8 Binary files /dev/null and b/Items/Gelpick.png differ diff --git a/Items/GodlySoulArtifact.cs b/Items/GodlySoulArtifact.cs new file mode 100644 index 0000000000..7caf45f75b --- /dev/null +++ b/Items/GodlySoulArtifact.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/GodlySoulArtifact.png b/Items/GodlySoulArtifact.png new file mode 100644 index 0000000000..2dafa3936f Binary files /dev/null and b/Items/GodlySoulArtifact.png differ diff --git a/Items/GreatSandShark/GrandScale.cs b/Items/GreatSandShark/GrandScale.cs new file mode 100644 index 0000000000..9e3c887042 --- /dev/null +++ b/Items/GreatSandShark/GrandScale.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/GreatSandShark/GrandScale.png b/Items/GreatSandShark/GrandScale.png new file mode 100644 index 0000000000..d88d52f878 Binary files /dev/null and b/Items/GreatSandShark/GrandScale.png differ diff --git a/Items/GreatSandShark/SandstormsCore.cs b/Items/GreatSandShark/SandstormsCore.cs new file mode 100644 index 0000000000..262bac2d3c --- /dev/null +++ b/Items/GreatSandShark/SandstormsCore.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/GreatSandShark/SandstormsCore.png b/Items/GreatSandShark/SandstormsCore.png new file mode 100644 index 0000000000..9948f068ad Binary files /dev/null and b/Items/GreatSandShark/SandstormsCore.png differ diff --git a/Items/GreatbayPickaxe.cs b/Items/GreatbayPickaxe.cs new file mode 100644 index 0000000000..33909a867c --- /dev/null +++ b/Items/GreatbayPickaxe.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/GreatbayPickaxe.png b/Items/GreatbayPickaxe.png new file mode 100644 index 0000000000..c8d1b9beb6 Binary files /dev/null and b/Items/GreatbayPickaxe.png differ diff --git a/Items/GypsyPowder.cs b/Items/GypsyPowder.cs new file mode 100644 index 0000000000..80b657fe2e --- /dev/null +++ b/Items/GypsyPowder.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/GypsyPowder.png b/Items/GypsyPowder.png new file mode 100644 index 0000000000..227736b310 Binary files /dev/null and b/Items/GypsyPowder.png differ diff --git a/Items/HiveMind/HiveMindBag.cs b/Items/HiveMind/HiveMindBag.cs new file mode 100644 index 0000000000..10e5f63454 --- /dev/null +++ b/Items/HiveMind/HiveMindBag.cs @@ -0,0 +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)); + } + } + } +} \ No newline at end of file diff --git a/Items/HiveMind/HiveMindBag.png b/Items/HiveMind/HiveMindBag.png new file mode 100644 index 0000000000..9da2e50098 Binary files /dev/null and b/Items/HiveMind/HiveMindBag.png differ diff --git a/Items/HiveMind/RottenBrain.cs b/Items/HiveMind/RottenBrain.cs new file mode 100644 index 0000000000..89da591e37 --- /dev/null +++ b/Items/HiveMind/RottenBrain.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/HiveMind/RottenBrain.png b/Items/HiveMind/RottenBrain.png new file mode 100644 index 0000000000..d13f858da3 Binary files /dev/null and b/Items/HiveMind/RottenBrain.png differ diff --git a/Items/HiveMind/Teratoma.cs b/Items/HiveMind/Teratoma.cs new file mode 100644 index 0000000000..81d49c0b8d --- /dev/null +++ b/Items/HiveMind/Teratoma.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.HiveMind +{ + public class Teratoma : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Teratoma"); + Tooltip.SetDefault("Summons the Hive Mind"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneCorrupt && !NPC.AnyNPCs(mod.NPCType("HiveMind")) && !NPC.AnyNPCs(mod.NPCType("HiveMindP2")); + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 100))), (int)(player.position.Y - 150f), mod.NPCType("HiveMind"), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(SoundID.Roar, player.position, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 9); + recipe.AddIngredient(null, "TrueShadowScale", 5); + recipe.AddIngredient(ItemID.DemoniteBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/HiveMind/Teratoma.png b/Items/HiveMind/Teratoma.png new file mode 100644 index 0000000000..863efaaa12 Binary files /dev/null and b/Items/HiveMind/Teratoma.png differ diff --git a/Items/HiveMind/TrueShadowScale.cs b/Items/HiveMind/TrueShadowScale.cs new file mode 100644 index 0000000000..2c3ceb0dec --- /dev/null +++ b/Items/HiveMind/TrueShadowScale.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/HiveMind/TrueShadowScale.png b/Items/HiveMind/TrueShadowScale.png new file mode 100644 index 0000000000..a7605c3c1e Binary files /dev/null and b/Items/HiveMind/TrueShadowScale.png differ diff --git a/Items/InfernalBlood.cs b/Items/InfernalBlood.cs new file mode 100644 index 0000000000..5863178e30 --- /dev/null +++ b/Items/InfernalBlood.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/InfernalBlood.png b/Items/InfernalBlood.png new file mode 100644 index 0000000000..637ce0619b Binary files /dev/null and b/Items/InfernalBlood.png differ diff --git a/Items/IronHeart.cs b/Items/IronHeart.cs new file mode 100644 index 0000000000..0cd80826ba --- /dev/null +++ b/Items/IronHeart.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/IronHeart.png b/Items/IronHeart.png new file mode 100644 index 0000000000..ceff5f27ed Binary files /dev/null and b/Items/IronHeart.png differ diff --git a/Items/Knowledge.cs b/Items/Knowledge.cs new file mode 100644 index 0000000000..766b5207ad --- /dev/null +++ b/Items/Knowledge.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge.png b/Items/Knowledge.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge.png differ diff --git a/Items/Knowledge10.cs b/Items/Knowledge10.cs new file mode 100644 index 0000000000..f22285f4e7 --- /dev/null +++ b/Items/Knowledge10.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge10 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ocean"); + Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + + "You may awaken something more terrifying than death itself."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge10.png b/Items/Knowledge10.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge10.png differ diff --git a/Items/Knowledge11.cs b/Items/Knowledge11.cs new file mode 100644 index 0000000000..a0c535801e --- /dev/null +++ b/Items/Knowledge11.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge11.png b/Items/Knowledge11.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge11.png differ diff --git a/Items/Knowledge12.cs b/Items/Knowledge12.cs new file mode 100644 index 0000000000..79c9a559f4 --- /dev/null +++ b/Items/Knowledge12.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge12.png b/Items/Knowledge12.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge12.png differ diff --git a/Items/Knowledge13.cs b/Items/Knowledge13.cs new file mode 100644 index 0000000000..df5d04b388 --- /dev/null +++ b/Items/Knowledge13.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge13.png b/Items/Knowledge13.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge13.png differ diff --git a/Items/Knowledge14.cs b/Items/Knowledge14.cs new file mode 100644 index 0000000000..fa983d3bc4 --- /dev/null +++ b/Items/Knowledge14.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge14.png b/Items/Knowledge14.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge14.png differ diff --git a/Items/Knowledge15.cs b/Items/Knowledge15.cs new file mode 100644 index 0000000000..0ebe1cb4ac --- /dev/null +++ b/Items/Knowledge15.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge15.png b/Items/Knowledge15.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge15.png differ diff --git a/Items/Knowledge16.cs b/Items/Knowledge16.cs new file mode 100644 index 0000000000..f69c0fccb9 --- /dev/null +++ b/Items/Knowledge16.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge16.png b/Items/Knowledge16.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge16.png differ diff --git a/Items/Knowledge17.cs b/Items/Knowledge17.cs new file mode 100644 index 0000000000..b7a7e6e87a --- /dev/null +++ b/Items/Knowledge17.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge17.png b/Items/Knowledge17.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge17.png differ diff --git a/Items/Knowledge18.cs b/Items/Knowledge18.cs new file mode 100644 index 0000000000..8b5530a2ae --- /dev/null +++ b/Items/Knowledge18.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge18.png b/Items/Knowledge18.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge18.png differ diff --git a/Items/Knowledge19.cs b/Items/Knowledge19.cs new file mode 100644 index 0000000000..1f3936c296 --- /dev/null +++ b/Items/Knowledge19.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge19.png b/Items/Knowledge19.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge19.png differ diff --git a/Items/Knowledge2.cs b/Items/Knowledge2.cs new file mode 100644 index 0000000000..fe55092a5d --- /dev/null +++ b/Items/Knowledge2.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge2.png b/Items/Knowledge2.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge2.png differ diff --git a/Items/Knowledge20.cs b/Items/Knowledge20.cs new file mode 100644 index 0000000000..afd7c5c219 --- /dev/null +++ b/Items/Knowledge20.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge20.png b/Items/Knowledge20.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge20.png differ diff --git a/Items/Knowledge21.cs b/Items/Knowledge21.cs new file mode 100644 index 0000000000..3f3acc2e9b --- /dev/null +++ b/Items/Knowledge21.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge21.png b/Items/Knowledge21.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge21.png differ diff --git a/Items/Knowledge22.cs b/Items/Knowledge22.cs new file mode 100644 index 0000000000..b0a87a716f --- /dev/null +++ b/Items/Knowledge22.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge22.png b/Items/Knowledge22.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge22.png differ diff --git a/Items/Knowledge23.cs b/Items/Knowledge23.cs new file mode 100644 index 0000000000..ab37a93acb --- /dev/null +++ b/Items/Knowledge23.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge23.png b/Items/Knowledge23.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge23.png differ diff --git a/Items/Knowledge24.cs b/Items/Knowledge24.cs new file mode 100644 index 0000000000..85f571d94c --- /dev/null +++ b/Items/Knowledge24.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge24.png b/Items/Knowledge24.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge24.png differ diff --git a/Items/Knowledge25.cs b/Items/Knowledge25.cs new file mode 100644 index 0000000000..44b65f56f3 --- /dev/null +++ b/Items/Knowledge25.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge25.png b/Items/Knowledge25.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge25.png differ diff --git a/Items/Knowledge26.cs b/Items/Knowledge26.cs new file mode 100644 index 0000000000..15ce28e378 --- /dev/null +++ b/Items/Knowledge26.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge26.png b/Items/Knowledge26.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge26.png differ diff --git a/Items/Knowledge27.cs b/Items/Knowledge27.cs new file mode 100644 index 0000000000..ecf2aa16f7 --- /dev/null +++ b/Items/Knowledge27.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge27.png b/Items/Knowledge27.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge27.png differ diff --git a/Items/Knowledge28.cs b/Items/Knowledge28.cs new file mode 100644 index 0000000000..e92d71389b --- /dev/null +++ b/Items/Knowledge28.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge28.png b/Items/Knowledge28.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge28.png differ diff --git a/Items/Knowledge29.cs b/Items/Knowledge29.cs new file mode 100644 index 0000000000..25c370fb6f --- /dev/null +++ b/Items/Knowledge29.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge29.png b/Items/Knowledge29.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge29.png differ diff --git a/Items/Knowledge3.cs b/Items/Knowledge3.cs new file mode 100644 index 0000000000..df6158ab87 --- /dev/null +++ b/Items/Knowledge3.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge3.png b/Items/Knowledge3.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge3.png differ diff --git a/Items/Knowledge30.cs b/Items/Knowledge30.cs new file mode 100644 index 0000000000..cd43c7d0dd --- /dev/null +++ b/Items/Knowledge30.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge30.png b/Items/Knowledge30.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge30.png differ diff --git a/Items/Knowledge31.cs b/Items/Knowledge31.cs new file mode 100644 index 0000000000..f5f93bf965 --- /dev/null +++ b/Items/Knowledge31.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge31.png b/Items/Knowledge31.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge31.png differ diff --git a/Items/Knowledge32.cs b/Items/Knowledge32.cs new file mode 100644 index 0000000000..8f31ed4c8b --- /dev/null +++ b/Items/Knowledge32.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge32.png b/Items/Knowledge32.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge32.png differ diff --git a/Items/Knowledge33.cs b/Items/Knowledge33.cs new file mode 100644 index 0000000000..92672a1035 --- /dev/null +++ b/Items/Knowledge33.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge33.png b/Items/Knowledge33.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge33.png differ diff --git a/Items/Knowledge34.cs b/Items/Knowledge34.cs new file mode 100644 index 0000000000..4c27afd974 --- /dev/null +++ b/Items/Knowledge34.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Knowledge34 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Red Moon"); + Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + + "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge34.png b/Items/Knowledge34.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge34.png differ diff --git a/Items/Knowledge4.cs b/Items/Knowledge4.cs new file mode 100644 index 0000000000..6863531b0a --- /dev/null +++ b/Items/Knowledge4.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge4.png b/Items/Knowledge4.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge4.png differ diff --git a/Items/Knowledge5.cs b/Items/Knowledge5.cs new file mode 100644 index 0000000000..a3d87af99f --- /dev/null +++ b/Items/Knowledge5.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge5.png b/Items/Knowledge5.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge5.png differ diff --git a/Items/Knowledge6.cs b/Items/Knowledge6.cs new file mode 100644 index 0000000000..28dd5f6e63 --- /dev/null +++ b/Items/Knowledge6.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge6.png b/Items/Knowledge6.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/Knowledge6.png differ diff --git a/Items/Knowledge7.cs b/Items/Knowledge7.cs new file mode 100644 index 0000000000..005e21f2d2 --- /dev/null +++ b/Items/Knowledge7.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge7.png b/Items/Knowledge7.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/Knowledge7.png differ diff --git a/Items/Knowledge8.cs b/Items/Knowledge8.cs new file mode 100644 index 0000000000..52779a93cb --- /dev/null +++ b/Items/Knowledge8.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge8.png b/Items/Knowledge8.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/Knowledge8.png differ diff --git a/Items/Knowledge9.cs b/Items/Knowledge9.cs new file mode 100644 index 0000000000..b60d9d8cbf --- /dev/null +++ b/Items/Knowledge9.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + 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/Knowledge9.png b/Items/Knowledge9.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/Knowledge9.png differ diff --git a/Items/LORED/NO.cs b/Items/LORED/NO.cs new file mode 100644 index 0000000000..9ca619a9f0 --- /dev/null +++ b/Items/LORED/NO.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/LORED/NO.png b/Items/LORED/NO.png new file mode 100644 index 0000000000..122440873e Binary files /dev/null and b/Items/LORED/NO.png differ diff --git a/Items/Levi.cs b/Items/Levi.cs new file mode 100644 index 0000000000..d0b3940a47 --- /dev/null +++ b/Items/Levi.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/Levi.png b/Items/Levi.png new file mode 100644 index 0000000000..c5743d1302 Binary files /dev/null and b/Items/Levi.png differ diff --git a/Items/Leviathan/EnchantedPearl.cs b/Items/Leviathan/EnchantedPearl.cs new file mode 100644 index 0000000000..6db501c4fd --- /dev/null +++ b/Items/Leviathan/EnchantedPearl.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Leviathan/EnchantedPearl.png b/Items/Leviathan/EnchantedPearl.png new file mode 100644 index 0000000000..b633ed63cb Binary files /dev/null and b/Items/Leviathan/EnchantedPearl.png differ diff --git a/Items/Leviathan/IOU.cs b/Items/Leviathan/IOU.cs new file mode 100644 index 0000000000..5c94d39c8e --- /dev/null +++ b/Items/Leviathan/IOU.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Leviathan/IOU.png b/Items/Leviathan/IOU.png new file mode 100644 index 0000000000..e463aed303 Binary files /dev/null and b/Items/Leviathan/IOU.png differ diff --git a/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs new file mode 100644 index 0000000000..c047a50860 --- /dev/null +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Items/Leviathan/LeviathanAmbergris.png b/Items/Leviathan/LeviathanAmbergris.png new file mode 100644 index 0000000000..88034a76f7 Binary files /dev/null and b/Items/Leviathan/LeviathanAmbergris.png differ diff --git a/Items/Leviathan/LeviathanBag.cs b/Items/Leviathan/LeviathanBag.cs new file mode 100644 index 0000000000..1fde104b34 --- /dev/null +++ b/Items/Leviathan/LeviathanBag.cs @@ -0,0 +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 + } + } +} \ No newline at end of file diff --git a/Items/Leviathan/LeviathanBag.png b/Items/Leviathan/LeviathanBag.png new file mode 100644 index 0000000000..2928778427 Binary files /dev/null and b/Items/Leviathan/LeviathanBag.png differ diff --git a/Items/LivingShard.cs b/Items/LivingShard.cs new file mode 100644 index 0000000000..63d5d7d06b --- /dev/null +++ b/Items/LivingShard.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/LivingShard.png b/Items/LivingShard.png new file mode 100644 index 0000000000..2ff00179b0 Binary files /dev/null and b/Items/LivingShard.png differ diff --git a/Items/ManeaterBulb.cs b/Items/ManeaterBulb.cs new file mode 100644 index 0000000000..b56a3bb047 --- /dev/null +++ b/Items/ManeaterBulb.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/ManeaterBulb.png b/Items/ManeaterBulb.png new file mode 100644 index 0000000000..1c033b4829 Binary files /dev/null and b/Items/ManeaterBulb.png differ diff --git a/Items/MarniteObliterator.cs b/Items/MarniteObliterator.cs new file mode 100644 index 0000000000..223096d79b --- /dev/null +++ b/Items/MarniteObliterator.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/MarniteObliterator.png b/Items/MarniteObliterator.png new file mode 100644 index 0000000000..aed12d2353 Binary files /dev/null and b/Items/MarniteObliterator.png differ diff --git a/Items/MeldBlob.cs b/Items/MeldBlob.cs new file mode 100644 index 0000000000..ae4f76f5f3 --- /dev/null +++ b/Items/MeldBlob.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/MeldBlob.png b/Items/MeldBlob.png new file mode 100644 index 0000000000..48341ed30c Binary files /dev/null and b/Items/MeldBlob.png differ diff --git a/Items/MeldiateBar.cs b/Items/MeldiateBar.cs new file mode 100644 index 0000000000..b9a2cb0d4d --- /dev/null +++ b/Items/MeldiateBar.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/MeldiateBar.png b/Items/MeldiateBar.png new file mode 100644 index 0000000000..d2067434db Binary files /dev/null and b/Items/MeldiateBar.png differ diff --git a/Items/MiracleFruit.cs b/Items/MiracleFruit.cs new file mode 100644 index 0000000000..3bb27df479 --- /dev/null +++ b/Items/MiracleFruit.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/MiracleFruit.png b/Items/MiracleFruit.png new file mode 100644 index 0000000000..483f4a425c Binary files /dev/null and b/Items/MiracleFruit.png differ diff --git a/Items/Moonlight.cs b/Items/Moonlight.cs new file mode 100644 index 0000000000..d449cb1c74 --- /dev/null +++ b/Items/Moonlight.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class Moonlight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonlight"); + Tooltip.SetDefault("Summons the moon"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } + + public override bool UseItem(Player player) + { + Main.dayTime = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofNight, 7); + recipe.AddIngredient(null, "CryoBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Moonlight.png b/Items/Moonlight.png new file mode 100644 index 0000000000..5490d86e60 Binary files /dev/null and b/Items/Moonlight.png differ diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs new file mode 100644 index 0000000000..ef8f3d203b --- /dev/null +++ b/Items/Mounts/Fab.cs @@ -0,0 +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; + } + } + } +} diff --git a/Items/Mounts/FabExtra.png b/Items/Mounts/FabExtra.png new file mode 100644 index 0000000000..9e18cea9aa Binary files /dev/null and b/Items/Mounts/FabExtra.png differ diff --git a/Items/Mounts/Fab_Back.png b/Items/Mounts/Fab_Back.png new file mode 100644 index 0000000000..3d2a6e7302 Binary files /dev/null and b/Items/Mounts/Fab_Back.png differ diff --git a/Items/Mounts/Fab_Front.png b/Items/Mounts/Fab_Front.png new file mode 100644 index 0000000000..045054997d Binary files /dev/null and b/Items/Mounts/Fab_Front.png differ diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs new file mode 100644 index 0000000000..e2a728aa13 --- /dev/null +++ b/Items/Mounts/PhuppersChair.cs @@ -0,0 +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; + } + } + } +} diff --git a/Items/Mounts/PhuppersChair_Back.png b/Items/Mounts/PhuppersChair_Back.png new file mode 100644 index 0000000000..b8b6518948 Binary files /dev/null and b/Items/Mounts/PhuppersChair_Back.png differ diff --git a/Items/Mounts/PhuppersChair_Front.png b/Items/Mounts/PhuppersChair_Front.png new file mode 100644 index 0000000000..0dcd21c224 Binary files /dev/null and b/Items/Mounts/PhuppersChair_Front.png differ diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs new file mode 100644 index 0000000000..ef589f10ce --- /dev/null +++ b/Items/Mounts/SquishyBean.cs @@ -0,0 +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; + } + } +} + diff --git a/Items/Mounts/SquishyBean_Back.png b/Items/Mounts/SquishyBean_Back.png new file mode 100644 index 0000000000..17f53eb31d Binary files /dev/null and b/Items/Mounts/SquishyBean_Back.png differ diff --git a/Items/MurkyPaste.cs b/Items/MurkyPaste.cs new file mode 100644 index 0000000000..12535ad8d6 --- /dev/null +++ b/Items/MurkyPaste.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/MurkyPaste.png b/Items/MurkyPaste.png new file mode 100644 index 0000000000..76bce20bf0 Binary files /dev/null and b/Items/MurkyPaste.png differ diff --git a/Items/MurkySludge.cs b/Items/MurkySludge.cs new file mode 100644 index 0000000000..1ae6a649da --- /dev/null +++ b/Items/MurkySludge.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/MurkySludge.png b/Items/MurkySludge.png new file mode 100644 index 0000000000..476b213cbc Binary files /dev/null and b/Items/MurkySludge.png differ diff --git a/Items/MushroomPlasmaRoot.cs b/Items/MushroomPlasmaRoot.cs new file mode 100644 index 0000000000..107aa277d8 --- /dev/null +++ b/Items/MushroomPlasmaRoot.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/MushroomPlasmaRoot.png b/Items/MushroomPlasmaRoot.png new file mode 100644 index 0000000000..d5402e562b Binary files /dev/null and b/Items/MushroomPlasmaRoot.png differ diff --git a/Items/NightmareFuel.cs b/Items/NightmareFuel.cs new file mode 100644 index 0000000000..4b471fbce2 --- /dev/null +++ b/Items/NightmareFuel.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +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/NightmareFuel.png b/Items/NightmareFuel.png new file mode 100644 index 0000000000..b58f4759c6 Binary files /dev/null and b/Items/NightmareFuel.png differ diff --git a/Items/OldPowerCell.cs b/Items/OldPowerCell.cs new file mode 100644 index 0000000000..eb8fc8a839 --- /dev/null +++ b/Items/OldPowerCell.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/OldPowerCell.png b/Items/OldPowerCell.png new file mode 100644 index 0000000000..fedf94f5db Binary files /dev/null and b/Items/OldPowerCell.png differ diff --git a/Items/OmegaHealingPotion.cs b/Items/OmegaHealingPotion.cs new file mode 100644 index 0000000000..1ad9c25aef --- /dev/null +++ b/Items/OmegaHealingPotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/OmegaHealingPotion.png b/Items/OmegaHealingPotion.png new file mode 100644 index 0000000000..541f82402a Binary files /dev/null and b/Items/OmegaHealingPotion.png differ diff --git a/Items/Perforator/BloodSample.cs b/Items/Perforator/BloodSample.cs new file mode 100644 index 0000000000..6f9f4ad396 --- /dev/null +++ b/Items/Perforator/BloodSample.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Perforator/BloodSample.png b/Items/Perforator/BloodSample.png new file mode 100644 index 0000000000..52a28ee266 Binary files /dev/null and b/Items/Perforator/BloodSample.png differ diff --git a/Items/Perforator/BloodyWormFood.cs b/Items/Perforator/BloodyWormFood.cs new file mode 100644 index 0000000000..65e99c9e70 --- /dev/null +++ b/Items/Perforator/BloodyWormFood.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Perforator +{ + public class BloodyWormFood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Worm Food"); + Tooltip.SetDefault("Summons the Perforator Hive"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneCrimson && !NPC.AnyNPCs(mod.NPCType("PerforatorHive")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 9); + recipe.AddIngredient(null, "BloodSample", 5); + recipe.AddIngredient(ItemID.CrimtaneBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Perforator/BloodyWormFood.png b/Items/Perforator/BloodyWormFood.png new file mode 100644 index 0000000000..ddf7d4c5e8 Binary files /dev/null and b/Items/Perforator/BloodyWormFood.png differ diff --git a/Items/Perforator/BloodyWormTooth.cs b/Items/Perforator/BloodyWormTooth.cs new file mode 100644 index 0000000000..21170b8850 --- /dev/null +++ b/Items/Perforator/BloodyWormTooth.cs @@ -0,0 +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.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 diff --git a/Items/Perforator/BloodyWormTooth.png b/Items/Perforator/BloodyWormTooth.png new file mode 100644 index 0000000000..e00b3f5896 Binary files /dev/null and b/Items/Perforator/BloodyWormTooth.png differ diff --git a/Items/Perforator/PerforatorBag.cs b/Items/Perforator/PerforatorBag.cs new file mode 100644 index 0000000000..4d201bd04b --- /dev/null +++ b/Items/Perforator/PerforatorBag.cs @@ -0,0 +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)); + } + } + } +} \ No newline at end of file diff --git a/Items/Perforator/PerforatorBag.png b/Items/Perforator/PerforatorBag.png new file mode 100644 index 0000000000..d7e7d72695 Binary files /dev/null and b/Items/Perforator/PerforatorBag.png differ diff --git a/Items/Permafrost/AbsoluteZero.cs b/Items/Permafrost/AbsoluteZero.cs new file mode 100644 index 0000000000..fb7888a6a7 --- /dev/null +++ b/Items/Permafrost/AbsoluteZero.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Permafrost/AbsoluteZero.png b/Items/Permafrost/AbsoluteZero.png new file mode 100644 index 0000000000..a18fab51d6 Binary files /dev/null and b/Items/Permafrost/AbsoluteZero.png differ diff --git a/Items/Permafrost/ArcticBearPaw.cs b/Items/Permafrost/ArcticBearPaw.cs new file mode 100644 index 0000000000..b67bd94e74 --- /dev/null +++ b/Items/Permafrost/ArcticBearPaw.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/ArcticBearPaw.png b/Items/Permafrost/ArcticBearPaw.png new file mode 100644 index 0000000000..53ebc65b6a Binary files /dev/null and b/Items/Permafrost/ArcticBearPaw.png differ diff --git a/Items/Permafrost/ColdheartIcicle.cs b/Items/Permafrost/ColdheartIcicle.cs new file mode 100644 index 0000000000..7545f32daf --- /dev/null +++ b/Items/Permafrost/ColdheartIcicle.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Permafrost/ColdheartIcicle.png b/Items/Permafrost/ColdheartIcicle.png new file mode 100644 index 0000000000..2ef88afd9e Binary files /dev/null and b/Items/Permafrost/ColdheartIcicle.png differ diff --git a/Items/Permafrost/CryogenicStaff.cs b/Items/Permafrost/CryogenicStaff.cs new file mode 100644 index 0000000000..89689b44f8 --- /dev/null +++ b/Items/Permafrost/CryogenicStaff.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Permafrost/CryogenicStaff.png b/Items/Permafrost/CryogenicStaff.png new file mode 100644 index 0000000000..931b640cb7 Binary files /dev/null and b/Items/Permafrost/CryogenicStaff.png differ diff --git a/Items/Permafrost/DeliciousMeat.cs b/Items/Permafrost/DeliciousMeat.cs new file mode 100644 index 0000000000..92e6f2b138 --- /dev/null +++ b/Items/Permafrost/DeliciousMeat.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/DeliciousMeat.png b/Items/Permafrost/DeliciousMeat.png new file mode 100644 index 0000000000..9bae865748 Binary files /dev/null and b/Items/Permafrost/DeliciousMeat.png differ diff --git a/Items/Permafrost/EnchantedMetal.cs b/Items/Permafrost/EnchantedMetal.cs new file mode 100644 index 0000000000..5325807d71 --- /dev/null +++ b/Items/Permafrost/EnchantedMetal.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Permafrost/EnchantedMetal.png b/Items/Permafrost/EnchantedMetal.png new file mode 100644 index 0000000000..bd175ca8e9 Binary files /dev/null and b/Items/Permafrost/EnchantedMetal.png differ diff --git a/Items/Permafrost/EternalBlizzard.cs b/Items/Permafrost/EternalBlizzard.cs new file mode 100644 index 0000000000..8eb666bbae --- /dev/null +++ b/Items/Permafrost/EternalBlizzard.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/EternalBlizzard.png b/Items/Permafrost/EternalBlizzard.png new file mode 100644 index 0000000000..98942e37af Binary files /dev/null and b/Items/Permafrost/EternalBlizzard.png differ diff --git a/Items/Permafrost/FrostbiteBlaster.cs b/Items/Permafrost/FrostbiteBlaster.cs new file mode 100644 index 0000000000..c411d1e2ce --- /dev/null +++ b/Items/Permafrost/FrostbiteBlaster.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/FrostbiteBlaster.png b/Items/Permafrost/FrostbiteBlaster.png new file mode 100644 index 0000000000..18f1ddd993 Binary files /dev/null and b/Items/Permafrost/FrostbiteBlaster.png differ diff --git a/Items/Permafrost/FrostyFlare.cs b/Items/Permafrost/FrostyFlare.cs new file mode 100644 index 0000000000..e30e65789b --- /dev/null +++ b/Items/Permafrost/FrostyFlare.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/FrostyFlare.png b/Items/Permafrost/FrostyFlare.png new file mode 100644 index 0000000000..407de1a344 Binary files /dev/null and b/Items/Permafrost/FrostyFlare.png differ diff --git a/Items/Permafrost/IcicleArrow.cs b/Items/Permafrost/IcicleArrow.cs new file mode 100644 index 0000000000..a0fa711a05 --- /dev/null +++ b/Items/Permafrost/IcicleArrow.cs @@ -0,0 +1,31 @@ +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; + } + } +} diff --git a/Items/Permafrost/IcicleArrow.png b/Items/Permafrost/IcicleArrow.png new file mode 100644 index 0000000000..6812f4d459 Binary files /dev/null and b/Items/Permafrost/IcicleArrow.png differ diff --git a/Items/Permafrost/IcicleTrident.cs b/Items/Permafrost/IcicleTrident.cs new file mode 100644 index 0000000000..be3a435ef8 --- /dev/null +++ b/Items/Permafrost/IcicleTrident.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/IcicleTrident.png b/Items/Permafrost/IcicleTrident.png new file mode 100644 index 0000000000..5f408cc574 Binary files /dev/null and b/Items/Permafrost/IcicleTrident.png differ diff --git a/Items/Permafrost/IcyBullet.cs b/Items/Permafrost/IcyBullet.cs new file mode 100644 index 0000000000..8c4e3d7a27 --- /dev/null +++ b/Items/Permafrost/IcyBullet.cs @@ -0,0 +1,31 @@ +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; + } + } +} diff --git a/Items/Permafrost/IcyBullet.png b/Items/Permafrost/IcyBullet.png new file mode 100644 index 0000000000..baccf98031 Binary files /dev/null and b/Items/Permafrost/IcyBullet.png differ diff --git a/Items/Permafrost/PermafrostsConcoction.cs b/Items/Permafrost/PermafrostsConcoction.cs new file mode 100644 index 0000000000..9c92a45db7 --- /dev/null +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/PermafrostsConcoction.png b/Items/Permafrost/PermafrostsConcoction.png new file mode 100644 index 0000000000..a6bc883ce5 Binary files /dev/null and b/Items/Permafrost/PermafrostsConcoction.png differ diff --git a/Items/Permafrost/WintersFury.cs b/Items/Permafrost/WintersFury.cs new file mode 100644 index 0000000000..0687723545 --- /dev/null +++ b/Items/Permafrost/WintersFury.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Permafrost/WintersFury.png b/Items/Permafrost/WintersFury.png new file mode 100644 index 0000000000..32994417e2 Binary files /dev/null and b/Items/Permafrost/WintersFury.png differ diff --git a/Items/PhantomHeart.cs b/Items/PhantomHeart.cs new file mode 100644 index 0000000000..dd50f427fd --- /dev/null +++ b/Items/PhantomHeart.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/PhantomHeart.png b/Items/PhantomHeart.png new file mode 100644 index 0000000000..fe6f71ebfd Binary files /dev/null and b/Items/PhantomHeart.png differ diff --git a/Items/Phantoplasm.cs b/Items/Phantoplasm.cs new file mode 100644 index 0000000000..f2eec0ff81 --- /dev/null +++ b/Items/Phantoplasm.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items { +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/Phantoplasm.png b/Items/Phantoplasm.png new file mode 100644 index 0000000000..e80d69386d Binary files /dev/null and b/Items/Phantoplasm.png differ diff --git a/Items/Placeables/AbyssBath.cs b/Items/Placeables/AbyssBath.cs new file mode 100644 index 0000000000..c6eac95325 --- /dev/null +++ b/Items/Placeables/AbyssBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssBath.png b/Items/Placeables/AbyssBath.png new file mode 100644 index 0000000000..ad7930c43a Binary files /dev/null and b/Items/Placeables/AbyssBath.png differ diff --git a/Items/Placeables/AbyssBed.cs b/Items/Placeables/AbyssBed.cs new file mode 100644 index 0000000000..eee1e1505d --- /dev/null +++ b/Items/Placeables/AbyssBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssBed.png b/Items/Placeables/AbyssBed.png new file mode 100644 index 0000000000..670faff55b Binary files /dev/null and b/Items/Placeables/AbyssBed.png differ diff --git a/Items/Placeables/AbyssBookcase.cs b/Items/Placeables/AbyssBookcase.cs new file mode 100644 index 0000000000..9f1b4f8805 --- /dev/null +++ b/Items/Placeables/AbyssBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssBookcase.png b/Items/Placeables/AbyssBookcase.png new file mode 100644 index 0000000000..6ba6c6ba20 Binary files /dev/null and b/Items/Placeables/AbyssBookcase.png differ diff --git a/Items/Placeables/AbyssCandelabra.cs b/Items/Placeables/AbyssCandelabra.cs new file mode 100644 index 0000000000..e1467b7b33 --- /dev/null +++ b/Items/Placeables/AbyssCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssCandelabra.png b/Items/Placeables/AbyssCandelabra.png new file mode 100644 index 0000000000..e1ea882e8a Binary files /dev/null and b/Items/Placeables/AbyssCandelabra.png differ diff --git a/Items/Placeables/AbyssCandle.cs b/Items/Placeables/AbyssCandle.cs new file mode 100644 index 0000000000..0e58fe44c1 --- /dev/null +++ b/Items/Placeables/AbyssCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssCandle.png b/Items/Placeables/AbyssCandle.png new file mode 100644 index 0000000000..05ccfac68c Binary files /dev/null and b/Items/Placeables/AbyssCandle.png differ diff --git a/Items/Placeables/AbyssChair.cs b/Items/Placeables/AbyssChair.cs new file mode 100644 index 0000000000..c135f27062 --- /dev/null +++ b/Items/Placeables/AbyssChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssChair.png b/Items/Placeables/AbyssChair.png new file mode 100644 index 0000000000..fd5a0ad4b0 Binary files /dev/null and b/Items/Placeables/AbyssChair.png differ diff --git a/Items/Placeables/AbyssChandelier.cs b/Items/Placeables/AbyssChandelier.cs new file mode 100644 index 0000000000..f704cef2d5 --- /dev/null +++ b/Items/Placeables/AbyssChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssChandelier.png b/Items/Placeables/AbyssChandelier.png new file mode 100644 index 0000000000..c21858c6a9 Binary files /dev/null and b/Items/Placeables/AbyssChandelier.png differ diff --git a/Items/Placeables/AbyssChest.cs b/Items/Placeables/AbyssChest.cs new file mode 100644 index 0000000000..18ac3be6cf --- /dev/null +++ b/Items/Placeables/AbyssChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssChest.png b/Items/Placeables/AbyssChest.png new file mode 100644 index 0000000000..4a7d1eba54 Binary files /dev/null and b/Items/Placeables/AbyssChest.png differ diff --git a/Items/Placeables/AbyssClock.cs b/Items/Placeables/AbyssClock.cs new file mode 100644 index 0000000000..883bcdf47f --- /dev/null +++ b/Items/Placeables/AbyssClock.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssClock.png b/Items/Placeables/AbyssClock.png new file mode 100644 index 0000000000..dae7791ba6 Binary files /dev/null and b/Items/Placeables/AbyssClock.png differ diff --git a/Items/Placeables/AbyssDoor.cs b/Items/Placeables/AbyssDoor.cs new file mode 100644 index 0000000000..3dc76de613 --- /dev/null +++ b/Items/Placeables/AbyssDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssDoor.png b/Items/Placeables/AbyssDoor.png new file mode 100644 index 0000000000..2187ba914e Binary files /dev/null and b/Items/Placeables/AbyssDoor.png differ diff --git a/Items/Placeables/AbyssDresser.cs b/Items/Placeables/AbyssDresser.cs new file mode 100644 index 0000000000..ed136c0467 --- /dev/null +++ b/Items/Placeables/AbyssDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssDresser.png b/Items/Placeables/AbyssDresser.png new file mode 100644 index 0000000000..b79d8ceb2f Binary files /dev/null and b/Items/Placeables/AbyssDresser.png differ diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs new file mode 100644 index 0000000000..529e865c68 --- /dev/null +++ b/Items/Placeables/AbyssGravel.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AbyssGravel.png b/Items/Placeables/AbyssGravel.png new file mode 100644 index 0000000000..79c48af545 Binary files /dev/null and b/Items/Placeables/AbyssGravel.png differ diff --git a/Items/Placeables/AbyssLamp.cs b/Items/Placeables/AbyssLamp.cs new file mode 100644 index 0000000000..a6cda0c7ed --- /dev/null +++ b/Items/Placeables/AbyssLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssLamp.png b/Items/Placeables/AbyssLamp.png new file mode 100644 index 0000000000..4b9c269997 Binary files /dev/null and b/Items/Placeables/AbyssLamp.png differ diff --git a/Items/Placeables/AbyssLantern.cs b/Items/Placeables/AbyssLantern.cs new file mode 100644 index 0000000000..a4b8c82216 --- /dev/null +++ b/Items/Placeables/AbyssLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssLantern.png b/Items/Placeables/AbyssLantern.png new file mode 100644 index 0000000000..a91ed04649 Binary files /dev/null and b/Items/Placeables/AbyssLantern.png differ diff --git a/Items/Placeables/AbyssPiano.cs b/Items/Placeables/AbyssPiano.cs new file mode 100644 index 0000000000..a74684089c --- /dev/null +++ b/Items/Placeables/AbyssPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssPiano.png b/Items/Placeables/AbyssPiano.png new file mode 100644 index 0000000000..c3ffb13969 Binary files /dev/null and b/Items/Placeables/AbyssPiano.png differ diff --git a/Items/Placeables/AbyssSink.cs b/Items/Placeables/AbyssSink.cs new file mode 100644 index 0000000000..b89d05816b --- /dev/null +++ b/Items/Placeables/AbyssSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssSink.png b/Items/Placeables/AbyssSink.png new file mode 100644 index 0000000000..49e1ec5ac5 Binary files /dev/null and b/Items/Placeables/AbyssSink.png differ diff --git a/Items/Placeables/AbyssSofa.cs b/Items/Placeables/AbyssSofa.cs new file mode 100644 index 0000000000..9de91d9061 --- /dev/null +++ b/Items/Placeables/AbyssSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssSofa.png b/Items/Placeables/AbyssSofa.png new file mode 100644 index 0000000000..d12f8832ad Binary files /dev/null and b/Items/Placeables/AbyssSofa.png differ diff --git a/Items/Placeables/AbyssTable.cs b/Items/Placeables/AbyssTable.cs new file mode 100644 index 0000000000..1caa912e72 --- /dev/null +++ b/Items/Placeables/AbyssTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssTable.png b/Items/Placeables/AbyssTable.png new file mode 100644 index 0000000000..e2136beccc Binary files /dev/null and b/Items/Placeables/AbyssTable.png differ diff --git a/Items/Placeables/AbyssTorch.cs b/Items/Placeables/AbyssTorch.cs new file mode 100644 index 0000000000..435d69bf38 --- /dev/null +++ b/Items/Placeables/AbyssTorch.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssTorch.png b/Items/Placeables/AbyssTorch.png new file mode 100644 index 0000000000..f240eb6684 Binary files /dev/null and b/Items/Placeables/AbyssTorch.png differ diff --git a/Items/Placeables/AbyssUpperMusicbox.png b/Items/Placeables/AbyssUpperMusicbox.png new file mode 100644 index 0000000000..8f5c361db6 Binary files /dev/null and b/Items/Placeables/AbyssUpperMusicbox.png differ diff --git a/Items/Placeables/AbyssWorkbench.cs b/Items/Placeables/AbyssWorkbench.cs new file mode 100644 index 0000000000..c106f293d3 --- /dev/null +++ b/Items/Placeables/AbyssWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AbyssWorkbench.png b/Items/Placeables/AbyssWorkbench.png new file mode 100644 index 0000000000..e8b4789fc0 Binary files /dev/null and b/Items/Placeables/AbyssWorkbench.png differ diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs new file mode 100644 index 0000000000..38391129de --- /dev/null +++ b/Items/Placeables/AerialiteBrick.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AerialiteBrick.png b/Items/Placeables/AerialiteBrick.png new file mode 100644 index 0000000000..af77997905 Binary files /dev/null and b/Items/Placeables/AerialiteBrick.png differ diff --git a/Items/Placeables/AerialiteBrickWall.cs b/Items/Placeables/AerialiteBrickWall.cs new file mode 100644 index 0000000000..1074e9b2e1 --- /dev/null +++ b/Items/Placeables/AerialiteBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AerialiteBrickWall.png b/Items/Placeables/AerialiteBrickWall.png new file mode 100644 index 0000000000..4d12679b27 Binary files /dev/null and b/Items/Placeables/AerialiteBrickWall.png differ diff --git a/Items/Placeables/AerialiteOre.cs b/Items/Placeables/AerialiteOre.cs new file mode 100644 index 0000000000..792b38af13 --- /dev/null +++ b/Items/Placeables/AerialiteOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AerialiteOre.png b/Items/Placeables/AerialiteOre.png new file mode 100644 index 0000000000..e1634ed3e3 Binary files /dev/null and b/Items/Placeables/AerialiteOre.png differ diff --git a/Items/Placeables/AncientAltar.cs b/Items/Placeables/AncientAltar.cs new file mode 100644 index 0000000000..1f2b012a08 --- /dev/null +++ b/Items/Placeables/AncientAltar.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientAltar.png b/Items/Placeables/AncientAltar.png new file mode 100644 index 0000000000..7b629db093 Binary files /dev/null and b/Items/Placeables/AncientAltar.png differ diff --git a/Items/Placeables/AncientBasin.cs b/Items/Placeables/AncientBasin.cs new file mode 100644 index 0000000000..2b6d1fe290 --- /dev/null +++ b/Items/Placeables/AncientBasin.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientBasin.png b/Items/Placeables/AncientBasin.png new file mode 100644 index 0000000000..00ae63b6e0 Binary files /dev/null and b/Items/Placeables/AncientBasin.png differ diff --git a/Items/Placeables/AncientBath.cs b/Items/Placeables/AncientBath.cs new file mode 100644 index 0000000000..fb9190a60e --- /dev/null +++ b/Items/Placeables/AncientBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientBath.png b/Items/Placeables/AncientBath.png new file mode 100644 index 0000000000..218b48d7a6 Binary files /dev/null and b/Items/Placeables/AncientBath.png differ diff --git a/Items/Placeables/AncientBed.cs b/Items/Placeables/AncientBed.cs new file mode 100644 index 0000000000..6fa0fb6e34 --- /dev/null +++ b/Items/Placeables/AncientBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientBed.png b/Items/Placeables/AncientBed.png new file mode 100644 index 0000000000..a3f0c270cd Binary files /dev/null and b/Items/Placeables/AncientBed.png differ diff --git a/Items/Placeables/AncientBookcase.cs b/Items/Placeables/AncientBookcase.cs new file mode 100644 index 0000000000..db28303edd --- /dev/null +++ b/Items/Placeables/AncientBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientBookcase.png b/Items/Placeables/AncientBookcase.png new file mode 100644 index 0000000000..ebcc4e7b67 Binary files /dev/null and b/Items/Placeables/AncientBookcase.png differ diff --git a/Items/Placeables/AncientChair.cs b/Items/Placeables/AncientChair.cs new file mode 100644 index 0000000000..2554460ad0 --- /dev/null +++ b/Items/Placeables/AncientChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientChair.png b/Items/Placeables/AncientChair.png new file mode 100644 index 0000000000..24a548a067 Binary files /dev/null and b/Items/Placeables/AncientChair.png differ diff --git a/Items/Placeables/AncientChandelier.cs b/Items/Placeables/AncientChandelier.cs new file mode 100644 index 0000000000..1073c6453e --- /dev/null +++ b/Items/Placeables/AncientChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientChandelier.png b/Items/Placeables/AncientChandelier.png new file mode 100644 index 0000000000..5022594757 Binary files /dev/null and b/Items/Placeables/AncientChandelier.png differ diff --git a/Items/Placeables/AncientDoor.cs b/Items/Placeables/AncientDoor.cs new file mode 100644 index 0000000000..1299882306 --- /dev/null +++ b/Items/Placeables/AncientDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientDoor.png b/Items/Placeables/AncientDoor.png new file mode 100644 index 0000000000..a0c68e1120 Binary files /dev/null and b/Items/Placeables/AncientDoor.png differ diff --git a/Items/Placeables/AncientDresser.cs b/Items/Placeables/AncientDresser.cs new file mode 100644 index 0000000000..18134d26e2 --- /dev/null +++ b/Items/Placeables/AncientDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientDresser.png b/Items/Placeables/AncientDresser.png new file mode 100644 index 0000000000..a0d8a84b53 Binary files /dev/null and b/Items/Placeables/AncientDresser.png differ diff --git a/Items/Placeables/AncientLamp.cs b/Items/Placeables/AncientLamp.cs new file mode 100644 index 0000000000..e732883a09 --- /dev/null +++ b/Items/Placeables/AncientLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientLamp.png b/Items/Placeables/AncientLamp.png new file mode 100644 index 0000000000..0f3e6cb3bb Binary files /dev/null and b/Items/Placeables/AncientLamp.png differ diff --git a/Items/Placeables/AncientLantern.cs b/Items/Placeables/AncientLantern.cs new file mode 100644 index 0000000000..173da19442 --- /dev/null +++ b/Items/Placeables/AncientLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientLantern.png b/Items/Placeables/AncientLantern.png new file mode 100644 index 0000000000..19ca3c65e4 Binary files /dev/null and b/Items/Placeables/AncientLantern.png differ diff --git a/Items/Placeables/AncientMonolith.cs b/Items/Placeables/AncientMonolith.cs new file mode 100644 index 0000000000..e38e4b48ae --- /dev/null +++ b/Items/Placeables/AncientMonolith.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientMonolith.png b/Items/Placeables/AncientMonolith.png new file mode 100644 index 0000000000..4b84bc960b Binary files /dev/null and b/Items/Placeables/AncientMonolith.png differ diff --git a/Items/Placeables/AncientPiano.cs b/Items/Placeables/AncientPiano.cs new file mode 100644 index 0000000000..47f9b2d07d --- /dev/null +++ b/Items/Placeables/AncientPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientPiano.png b/Items/Placeables/AncientPiano.png new file mode 100644 index 0000000000..c5ef3c39b7 Binary files /dev/null and b/Items/Placeables/AncientPiano.png differ diff --git a/Items/Placeables/AncientSink.cs b/Items/Placeables/AncientSink.cs new file mode 100644 index 0000000000..fffae05996 --- /dev/null +++ b/Items/Placeables/AncientSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientSink.png b/Items/Placeables/AncientSink.png new file mode 100644 index 0000000000..bc54cb6146 Binary files /dev/null and b/Items/Placeables/AncientSink.png differ diff --git a/Items/Placeables/AncientSofa.cs b/Items/Placeables/AncientSofa.cs new file mode 100644 index 0000000000..4edf7d71a6 --- /dev/null +++ b/Items/Placeables/AncientSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientSofa.png b/Items/Placeables/AncientSofa.png new file mode 100644 index 0000000000..3d596b65e9 Binary files /dev/null and b/Items/Placeables/AncientSofa.png differ diff --git a/Items/Placeables/AncientTable.cs b/Items/Placeables/AncientTable.cs new file mode 100644 index 0000000000..039d17ea33 --- /dev/null +++ b/Items/Placeables/AncientTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientTable.png b/Items/Placeables/AncientTable.png new file mode 100644 index 0000000000..12e287f60c Binary files /dev/null and b/Items/Placeables/AncientTable.png differ diff --git a/Items/Placeables/AncientWorkbench.cs b/Items/Placeables/AncientWorkbench.cs new file mode 100644 index 0000000000..ec9802330e --- /dev/null +++ b/Items/Placeables/AncientWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AncientWorkbench.png b/Items/Placeables/AncientWorkbench.png new file mode 100644 index 0000000000..b6982b8f56 Binary files /dev/null and b/Items/Placeables/AncientWorkbench.png differ diff --git a/Items/Placeables/AquaticScourgeMusicbox.cs b/Items/Placeables/AquaticScourgeMusicbox.cs new file mode 100644 index 0000000000..f279a76d2b --- /dev/null +++ b/Items/Placeables/AquaticScourgeMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AquaticScourgeMusicbox.png b/Items/Placeables/AquaticScourgeMusicbox.png new file mode 100644 index 0000000000..cd44d826ee Binary files /dev/null and b/Items/Placeables/AquaticScourgeMusicbox.png differ diff --git a/Items/Placeables/AshenAltar.cs b/Items/Placeables/AshenAltar.cs new file mode 100644 index 0000000000..9cf4b5f098 --- /dev/null +++ b/Items/Placeables/AshenAltar.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenAltar.png b/Items/Placeables/AshenAltar.png new file mode 100644 index 0000000000..76cb7064a7 Binary files /dev/null and b/Items/Placeables/AshenAltar.png differ diff --git a/Items/Placeables/AshenBasin.cs b/Items/Placeables/AshenBasin.cs new file mode 100644 index 0000000000..bb3807b53c --- /dev/null +++ b/Items/Placeables/AshenBasin.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenBasin.png b/Items/Placeables/AshenBasin.png new file mode 100644 index 0000000000..b1eca269b0 Binary files /dev/null and b/Items/Placeables/AshenBasin.png differ diff --git a/Items/Placeables/AshenBath.cs b/Items/Placeables/AshenBath.cs new file mode 100644 index 0000000000..ffce06be4d --- /dev/null +++ b/Items/Placeables/AshenBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenBath.png b/Items/Placeables/AshenBath.png new file mode 100644 index 0000000000..98f272a89a Binary files /dev/null and b/Items/Placeables/AshenBath.png differ diff --git a/Items/Placeables/AshenBed.cs b/Items/Placeables/AshenBed.cs new file mode 100644 index 0000000000..a3173a766e --- /dev/null +++ b/Items/Placeables/AshenBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenBed.png b/Items/Placeables/AshenBed.png new file mode 100644 index 0000000000..632783e60a Binary files /dev/null and b/Items/Placeables/AshenBed.png differ diff --git a/Items/Placeables/AshenBookcase.cs b/Items/Placeables/AshenBookcase.cs new file mode 100644 index 0000000000..53b1175434 --- /dev/null +++ b/Items/Placeables/AshenBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenBookcase.png b/Items/Placeables/AshenBookcase.png new file mode 100644 index 0000000000..3b64ec743e Binary files /dev/null and b/Items/Placeables/AshenBookcase.png differ diff --git a/Items/Placeables/AshenCandelabra.cs b/Items/Placeables/AshenCandelabra.cs new file mode 100644 index 0000000000..fbd9950075 --- /dev/null +++ b/Items/Placeables/AshenCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenCandelabra.png b/Items/Placeables/AshenCandelabra.png new file mode 100644 index 0000000000..6e5a098472 Binary files /dev/null and b/Items/Placeables/AshenCandelabra.png differ diff --git a/Items/Placeables/AshenCandle.cs b/Items/Placeables/AshenCandle.cs new file mode 100644 index 0000000000..b7e09dace5 --- /dev/null +++ b/Items/Placeables/AshenCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenCandle.png b/Items/Placeables/AshenCandle.png new file mode 100644 index 0000000000..4605a30a26 Binary files /dev/null and b/Items/Placeables/AshenCandle.png differ diff --git a/Items/Placeables/AshenChair.cs b/Items/Placeables/AshenChair.cs new file mode 100644 index 0000000000..467e72c578 --- /dev/null +++ b/Items/Placeables/AshenChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenChair.png b/Items/Placeables/AshenChair.png new file mode 100644 index 0000000000..7772a4c575 Binary files /dev/null and b/Items/Placeables/AshenChair.png differ diff --git a/Items/Placeables/AshenChandelier.cs b/Items/Placeables/AshenChandelier.cs new file mode 100644 index 0000000000..6a4cf636c1 --- /dev/null +++ b/Items/Placeables/AshenChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenChandelier.png b/Items/Placeables/AshenChandelier.png new file mode 100644 index 0000000000..c5c3d9525f Binary files /dev/null and b/Items/Placeables/AshenChandelier.png differ diff --git a/Items/Placeables/AshenChest.cs b/Items/Placeables/AshenChest.cs new file mode 100644 index 0000000000..a632d9725a --- /dev/null +++ b/Items/Placeables/AshenChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenChest.png b/Items/Placeables/AshenChest.png new file mode 100644 index 0000000000..9906b441f5 Binary files /dev/null and b/Items/Placeables/AshenChest.png differ diff --git a/Items/Placeables/AshenDoor.cs b/Items/Placeables/AshenDoor.cs new file mode 100644 index 0000000000..d0a183be59 --- /dev/null +++ b/Items/Placeables/AshenDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenDoor.png b/Items/Placeables/AshenDoor.png new file mode 100644 index 0000000000..eeaaf83170 Binary files /dev/null and b/Items/Placeables/AshenDoor.png differ diff --git a/Items/Placeables/AshenDresser.cs b/Items/Placeables/AshenDresser.cs new file mode 100644 index 0000000000..332e8de65f --- /dev/null +++ b/Items/Placeables/AshenDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenDresser.png b/Items/Placeables/AshenDresser.png new file mode 100644 index 0000000000..f11fc20929 Binary files /dev/null and b/Items/Placeables/AshenDresser.png differ diff --git a/Items/Placeables/AshenLamp.cs b/Items/Placeables/AshenLamp.cs new file mode 100644 index 0000000000..2e6ef2757e --- /dev/null +++ b/Items/Placeables/AshenLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenLamp.png b/Items/Placeables/AshenLamp.png new file mode 100644 index 0000000000..061849ee69 Binary files /dev/null and b/Items/Placeables/AshenLamp.png differ diff --git a/Items/Placeables/AshenLantern.cs b/Items/Placeables/AshenLantern.cs new file mode 100644 index 0000000000..3943c3d120 --- /dev/null +++ b/Items/Placeables/AshenLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenLantern.png b/Items/Placeables/AshenLantern.png new file mode 100644 index 0000000000..2dc3d37e3f Binary files /dev/null and b/Items/Placeables/AshenLantern.png differ diff --git a/Items/Placeables/AshenMonolith.cs b/Items/Placeables/AshenMonolith.cs new file mode 100644 index 0000000000..6d4baaca46 --- /dev/null +++ b/Items/Placeables/AshenMonolith.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenMonolith.png b/Items/Placeables/AshenMonolith.png new file mode 100644 index 0000000000..088b20259a Binary files /dev/null and b/Items/Placeables/AshenMonolith.png differ diff --git a/Items/Placeables/AshenPiano.cs b/Items/Placeables/AshenPiano.cs new file mode 100644 index 0000000000..56b14264a4 --- /dev/null +++ b/Items/Placeables/AshenPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenPiano.png b/Items/Placeables/AshenPiano.png new file mode 100644 index 0000000000..c5c4d568a4 Binary files /dev/null and b/Items/Placeables/AshenPiano.png differ diff --git a/Items/Placeables/AshenPlatform.cs b/Items/Placeables/AshenPlatform.cs new file mode 100644 index 0000000000..bd1e84fc88 --- /dev/null +++ b/Items/Placeables/AshenPlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenPlatform.png b/Items/Placeables/AshenPlatform.png new file mode 100644 index 0000000000..6ab2c5ab18 Binary files /dev/null and b/Items/Placeables/AshenPlatform.png differ diff --git a/Items/Placeables/AshenSink.cs b/Items/Placeables/AshenSink.cs new file mode 100644 index 0000000000..599166f643 --- /dev/null +++ b/Items/Placeables/AshenSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenSink.png b/Items/Placeables/AshenSink.png new file mode 100644 index 0000000000..60b2bf5b4c Binary files /dev/null and b/Items/Placeables/AshenSink.png differ diff --git a/Items/Placeables/AshenSlab.cs b/Items/Placeables/AshenSlab.cs new file mode 100644 index 0000000000..f5e456f04e --- /dev/null +++ b/Items/Placeables/AshenSlab.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/AshenSlab.png b/Items/Placeables/AshenSlab.png new file mode 100644 index 0000000000..6bb266c977 Binary files /dev/null and b/Items/Placeables/AshenSlab.png differ diff --git a/Items/Placeables/AshenSofa.cs b/Items/Placeables/AshenSofa.cs new file mode 100644 index 0000000000..4fe8764fde --- /dev/null +++ b/Items/Placeables/AshenSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenSofa.png b/Items/Placeables/AshenSofa.png new file mode 100644 index 0000000000..e4d930bc88 Binary files /dev/null and b/Items/Placeables/AshenSofa.png differ diff --git a/Items/Placeables/AshenTable.cs b/Items/Placeables/AshenTable.cs new file mode 100644 index 0000000000..fd338cda8c --- /dev/null +++ b/Items/Placeables/AshenTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenTable.png b/Items/Placeables/AshenTable.png new file mode 100644 index 0000000000..c1d8ffe3ad Binary files /dev/null and b/Items/Placeables/AshenTable.png differ diff --git a/Items/Placeables/AshenWorkbench.cs b/Items/Placeables/AshenWorkbench.cs new file mode 100644 index 0000000000..aa5b69c987 --- /dev/null +++ b/Items/Placeables/AshenWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AshenWorkbench.png b/Items/Placeables/AshenWorkbench.png new file mode 100644 index 0000000000..d8a9101dbd Binary files /dev/null and b/Items/Placeables/AshenWorkbench.png differ diff --git a/Items/Placeables/AstrageldonMusicbox.cs b/Items/Placeables/AstrageldonMusicbox.cs new file mode 100644 index 0000000000..97a1de97a9 --- /dev/null +++ b/Items/Placeables/AstrageldonMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstrageldonMusicbox.png b/Items/Placeables/AstrageldonMusicbox.png new file mode 100644 index 0000000000..ed4917adf6 Binary files /dev/null and b/Items/Placeables/AstrageldonMusicbox.png differ diff --git a/Items/Placeables/AstrageldonTrophy.cs b/Items/Placeables/AstrageldonTrophy.cs new file mode 100644 index 0000000000..f2e3fe4256 --- /dev/null +++ b/Items/Placeables/AstrageldonTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstrageldonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrageldon 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/AstrageldonTrophy.png b/Items/Placeables/AstrageldonTrophy.png new file mode 100644 index 0000000000..d88a237d51 Binary files /dev/null and b/Items/Placeables/AstrageldonTrophy.png differ diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs new file mode 100644 index 0000000000..31a05f98f2 --- /dev/null +++ b/Items/Placeables/AstralBrick.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstralBrick.png b/Items/Placeables/AstralBrick.png new file mode 100644 index 0000000000..a5b50af705 Binary files /dev/null and b/Items/Placeables/AstralBrick.png differ diff --git a/Items/Placeables/AstralBrickWall.cs b/Items/Placeables/AstralBrickWall.cs new file mode 100644 index 0000000000..e731f6aa3b --- /dev/null +++ b/Items/Placeables/AstralBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstralBrickWall.png b/Items/Placeables/AstralBrickWall.png new file mode 100644 index 0000000000..e849f302be Binary files /dev/null and b/Items/Placeables/AstralBrickWall.png differ diff --git a/Items/Placeables/AstralMusicbox.cs b/Items/Placeables/AstralMusicbox.cs new file mode 100644 index 0000000000..cf9f730272 --- /dev/null +++ b/Items/Placeables/AstralMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstralMusicbox.png b/Items/Placeables/AstralMusicbox.png new file mode 100644 index 0000000000..e53533ffb1 Binary files /dev/null and b/Items/Placeables/AstralMusicbox.png differ diff --git a/Items/Placeables/AstralOre.cs b/Items/Placeables/AstralOre.cs new file mode 100644 index 0000000000..5765e4e4f6 --- /dev/null +++ b/Items/Placeables/AstralOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Placeables +{ + public class AstralOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("AstralOre"); + 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 = 7; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstralOre.png b/Items/Placeables/AstralOre.png new file mode 100644 index 0000000000..5869b0191e Binary files /dev/null and b/Items/Placeables/AstralOre.png differ diff --git a/Items/Placeables/AstrumDeusTrophy.cs b/Items/Placeables/AstrumDeusTrophy.cs new file mode 100644 index 0000000000..0af64978e9 --- /dev/null +++ b/Items/Placeables/AstrumDeusTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstrumDeusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 20; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstrumDeusTrophy.png b/Items/Placeables/AstrumDeusTrophy.png new file mode 100644 index 0000000000..83a05fc690 Binary files /dev/null and b/Items/Placeables/AstrumDeusTrophy.png differ diff --git a/Items/Placeables/AuricOre.cs b/Items/Placeables/AuricOre.cs new file mode 100644 index 0000000000..a4439a8495 --- /dev/null +++ b/Items/Placeables/AuricOre.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/AuricOre.png b/Items/Placeables/AuricOre.png new file mode 100644 index 0000000000..88f5fba817 Binary files /dev/null and b/Items/Placeables/AuricOre.png differ diff --git a/Items/Placeables/BlueBrickWallUnsafe.cs b/Items/Placeables/BlueBrickWallUnsafe.cs new file mode 100644 index 0000000000..a96bda4c05 --- /dev/null +++ b/Items/Placeables/BlueBrickWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BlueBrickWallUnsafe.png b/Items/Placeables/BlueBrickWallUnsafe.png new file mode 100644 index 0000000000..6a0943c7ef Binary files /dev/null and b/Items/Placeables/BlueBrickWallUnsafe.png differ diff --git a/Items/Placeables/BlueSlabWallUnsafe.cs b/Items/Placeables/BlueSlabWallUnsafe.cs new file mode 100644 index 0000000000..ccce267edc --- /dev/null +++ b/Items/Placeables/BlueSlabWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonSlabUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BlueSlabWallUnsafe.png b/Items/Placeables/BlueSlabWallUnsafe.png new file mode 100644 index 0000000000..428ced9230 Binary files /dev/null and b/Items/Placeables/BlueSlabWallUnsafe.png differ diff --git a/Items/Placeables/BlueTiledWallUnsafe.cs b/Items/Placeables/BlueTiledWallUnsafe.cs new file mode 100644 index 0000000000..2cabe5c9ef --- /dev/null +++ b/Items/Placeables/BlueTiledWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonTileUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BlueTiledWallUnsafe.png b/Items/Placeables/BlueTiledWallUnsafe.png new file mode 100644 index 0000000000..44b957e26b Binary files /dev/null and b/Items/Placeables/BlueTiledWallUnsafe.png differ diff --git a/Items/Placeables/BrimstoneElementalTrophy.cs b/Items/Placeables/BrimstoneElementalTrophy.cs new file mode 100644 index 0000000000..aa9bbe73bb --- /dev/null +++ b/Items/Placeables/BrimstoneElementalTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneElementalTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 21; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BrimstoneElementalTrophy.png b/Items/Placeables/BrimstoneElementalTrophy.png new file mode 100644 index 0000000000..74f71eaad9 Binary files /dev/null and b/Items/Placeables/BrimstoneElementalTrophy.png differ diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs new file mode 100644 index 0000000000..cf1c25797e --- /dev/null +++ b/Items/Placeables/BrimstoneSlag.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/BrimstoneSlag.png b/Items/Placeables/BrimstoneSlag.png new file mode 100644 index 0000000000..7756e7278a Binary files /dev/null and b/Items/Placeables/BrimstoneSlag.png differ diff --git a/Items/Placeables/BrimstoneSlagWall.cs b/Items/Placeables/BrimstoneSlagWall.cs new file mode 100644 index 0000000000..ad8f28ada5 --- /dev/null +++ b/Items/Placeables/BrimstoneSlagWall.cs @@ -0,0 +1,33 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneSlagWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("BrimstoneSlagWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag"); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BrimstoneSlagWall.png b/Items/Placeables/BrimstoneSlagWall.png new file mode 100644 index 0000000000..3ee5f2d3e5 Binary files /dev/null and b/Items/Placeables/BrimstoneSlagWall.png differ diff --git a/Items/Placeables/BumblebirbTrophy.cs b/Items/Placeables/BumblebirbTrophy.cs new file mode 100644 index 0000000000..27847b3851 --- /dev/null +++ b/Items/Placeables/BumblebirbTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BumblebirbTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 18; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/BumblebirbTrophy.png b/Items/Placeables/BumblebirbTrophy.png new file mode 100644 index 0000000000..ea1665c31d Binary files /dev/null and b/Items/Placeables/BumblebirbTrophy.png differ diff --git a/Items/Placeables/CalamitasMusicbox.cs b/Items/Placeables/CalamitasMusicbox.cs new file mode 100644 index 0000000000..9f0a748c6e --- /dev/null +++ b/Items/Placeables/CalamitasMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CalamitasMusicbox.png b/Items/Placeables/CalamitasMusicbox.png new file mode 100644 index 0000000000..70873369ab Binary files /dev/null and b/Items/Placeables/CalamitasMusicbox.png differ diff --git a/Items/Placeables/CalamitasTrophy.cs b/Items/Placeables/CalamitasTrophy.cs new file mode 100644 index 0000000000..3cc84a5720 --- /dev/null +++ b/Items/Placeables/CalamitasTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CalamitasTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 7; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CalamitasTrophy.png b/Items/Placeables/CalamitasTrophy.png new file mode 100644 index 0000000000..8921541d1b Binary files /dev/null and b/Items/Placeables/CalamitasTrophy.png differ diff --git a/Items/Placeables/CataclysmTrophy.cs b/Items/Placeables/CataclysmTrophy.cs new file mode 100644 index 0000000000..d699743dbf --- /dev/null +++ b/Items/Placeables/CataclysmTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CataclysmTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 16; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CataclysmTrophy.png b/Items/Placeables/CataclysmTrophy.png new file mode 100644 index 0000000000..5e713709e4 Binary files /dev/null and b/Items/Placeables/CataclysmTrophy.png differ diff --git a/Items/Placeables/CatastropheTrophy.cs b/Items/Placeables/CatastropheTrophy.cs new file mode 100644 index 0000000000..ce8b1888c9 --- /dev/null +++ b/Items/Placeables/CatastropheTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CatastropheTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 15; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CatastropheTrophy.png b/Items/Placeables/CatastropheTrophy.png new file mode 100644 index 0000000000..80d566535b Binary files /dev/null and b/Items/Placeables/CatastropheTrophy.png differ diff --git a/Items/Placeables/CeaselessVoidMusicbox.cs b/Items/Placeables/CeaselessVoidMusicbox.cs new file mode 100644 index 0000000000..f51ad4d9e7 --- /dev/null +++ b/Items/Placeables/CeaselessVoidMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CeaselessVoidMusicbox.png b/Items/Placeables/CeaselessVoidMusicbox.png new file mode 100644 index 0000000000..8a8e549718 Binary files /dev/null and b/Items/Placeables/CeaselessVoidMusicbox.png differ diff --git a/Items/Placeables/CeaselessVoidTrophy.cs b/Items/Placeables/CeaselessVoidTrophy.cs new file mode 100644 index 0000000000..b6277d6357 --- /dev/null +++ b/Items/Placeables/CeaselessVoidTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CeaselessVoidTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 13; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CeaselessVoidTrophy.png b/Items/Placeables/CeaselessVoidTrophy.png new file mode 100644 index 0000000000..2bda0d1e82 Binary files /dev/null and b/Items/Placeables/CeaselessVoidTrophy.png differ diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ChaoticBrick.cs new file mode 100644 index 0000000000..1a5d22d39b --- /dev/null +++ b/Items/Placeables/ChaoticBrick.cs @@ -0,0 +1,42 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ChaoticBrick : ModItem + { + public override void SetDefaults() + { + item.width = 24; + item.height = 25; + item.maxStack = 999; + item.value = 0; + item.rare = 1; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ChaoticBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "ChaoticOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ChaoticBrick.png b/Items/Placeables/ChaoticBrick.png new file mode 100644 index 0000000000..af48f6482d Binary files /dev/null and b/Items/Placeables/ChaoticBrick.png differ diff --git a/Items/Placeables/ChaoticBrickWall.cs b/Items/Placeables/ChaoticBrickWall.cs new file mode 100644 index 0000000000..70cd535c5c --- /dev/null +++ b/Items/Placeables/ChaoticBrickWall.cs @@ -0,0 +1,33 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ChaoticBrickWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("ChaoticBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ChaoticBrickWall.png b/Items/Placeables/ChaoticBrickWall.png new file mode 100644 index 0000000000..0b2e28f760 Binary files /dev/null and b/Items/Placeables/ChaoticBrickWall.png differ diff --git a/Items/Placeables/ChaoticOre.cs b/Items/Placeables/ChaoticOre.cs new file mode 100644 index 0000000000..1129c8c1ac --- /dev/null +++ b/Items/Placeables/ChaoticOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ChaoticOre.png b/Items/Placeables/ChaoticOre.png new file mode 100644 index 0000000000..1e820f53f1 Binary files /dev/null and b/Items/Placeables/ChaoticOre.png differ diff --git a/Items/Placeables/CharredOre.cs b/Items/Placeables/CharredOre.cs new file mode 100644 index 0000000000..f02b742cbd --- /dev/null +++ b/Items/Placeables/CharredOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CharredOre.png b/Items/Placeables/CharredOre.png new file mode 100644 index 0000000000..d4f4286671 Binary files /dev/null and b/Items/Placeables/CharredOre.png differ diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Cinderplate.cs new file mode 100644 index 0000000000..797cf4d453 --- /dev/null +++ b/Items/Placeables/Cinderplate.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Cinderplate.png b/Items/Placeables/Cinderplate.png new file mode 100644 index 0000000000..85da9f2a14 Binary files /dev/null and b/Items/Placeables/Cinderplate.png differ diff --git a/Items/Placeables/CinderplateWall.cs b/Items/Placeables/CinderplateWall.cs new file mode 100644 index 0000000000..45ce621768 --- /dev/null +++ b/Items/Placeables/CinderplateWall.cs @@ -0,0 +1,34 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CinderplateWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CinderplateWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CinderplateWall.png b/Items/Placeables/CinderplateWall.png new file mode 100644 index 0000000000..3dfad939f4 Binary files /dev/null and b/Items/Placeables/CinderplateWall.png differ diff --git a/Items/Placeables/CosmiliteBath.cs b/Items/Placeables/CosmiliteBath.cs new file mode 100644 index 0000000000..f2fdaab5eb --- /dev/null +++ b/Items/Placeables/CosmiliteBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBath.png b/Items/Placeables/CosmiliteBath.png new file mode 100644 index 0000000000..591adcc85d Binary files /dev/null and b/Items/Placeables/CosmiliteBath.png differ diff --git a/Items/Placeables/CosmiliteBed.cs b/Items/Placeables/CosmiliteBed.cs new file mode 100644 index 0000000000..39aacffc69 --- /dev/null +++ b/Items/Placeables/CosmiliteBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBed.png b/Items/Placeables/CosmiliteBed.png new file mode 100644 index 0000000000..835f120de9 Binary files /dev/null and b/Items/Placeables/CosmiliteBed.png differ diff --git a/Items/Placeables/CosmiliteBookcase.cs b/Items/Placeables/CosmiliteBookcase.cs new file mode 100644 index 0000000000..3cf3371155 --- /dev/null +++ b/Items/Placeables/CosmiliteBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBookcase.png b/Items/Placeables/CosmiliteBookcase.png new file mode 100644 index 0000000000..3c4ceeca35 Binary files /dev/null and b/Items/Placeables/CosmiliteBookcase.png differ diff --git a/Items/Placeables/CosmiliteBrick.cs b/Items/Placeables/CosmiliteBrick.cs new file mode 100644 index 0000000000..89df8b61ac --- /dev/null +++ b/Items/Placeables/CosmiliteBrick.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/CosmiliteBrick.png b/Items/Placeables/CosmiliteBrick.png new file mode 100644 index 0000000000..d866042045 Binary files /dev/null and b/Items/Placeables/CosmiliteBrick.png differ diff --git a/Items/Placeables/CosmiliteBrickWall.cs b/Items/Placeables/CosmiliteBrickWall.cs new file mode 100644 index 0000000000..91e7653fd5 --- /dev/null +++ b/Items/Placeables/CosmiliteBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteBrickWall.png b/Items/Placeables/CosmiliteBrickWall.png new file mode 100644 index 0000000000..3e912144c5 Binary files /dev/null and b/Items/Placeables/CosmiliteBrickWall.png differ diff --git a/Items/Placeables/CosmiliteCandelabra.cs b/Items/Placeables/CosmiliteCandelabra.cs new file mode 100644 index 0000000000..bedb1e5670 --- /dev/null +++ b/Items/Placeables/CosmiliteCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteCandelabra.png b/Items/Placeables/CosmiliteCandelabra.png new file mode 100644 index 0000000000..c9ed71d48c Binary files /dev/null and b/Items/Placeables/CosmiliteCandelabra.png differ diff --git a/Items/Placeables/CosmiliteCandle.cs b/Items/Placeables/CosmiliteCandle.cs new file mode 100644 index 0000000000..bae33ec212 --- /dev/null +++ b/Items/Placeables/CosmiliteCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteCandle.png b/Items/Placeables/CosmiliteCandle.png new file mode 100644 index 0000000000..1158a2c708 Binary files /dev/null and b/Items/Placeables/CosmiliteCandle.png differ diff --git a/Items/Placeables/CosmiliteChair.cs b/Items/Placeables/CosmiliteChair.cs new file mode 100644 index 0000000000..d30924e9d5 --- /dev/null +++ b/Items/Placeables/CosmiliteChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChair.png b/Items/Placeables/CosmiliteChair.png new file mode 100644 index 0000000000..0b66fa4776 Binary files /dev/null and b/Items/Placeables/CosmiliteChair.png differ diff --git a/Items/Placeables/CosmiliteChandelier.cs b/Items/Placeables/CosmiliteChandelier.cs new file mode 100644 index 0000000000..9b683fa5f5 --- /dev/null +++ b/Items/Placeables/CosmiliteChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChandelier.png b/Items/Placeables/CosmiliteChandelier.png new file mode 100644 index 0000000000..90fbcf69e9 Binary files /dev/null and b/Items/Placeables/CosmiliteChandelier.png differ diff --git a/Items/Placeables/CosmiliteChest.cs b/Items/Placeables/CosmiliteChest.cs new file mode 100644 index 0000000000..d69696fb36 --- /dev/null +++ b/Items/Placeables/CosmiliteChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteChest.png b/Items/Placeables/CosmiliteChest.png new file mode 100644 index 0000000000..82c3898689 Binary files /dev/null and b/Items/Placeables/CosmiliteChest.png differ diff --git a/Items/Placeables/CosmiliteClock.cs b/Items/Placeables/CosmiliteClock.cs new file mode 100644 index 0000000000..2c9347ea63 --- /dev/null +++ b/Items/Placeables/CosmiliteClock.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteClock.png b/Items/Placeables/CosmiliteClock.png new file mode 100644 index 0000000000..97af30d180 Binary files /dev/null and b/Items/Placeables/CosmiliteClock.png differ diff --git a/Items/Placeables/CosmiliteDoor.cs b/Items/Placeables/CosmiliteDoor.cs new file mode 100644 index 0000000000..2818af3d4b --- /dev/null +++ b/Items/Placeables/CosmiliteDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteDoor.png b/Items/Placeables/CosmiliteDoor.png new file mode 100644 index 0000000000..844d92bcb8 Binary files /dev/null and b/Items/Placeables/CosmiliteDoor.png differ diff --git a/Items/Placeables/CosmiliteDresser.cs b/Items/Placeables/CosmiliteDresser.cs new file mode 100644 index 0000000000..7eabb42924 --- /dev/null +++ b/Items/Placeables/CosmiliteDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteDresser.png b/Items/Placeables/CosmiliteDresser.png new file mode 100644 index 0000000000..b5eb75a1b1 Binary files /dev/null and b/Items/Placeables/CosmiliteDresser.png differ diff --git a/Items/Placeables/CosmiliteLamp.cs b/Items/Placeables/CosmiliteLamp.cs new file mode 100644 index 0000000000..0efc7374dd --- /dev/null +++ b/Items/Placeables/CosmiliteLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteLamp.png b/Items/Placeables/CosmiliteLamp.png new file mode 100644 index 0000000000..811204e1ca Binary files /dev/null and b/Items/Placeables/CosmiliteLamp.png differ diff --git a/Items/Placeables/CosmiliteLantern.cs b/Items/Placeables/CosmiliteLantern.cs new file mode 100644 index 0000000000..a63be5c0cb --- /dev/null +++ b/Items/Placeables/CosmiliteLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteLantern.png b/Items/Placeables/CosmiliteLantern.png new file mode 100644 index 0000000000..df60fdeae1 Binary files /dev/null and b/Items/Placeables/CosmiliteLantern.png differ diff --git a/Items/Placeables/CosmilitePiano.cs b/Items/Placeables/CosmilitePiano.cs new file mode 100644 index 0000000000..8878450b55 --- /dev/null +++ b/Items/Placeables/CosmilitePiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmilitePiano.png b/Items/Placeables/CosmilitePiano.png new file mode 100644 index 0000000000..c03c49e880 Binary files /dev/null and b/Items/Placeables/CosmilitePiano.png differ diff --git a/Items/Placeables/CosmilitePlatform.cs b/Items/Placeables/CosmilitePlatform.cs new file mode 100644 index 0000000000..a41a3a2e3b --- /dev/null +++ b/Items/Placeables/CosmilitePlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmilitePlatform.png b/Items/Placeables/CosmilitePlatform.png new file mode 100644 index 0000000000..0e17e67a21 Binary files /dev/null and b/Items/Placeables/CosmilitePlatform.png differ diff --git a/Items/Placeables/CosmiliteSink.cs b/Items/Placeables/CosmiliteSink.cs new file mode 100644 index 0000000000..3a5e917e1b --- /dev/null +++ b/Items/Placeables/CosmiliteSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteSink.png b/Items/Placeables/CosmiliteSink.png new file mode 100644 index 0000000000..7436b4dbf6 Binary files /dev/null and b/Items/Placeables/CosmiliteSink.png differ diff --git a/Items/Placeables/CosmiliteSofa.cs b/Items/Placeables/CosmiliteSofa.cs new file mode 100644 index 0000000000..2725ac0b18 --- /dev/null +++ b/Items/Placeables/CosmiliteSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteSofa.png b/Items/Placeables/CosmiliteSofa.png new file mode 100644 index 0000000000..115704278e Binary files /dev/null and b/Items/Placeables/CosmiliteSofa.png differ diff --git a/Items/Placeables/CosmiliteTable.cs b/Items/Placeables/CosmiliteTable.cs new file mode 100644 index 0000000000..3f5a470a0d --- /dev/null +++ b/Items/Placeables/CosmiliteTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteTable.png b/Items/Placeables/CosmiliteTable.png new file mode 100644 index 0000000000..fd9a5f3326 Binary files /dev/null and b/Items/Placeables/CosmiliteTable.png differ diff --git a/Items/Placeables/CosmiliteWorkbench.cs b/Items/Placeables/CosmiliteWorkbench.cs new file mode 100644 index 0000000000..47a614d14d --- /dev/null +++ b/Items/Placeables/CosmiliteWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CosmiliteWorkbench.png b/Items/Placeables/CosmiliteWorkbench.png new file mode 100644 index 0000000000..0e05faf405 Binary files /dev/null and b/Items/Placeables/CosmiliteWorkbench.png differ diff --git a/Items/Placeables/CrabulonMusicbox.cs b/Items/Placeables/CrabulonMusicbox.cs new file mode 100644 index 0000000000..e23b9b1f41 --- /dev/null +++ b/Items/Placeables/CrabulonMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CrabulonMusicbox.png b/Items/Placeables/CrabulonMusicbox.png new file mode 100644 index 0000000000..b2345a26aa Binary files /dev/null and b/Items/Placeables/CrabulonMusicbox.png differ diff --git a/Items/Placeables/CrabulonTrophy.cs b/Items/Placeables/CrabulonTrophy.cs new file mode 100644 index 0000000000..b9bed5c3c3 --- /dev/null +++ b/Items/Placeables/CrabulonTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CrabulonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 9; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CrabulonTrophy.png b/Items/Placeables/CrabulonTrophy.png new file mode 100644 index 0000000000..bb73082b74 Binary files /dev/null and b/Items/Placeables/CrabulonTrophy.png differ diff --git a/Items/Placeables/CryogenMusicbox.cs b/Items/Placeables/CryogenMusicbox.cs new file mode 100644 index 0000000000..7d17f80837 --- /dev/null +++ b/Items/Placeables/CryogenMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CryogenMusicbox.png b/Items/Placeables/CryogenMusicbox.png new file mode 100644 index 0000000000..be09d3295a Binary files /dev/null and b/Items/Placeables/CryogenMusicbox.png differ diff --git a/Items/Placeables/CryogenTrophy.cs b/Items/Placeables/CryogenTrophy.cs new file mode 100644 index 0000000000..8767e31a60 --- /dev/null +++ b/Items/Placeables/CryogenTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryogenTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 3; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CryogenTrophy.png b/Items/Placeables/CryogenTrophy.png new file mode 100644 index 0000000000..8bf385bc9c Binary files /dev/null and b/Items/Placeables/CryogenTrophy.png differ diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs new file mode 100644 index 0000000000..d285852434 --- /dev/null +++ b/Items/Placeables/CryonicBrick.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CryonicBrick.png b/Items/Placeables/CryonicBrick.png new file mode 100644 index 0000000000..feb6bd8988 Binary files /dev/null and b/Items/Placeables/CryonicBrick.png differ diff --git a/Items/Placeables/CryonicBrickWall.cs b/Items/Placeables/CryonicBrickWall.cs new file mode 100644 index 0000000000..efae140a94 --- /dev/null +++ b/Items/Placeables/CryonicBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CryonicBrickWall.png b/Items/Placeables/CryonicBrickWall.png new file mode 100644 index 0000000000..4135addb90 Binary files /dev/null and b/Items/Placeables/CryonicBrickWall.png differ diff --git a/Items/Placeables/CryonicOre.cs b/Items/Placeables/CryonicOre.cs new file mode 100644 index 0000000000..cfd1faf726 --- /dev/null +++ b/Items/Placeables/CryonicOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CryonicOre.png b/Items/Placeables/CryonicOre.png new file mode 100644 index 0000000000..f5c525e657 Binary files /dev/null and b/Items/Placeables/CryonicOre.png differ diff --git a/Items/Placeables/DesertScourgeMusicbox.cs b/Items/Placeables/DesertScourgeMusicbox.cs new file mode 100644 index 0000000000..9646203fdd --- /dev/null +++ b/Items/Placeables/DesertScourgeMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/DesertScourgeMusicbox.png b/Items/Placeables/DesertScourgeMusicbox.png new file mode 100644 index 0000000000..fbc0cac409 Binary files /dev/null and b/Items/Placeables/DesertScourgeMusicbox.png differ diff --git a/Items/Placeables/DesertScourgeTrophy.cs b/Items/Placeables/DesertScourgeTrophy.cs new file mode 100644 index 0000000000..99b7468007 --- /dev/null +++ b/Items/Placeables/DesertScourgeTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DesertScourgeTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 0; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/DesertScourgeTrophy.png b/Items/Placeables/DesertScourgeTrophy.png new file mode 100644 index 0000000000..2168a600ca Binary files /dev/null and b/Items/Placeables/DesertScourgeTrophy.png differ diff --git a/Items/Placeables/DevourerofGodsTrophy.cs b/Items/Placeables/DevourerofGodsTrophy.cs new file mode 100644 index 0000000000..a4478e27f5 --- /dev/null +++ b/Items/Placeables/DevourerofGodsTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DevourerofGodsTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Gods Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 14; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/DevourerofGodsTrophy.png b/Items/Placeables/DevourerofGodsTrophy.png new file mode 100644 index 0000000000..c35b800751 Binary files /dev/null and b/Items/Placeables/DevourerofGodsTrophy.png differ diff --git a/Items/Placeables/DoGMusicbox.cs b/Items/Placeables/DoGMusicbox.cs new file mode 100644 index 0000000000..5545fb3d1f --- /dev/null +++ b/Items/Placeables/DoGMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/DoGMusicbox.png b/Items/Placeables/DoGMusicbox.png new file mode 100644 index 0000000000..1399ba6588 Binary files /dev/null and b/Items/Placeables/DoGMusicbox.png differ diff --git a/Items/Placeables/DraedonsForge.cs b/Items/Placeables/DraedonsForge.cs new file mode 100644 index 0000000000..8e0703d406 --- /dev/null +++ b/Items/Placeables/DraedonsForge.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/DraedonsForge.png b/Items/Placeables/DraedonsForge.png new file mode 100644 index 0000000000..d0cad78ff5 Binary files /dev/null and b/Items/Placeables/DraedonsForge.png differ diff --git a/Items/Placeables/ExodiumClusterOre.cs b/Items/Placeables/ExodiumClusterOre.cs new file mode 100644 index 0000000000..36dee45430 --- /dev/null +++ b/Items/Placeables/ExodiumClusterOre.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ExodiumClusterOre.png b/Items/Placeables/ExodiumClusterOre.png new file mode 100644 index 0000000000..7baedbf6af Binary files /dev/null and b/Items/Placeables/ExodiumClusterOre.png differ diff --git a/Items/Placeables/GreenBrickWallUnsafe.cs b/Items/Placeables/GreenBrickWallUnsafe.cs new file mode 100644 index 0000000000..c887306439 --- /dev/null +++ b/Items/Placeables/GreenBrickWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/GreenBrickWallUnsafe.png b/Items/Placeables/GreenBrickWallUnsafe.png new file mode 100644 index 0000000000..3845c75d65 Binary files /dev/null and b/Items/Placeables/GreenBrickWallUnsafe.png differ diff --git a/Items/Placeables/GreenSlabWallUnsafe.cs b/Items/Placeables/GreenSlabWallUnsafe.cs new file mode 100644 index 0000000000..d2112e0103 --- /dev/null +++ b/Items/Placeables/GreenSlabWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonSlabUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/GreenSlabWallUnsafe.png b/Items/Placeables/GreenSlabWallUnsafe.png new file mode 100644 index 0000000000..706ced7d2a Binary files /dev/null and b/Items/Placeables/GreenSlabWallUnsafe.png differ diff --git a/Items/Placeables/GreenTiledWallUnsafe.cs b/Items/Placeables/GreenTiledWallUnsafe.cs new file mode 100644 index 0000000000..e516f3b82f --- /dev/null +++ b/Items/Placeables/GreenTiledWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonTileUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/GreenTiledWallUnsafe.png b/Items/Placeables/GreenTiledWallUnsafe.png new file mode 100644 index 0000000000..d41b950ead Binary files /dev/null and b/Items/Placeables/GreenTiledWallUnsafe.png differ diff --git a/Items/Placeables/HigherAbyssMusicbox.cs b/Items/Placeables/HigherAbyssMusicbox.cs new file mode 100644 index 0000000000..7cc79d578f --- /dev/null +++ b/Items/Placeables/HigherAbyssMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/HigherAbyssMusicbox.png b/Items/Placeables/HigherAbyssMusicbox.png new file mode 100644 index 0000000000..08fb7b72d0 Binary files /dev/null and b/Items/Placeables/HigherAbyssMusicbox.png differ diff --git a/Items/Placeables/HiveMindMusicbox.cs b/Items/Placeables/HiveMindMusicbox.cs new file mode 100644 index 0000000000..582a02ca3e --- /dev/null +++ b/Items/Placeables/HiveMindMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/HiveMindMusicbox.png b/Items/Placeables/HiveMindMusicbox.png new file mode 100644 index 0000000000..c14358b83b Binary files /dev/null and b/Items/Placeables/HiveMindMusicbox.png differ diff --git a/Items/Placeables/HiveMindTrophy.cs b/Items/Placeables/HiveMindTrophy.cs new file mode 100644 index 0000000000..5ea0a5c47f --- /dev/null +++ b/Items/Placeables/HiveMindTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class HiveMindTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Mind Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 8; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/HiveMindTrophy.png b/Items/Placeables/HiveMindTrophy.png new file mode 100644 index 0000000000..9235a5c86e Binary files /dev/null and b/Items/Placeables/HiveMindTrophy.png differ diff --git a/Items/Placeables/LeviathanTrophy.cs b/Items/Placeables/LeviathanTrophy.cs new file mode 100644 index 0000000000..73b9bfd319 --- /dev/null +++ b/Items/Placeables/LeviathanTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class LeviathanTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 5; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/LeviathanTrophy.png b/Items/Placeables/LeviathanTrophy.png new file mode 100644 index 0000000000..e9c5717b85 Binary files /dev/null and b/Items/Placeables/LeviathanTrophy.png differ diff --git a/Items/Placeables/LockedAshenChest.cs b/Items/Placeables/LockedAshenChest.cs new file mode 100644 index 0000000000..3d96a7841b --- /dev/null +++ b/Items/Placeables/LockedAshenChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/LockedAshenChest.png b/Items/Placeables/LockedAshenChest.png new file mode 100644 index 0000000000..36ef060a8a Binary files /dev/null and b/Items/Placeables/LockedAshenChest.png differ diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs new file mode 100644 index 0000000000..e9b23999e5 --- /dev/null +++ b/Items/Placeables/PerennialBrick.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PerennialBrick.png b/Items/Placeables/PerennialBrick.png new file mode 100644 index 0000000000..bb137e0159 Binary files /dev/null and b/Items/Placeables/PerennialBrick.png differ diff --git a/Items/Placeables/PerennialBrickWall.cs b/Items/Placeables/PerennialBrickWall.cs new file mode 100644 index 0000000000..c3e17dcf02 --- /dev/null +++ b/Items/Placeables/PerennialBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PerennialBrickWall.png b/Items/Placeables/PerennialBrickWall.png new file mode 100644 index 0000000000..7d7510c8b6 Binary files /dev/null and b/Items/Placeables/PerennialBrickWall.png differ diff --git a/Items/Placeables/PerennialOre.cs b/Items/Placeables/PerennialOre.cs new file mode 100644 index 0000000000..dd4b4c2719 --- /dev/null +++ b/Items/Placeables/PerennialOre.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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 new file mode 100644 index 0000000000..0fbaada45c Binary files /dev/null and b/Items/Placeables/PerennialOre.png differ diff --git a/Items/Placeables/PerforatorMusicbox.cs b/Items/Placeables/PerforatorMusicbox.cs new file mode 100644 index 0000000000..799edbf6ce --- /dev/null +++ b/Items/Placeables/PerforatorMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PerforatorMusicbox.png b/Items/Placeables/PerforatorMusicbox.png new file mode 100644 index 0000000000..77bcb5b9bb Binary files /dev/null and b/Items/Placeables/PerforatorMusicbox.png differ diff --git a/Items/Placeables/PerforatorTrophy.cs b/Items/Placeables/PerforatorTrophy.cs new file mode 100644 index 0000000000..1c85e24554 --- /dev/null +++ b/Items/Placeables/PerforatorTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerforatorTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 1; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PerforatorTrophy.png b/Items/Placeables/PerforatorTrophy.png new file mode 100644 index 0000000000..c274acdcab Binary files /dev/null and b/Items/Placeables/PerforatorTrophy.png differ diff --git a/Items/Placeables/PinkBrickWallUnsafe.cs b/Items/Placeables/PinkBrickWallUnsafe.cs new file mode 100644 index 0000000000..f57f86effb --- /dev/null +++ b/Items/Placeables/PinkBrickWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PinkBrickWallUnsafe.png b/Items/Placeables/PinkBrickWallUnsafe.png new file mode 100644 index 0000000000..92154bd268 Binary files /dev/null and b/Items/Placeables/PinkBrickWallUnsafe.png differ diff --git a/Items/Placeables/PinkSlabWallUnsafe.cs b/Items/Placeables/PinkSlabWallUnsafe.cs new file mode 100644 index 0000000000..f669165321 --- /dev/null +++ b/Items/Placeables/PinkSlabWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonSlabUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PinkSlabWallUnsafe.png b/Items/Placeables/PinkSlabWallUnsafe.png new file mode 100644 index 0000000000..0003531ce3 Binary files /dev/null and b/Items/Placeables/PinkSlabWallUnsafe.png differ diff --git a/Items/Placeables/PinkTiledWallUnsafe.cs b/Items/Placeables/PinkTiledWallUnsafe.cs new file mode 100644 index 0000000000..15ad6a5c90 --- /dev/null +++ b/Items/Placeables/PinkTiledWallUnsafe.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonTileUnsafe; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PinkTiledWallUnsafe.png b/Items/Placeables/PinkTiledWallUnsafe.png new file mode 100644 index 0000000000..4fa20f75c7 Binary files /dev/null and b/Items/Placeables/PinkTiledWallUnsafe.png differ diff --git a/Items/Placeables/PlaguebringerGoliathTrophy.cs b/Items/Placeables/PlaguebringerGoliathTrophy.cs new file mode 100644 index 0000000000..eec794633a --- /dev/null +++ b/Items/Placeables/PlaguebringerGoliathTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PlaguebringerGoliathTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Goliath Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 4; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PlaguebringerGoliathTrophy.png b/Items/Placeables/PlaguebringerGoliathTrophy.png new file mode 100644 index 0000000000..2387ba0550 Binary files /dev/null and b/Items/Placeables/PlaguebringerGoliathTrophy.png differ diff --git a/Items/Placeables/PlaguebringerMusicbox.cs b/Items/Placeables/PlaguebringerMusicbox.cs new file mode 100644 index 0000000000..a265c224d5 --- /dev/null +++ b/Items/Placeables/PlaguebringerMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PlaguebringerMusicbox.png b/Items/Placeables/PlaguebringerMusicbox.png new file mode 100644 index 0000000000..08f6764017 Binary files /dev/null and b/Items/Placeables/PlaguebringerMusicbox.png differ diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs new file mode 100644 index 0000000000..4692929ad7 --- /dev/null +++ b/Items/Placeables/PlantyMush.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/PlantyMush.png b/Items/Placeables/PlantyMush.png new file mode 100644 index 0000000000..7c7ed2d2b5 Binary files /dev/null and b/Items/Placeables/PlantyMush.png differ diff --git a/Items/Placeables/PolterghastMusicbox.cs b/Items/Placeables/PolterghastMusicbox.cs new file mode 100644 index 0000000000..06236fbf58 --- /dev/null +++ b/Items/Placeables/PolterghastMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PolterghastMusicbox.png b/Items/Placeables/PolterghastMusicbox.png new file mode 100644 index 0000000000..2f6b8fe438 Binary files /dev/null and b/Items/Placeables/PolterghastMusicbox.png differ diff --git a/Items/Placeables/PolterghastTrophy.cs b/Items/Placeables/PolterghastTrophy.cs new file mode 100644 index 0000000000..4dc9d7bcdc --- /dev/null +++ b/Items/Placeables/PolterghastTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PolterghastTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 17; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/PolterghastTrophy.png b/Items/Placeables/PolterghastTrophy.png new file mode 100644 index 0000000000..a7616c86a9 Binary files /dev/null and b/Items/Placeables/PolterghastTrophy.png differ diff --git a/Items/Placeables/ProfanedBath.cs b/Items/Placeables/ProfanedBath.cs new file mode 100644 index 0000000000..70da3e716c --- /dev/null +++ b/Items/Placeables/ProfanedBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedBath.png b/Items/Placeables/ProfanedBath.png new file mode 100644 index 0000000000..3456120821 Binary files /dev/null and b/Items/Placeables/ProfanedBath.png differ diff --git a/Items/Placeables/ProfanedBed.cs b/Items/Placeables/ProfanedBed.cs new file mode 100644 index 0000000000..e09716241a --- /dev/null +++ b/Items/Placeables/ProfanedBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedBed.png b/Items/Placeables/ProfanedBed.png new file mode 100644 index 0000000000..c24b7b394c Binary files /dev/null and b/Items/Placeables/ProfanedBed.png differ diff --git a/Items/Placeables/ProfanedBench.cs b/Items/Placeables/ProfanedBench.cs new file mode 100644 index 0000000000..d32f3ccb26 --- /dev/null +++ b/Items/Placeables/ProfanedBench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedBench.png b/Items/Placeables/ProfanedBench.png new file mode 100644 index 0000000000..a9e78d38a3 Binary files /dev/null and b/Items/Placeables/ProfanedBench.png differ diff --git a/Items/Placeables/ProfanedBookcase.cs b/Items/Placeables/ProfanedBookcase.cs new file mode 100644 index 0000000000..f3481c3103 --- /dev/null +++ b/Items/Placeables/ProfanedBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedBookcase.png b/Items/Placeables/ProfanedBookcase.png new file mode 100644 index 0000000000..ab629b038c Binary files /dev/null and b/Items/Placeables/ProfanedBookcase.png differ diff --git a/Items/Placeables/ProfanedCandelabra.cs b/Items/Placeables/ProfanedCandelabra.cs new file mode 100644 index 0000000000..565b9084ba --- /dev/null +++ b/Items/Placeables/ProfanedCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedCandelabra.png b/Items/Placeables/ProfanedCandelabra.png new file mode 100644 index 0000000000..d4938e6d8a Binary files /dev/null and b/Items/Placeables/ProfanedCandelabra.png differ diff --git a/Items/Placeables/ProfanedCandle.cs b/Items/Placeables/ProfanedCandle.cs new file mode 100644 index 0000000000..a9be8b24d1 --- /dev/null +++ b/Items/Placeables/ProfanedCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedCandle.png b/Items/Placeables/ProfanedCandle.png new file mode 100644 index 0000000000..90a3441da2 Binary files /dev/null and b/Items/Placeables/ProfanedCandle.png differ diff --git a/Items/Placeables/ProfanedChair.cs b/Items/Placeables/ProfanedChair.cs new file mode 100644 index 0000000000..9d62af6076 --- /dev/null +++ b/Items/Placeables/ProfanedChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedChair.png b/Items/Placeables/ProfanedChair.png new file mode 100644 index 0000000000..2e4cb1f12a Binary files /dev/null and b/Items/Placeables/ProfanedChair.png differ diff --git a/Items/Placeables/ProfanedChandelier.cs b/Items/Placeables/ProfanedChandelier.cs new file mode 100644 index 0000000000..3220ebce57 --- /dev/null +++ b/Items/Placeables/ProfanedChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedChandelier.png b/Items/Placeables/ProfanedChandelier.png new file mode 100644 index 0000000000..45aec26ba9 Binary files /dev/null and b/Items/Placeables/ProfanedChandelier.png differ diff --git a/Items/Placeables/ProfanedChest.cs b/Items/Placeables/ProfanedChest.cs new file mode 100644 index 0000000000..776a59a598 --- /dev/null +++ b/Items/Placeables/ProfanedChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedChest.png b/Items/Placeables/ProfanedChest.png new file mode 100644 index 0000000000..ba4e9da5b6 Binary files /dev/null and b/Items/Placeables/ProfanedChest.png differ diff --git a/Items/Placeables/ProfanedClock.cs b/Items/Placeables/ProfanedClock.cs new file mode 100644 index 0000000000..bb3b1de5e4 --- /dev/null +++ b/Items/Placeables/ProfanedClock.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedClock.png b/Items/Placeables/ProfanedClock.png new file mode 100644 index 0000000000..cdd74e5b97 Binary files /dev/null and b/Items/Placeables/ProfanedClock.png differ diff --git a/Items/Placeables/ProfanedCrystal.cs b/Items/Placeables/ProfanedCrystal.cs new file mode 100644 index 0000000000..22133f8926 --- /dev/null +++ b/Items/Placeables/ProfanedCrystal.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/ProfanedCrystal.png b/Items/Placeables/ProfanedCrystal.png new file mode 100644 index 0000000000..5f5defd3b1 Binary files /dev/null and b/Items/Placeables/ProfanedCrystal.png differ diff --git a/Items/Placeables/ProfanedCrystalWall.cs b/Items/Placeables/ProfanedCrystalWall.cs new file mode 100644 index 0000000000..457d830fd3 --- /dev/null +++ b/Items/Placeables/ProfanedCrystalWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedCrystalWall.png b/Items/Placeables/ProfanedCrystalWall.png new file mode 100644 index 0000000000..a833647b2e Binary files /dev/null and b/Items/Placeables/ProfanedCrystalWall.png differ diff --git a/Items/Placeables/ProfanedDoor.cs b/Items/Placeables/ProfanedDoor.cs new file mode 100644 index 0000000000..bbf0cb3552 --- /dev/null +++ b/Items/Placeables/ProfanedDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedDoor.png b/Items/Placeables/ProfanedDoor.png new file mode 100644 index 0000000000..76a73747df Binary files /dev/null and b/Items/Placeables/ProfanedDoor.png differ diff --git a/Items/Placeables/ProfanedDresser.cs b/Items/Placeables/ProfanedDresser.cs new file mode 100644 index 0000000000..109d2d9074 --- /dev/null +++ b/Items/Placeables/ProfanedDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedDresser.png b/Items/Placeables/ProfanedDresser.png new file mode 100644 index 0000000000..f22517a900 Binary files /dev/null and b/Items/Placeables/ProfanedDresser.png differ diff --git a/Items/Placeables/ProfanedGuardianMusicbox.cs b/Items/Placeables/ProfanedGuardianMusicbox.cs new file mode 100644 index 0000000000..b8d7c3c665 --- /dev/null +++ b/Items/Placeables/ProfanedGuardianMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedGuardianMusicbox.png b/Items/Placeables/ProfanedGuardianMusicbox.png new file mode 100644 index 0000000000..f181e63a64 Binary files /dev/null and b/Items/Placeables/ProfanedGuardianMusicbox.png differ diff --git a/Items/Placeables/ProfanedLamp.cs b/Items/Placeables/ProfanedLamp.cs new file mode 100644 index 0000000000..545552b2ef --- /dev/null +++ b/Items/Placeables/ProfanedLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedLamp.png b/Items/Placeables/ProfanedLamp.png new file mode 100644 index 0000000000..73fd8cb549 Binary files /dev/null and b/Items/Placeables/ProfanedLamp.png differ diff --git a/Items/Placeables/ProfanedLantern.cs b/Items/Placeables/ProfanedLantern.cs new file mode 100644 index 0000000000..abbef8c8c3 --- /dev/null +++ b/Items/Placeables/ProfanedLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedLantern.png b/Items/Placeables/ProfanedLantern.png new file mode 100644 index 0000000000..aa62b3234d Binary files /dev/null and b/Items/Placeables/ProfanedLantern.png differ diff --git a/Items/Placeables/ProfanedPiano.cs b/Items/Placeables/ProfanedPiano.cs new file mode 100644 index 0000000000..faeb2aa195 --- /dev/null +++ b/Items/Placeables/ProfanedPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedPiano.png b/Items/Placeables/ProfanedPiano.png new file mode 100644 index 0000000000..0819ea37a6 Binary files /dev/null and b/Items/Placeables/ProfanedPiano.png differ diff --git a/Items/Placeables/ProfanedPlatform.cs b/Items/Placeables/ProfanedPlatform.cs new file mode 100644 index 0000000000..9746e2f3c1 --- /dev/null +++ b/Items/Placeables/ProfanedPlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedPlatform.png b/Items/Placeables/ProfanedPlatform.png new file mode 100644 index 0000000000..d7a1eb192a Binary files /dev/null and b/Items/Placeables/ProfanedPlatform.png differ diff --git a/Items/Placeables/ProfanedRock.cs b/Items/Placeables/ProfanedRock.cs new file mode 100644 index 0000000000..5e38a41ac4 --- /dev/null +++ b/Items/Placeables/ProfanedRock.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/ProfanedRock.png b/Items/Placeables/ProfanedRock.png new file mode 100644 index 0000000000..03f13df91e Binary files /dev/null and b/Items/Placeables/ProfanedRock.png differ diff --git a/Items/Placeables/ProfanedRockWall.cs b/Items/Placeables/ProfanedRockWall.cs new file mode 100644 index 0000000000..8827bbecfd --- /dev/null +++ b/Items/Placeables/ProfanedRockWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedRockWall.png b/Items/Placeables/ProfanedRockWall.png new file mode 100644 index 0000000000..ec0e3ab417 Binary files /dev/null and b/Items/Placeables/ProfanedRockWall.png differ diff --git a/Items/Placeables/ProfanedSink.cs b/Items/Placeables/ProfanedSink.cs new file mode 100644 index 0000000000..8d74fee2f6 --- /dev/null +++ b/Items/Placeables/ProfanedSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedSink.png b/Items/Placeables/ProfanedSink.png new file mode 100644 index 0000000000..426985961d Binary files /dev/null and b/Items/Placeables/ProfanedSink.png differ diff --git a/Items/Placeables/ProfanedSlab.cs b/Items/Placeables/ProfanedSlab.cs new file mode 100644 index 0000000000..233d690c0b --- /dev/null +++ b/Items/Placeables/ProfanedSlab.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/ProfanedSlab.png b/Items/Placeables/ProfanedSlab.png new file mode 100644 index 0000000000..903d33e23e Binary files /dev/null and b/Items/Placeables/ProfanedSlab.png differ diff --git a/Items/Placeables/ProfanedSlabWall.cs b/Items/Placeables/ProfanedSlabWall.cs new file mode 100644 index 0000000000..15f52460fb --- /dev/null +++ b/Items/Placeables/ProfanedSlabWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedSlabWall.png b/Items/Placeables/ProfanedSlabWall.png new file mode 100644 index 0000000000..a5b87bb15e Binary files /dev/null and b/Items/Placeables/ProfanedSlabWall.png differ diff --git a/Items/Placeables/ProfanedTable.cs b/Items/Placeables/ProfanedTable.cs new file mode 100644 index 0000000000..0a0236481b --- /dev/null +++ b/Items/Placeables/ProfanedTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedTable.png b/Items/Placeables/ProfanedTable.png new file mode 100644 index 0000000000..4f44df5866 Binary files /dev/null and b/Items/Placeables/ProfanedTable.png differ diff --git a/Items/Placeables/ProfanedWorkbench.cs b/Items/Placeables/ProfanedWorkbench.cs new file mode 100644 index 0000000000..ec1e31b8cb --- /dev/null +++ b/Items/Placeables/ProfanedWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProfanedWorkbench.png b/Items/Placeables/ProfanedWorkbench.png new file mode 100644 index 0000000000..ec9ce7fc8a Binary files /dev/null and b/Items/Placeables/ProfanedWorkbench.png differ diff --git a/Items/Placeables/ProvidenceMusicbox.cs b/Items/Placeables/ProvidenceMusicbox.cs new file mode 100644 index 0000000000..c014dc0271 --- /dev/null +++ b/Items/Placeables/ProvidenceMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProvidenceMusicbox.png b/Items/Placeables/ProvidenceMusicbox.png new file mode 100644 index 0000000000..1b24633b53 Binary files /dev/null and b/Items/Placeables/ProvidenceMusicbox.png differ diff --git a/Items/Placeables/ProvidenceTrophy.cs b/Items/Placeables/ProvidenceTrophy.cs new file mode 100644 index 0000000000..ebf20e157f --- /dev/null +++ b/Items/Placeables/ProvidenceTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProvidenceTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 6; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/ProvidenceTrophy.png b/Items/Placeables/ProvidenceTrophy.png new file mode 100644 index 0000000000..4180d97c3d Binary files /dev/null and b/Items/Placeables/ProvidenceTrophy.png differ diff --git a/Items/Placeables/RavagerMusicbox.cs b/Items/Placeables/RavagerMusicbox.cs new file mode 100644 index 0000000000..927cd3366a --- /dev/null +++ b/Items/Placeables/RavagerMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/RavagerMusicbox.png b/Items/Placeables/RavagerMusicbox.png new file mode 100644 index 0000000000..ce1c98ed2e Binary files /dev/null and b/Items/Placeables/RavagerMusicbox.png differ diff --git a/Items/Placeables/RunicProfanedBrick.cs b/Items/Placeables/RunicProfanedBrick.cs new file mode 100644 index 0000000000..f123690532 --- /dev/null +++ b/Items/Placeables/RunicProfanedBrick.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/RunicProfanedBrick.png b/Items/Placeables/RunicProfanedBrick.png new file mode 100644 index 0000000000..d4cab2f5fb Binary files /dev/null and b/Items/Placeables/RunicProfanedBrick.png differ diff --git a/Items/Placeables/RunicProfanedBrickWall.cs b/Items/Placeables/RunicProfanedBrickWall.cs new file mode 100644 index 0000000000..d21674dd3a --- /dev/null +++ b/Items/Placeables/RunicProfanedBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/RunicProfanedBrickWall.png b/Items/Placeables/RunicProfanedBrickWall.png new file mode 100644 index 0000000000..c025a37396 Binary files /dev/null and b/Items/Placeables/RunicProfanedBrickWall.png differ diff --git a/Items/Placeables/SeaPrism.png b/Items/Placeables/SeaPrism.png new file mode 100644 index 0000000000..71fb29ca28 Binary files /dev/null and b/Items/Placeables/SeaPrism.png differ diff --git a/Items/Placeables/SignusMusicbox.cs b/Items/Placeables/SignusMusicbox.cs new file mode 100644 index 0000000000..c6808ee467 --- /dev/null +++ b/Items/Placeables/SignusMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SignusMusicbox.png b/Items/Placeables/SignusMusicbox.png new file mode 100644 index 0000000000..ec9dfbb849 Binary files /dev/null and b/Items/Placeables/SignusMusicbox.png differ diff --git a/Items/Placeables/SignusTrophy.cs b/Items/Placeables/SignusTrophy.cs new file mode 100644 index 0000000000..3a5a2f992e --- /dev/null +++ b/Items/Placeables/SignusTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SignusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signus Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 11; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SignusTrophy.png b/Items/Placeables/SignusTrophy.png new file mode 100644 index 0000000000..5b56d55359 Binary files /dev/null and b/Items/Placeables/SignusTrophy.png differ diff --git a/Items/Placeables/SlimeGodMusicbox.cs b/Items/Placeables/SlimeGodMusicbox.cs new file mode 100644 index 0000000000..1f50752db6 --- /dev/null +++ b/Items/Placeables/SlimeGodMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SlimeGodMusicbox.png b/Items/Placeables/SlimeGodMusicbox.png new file mode 100644 index 0000000000..7aae919009 Binary files /dev/null and b/Items/Placeables/SlimeGodMusicbox.png differ diff --git a/Items/Placeables/SlimeGodTrophy.cs b/Items/Placeables/SlimeGodTrophy.cs new file mode 100644 index 0000000000..455e6f833b --- /dev/null +++ b/Items/Placeables/SlimeGodTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SlimeGodTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 2; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SlimeGodTrophy.png b/Items/Placeables/SlimeGodTrophy.png new file mode 100644 index 0000000000..c5e6a34300 Binary files /dev/null and b/Items/Placeables/SlimeGodTrophy.png differ diff --git a/Items/Placeables/SmoothAbyssGravel.cs b/Items/Placeables/SmoothAbyssGravel.cs new file mode 100644 index 0000000000..dcc04bb958 --- /dev/null +++ b/Items/Placeables/SmoothAbyssGravel.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/SmoothAbyssGravel.png b/Items/Placeables/SmoothAbyssGravel.png new file mode 100644 index 0000000000..b69fa23fa9 Binary files /dev/null and b/Items/Placeables/SmoothAbyssGravel.png differ diff --git a/Items/Placeables/SmoothAbyssGravelPlatform.cs b/Items/Placeables/SmoothAbyssGravelPlatform.cs new file mode 100644 index 0000000000..38a0ac885f --- /dev/null +++ b/Items/Placeables/SmoothAbyssGravelPlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SmoothAbyssGravelPlatform.png b/Items/Placeables/SmoothAbyssGravelPlatform.png new file mode 100644 index 0000000000..5399f388c3 Binary files /dev/null and b/Items/Placeables/SmoothAbyssGravelPlatform.png differ diff --git a/Items/Placeables/SmoothAbyssGravelWall.cs b/Items/Placeables/SmoothAbyssGravelWall.cs new file mode 100644 index 0000000000..0906f52be5 --- /dev/null +++ b/Items/Placeables/SmoothAbyssGravelWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SmoothAbyssGravelWall.png b/Items/Placeables/SmoothAbyssGravelWall.png new file mode 100644 index 0000000000..abb66f2d9c Binary files /dev/null and b/Items/Placeables/SmoothAbyssGravelWall.png differ diff --git a/Items/Placeables/SmoothBrimstoneSlag.cs b/Items/Placeables/SmoothBrimstoneSlag.cs new file mode 100644 index 0000000000..150dbdbd10 --- /dev/null +++ b/Items/Placeables/SmoothBrimstoneSlag.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SmoothBrimstoneSlag.png b/Items/Placeables/SmoothBrimstoneSlag.png new file mode 100644 index 0000000000..28f1fc7cbf Binary files /dev/null and b/Items/Placeables/SmoothBrimstoneSlag.png differ diff --git a/Items/Placeables/SmoothBrimstoneSlagWall.cs b/Items/Placeables/SmoothBrimstoneSlagWall.cs new file mode 100644 index 0000000000..38fa36044e --- /dev/null +++ b/Items/Placeables/SmoothBrimstoneSlagWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SmoothBrimstoneSlagWall.png b/Items/Placeables/SmoothBrimstoneSlagWall.png new file mode 100644 index 0000000000..bc60038722 Binary files /dev/null and b/Items/Placeables/SmoothBrimstoneSlagWall.png differ diff --git a/Items/Placeables/SmoothVoidstone.cs b/Items/Placeables/SmoothVoidstone.cs new file mode 100644 index 0000000000..1a35c2bdc3 --- /dev/null +++ b/Items/Placeables/SmoothVoidstone.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SmoothVoidstone.png b/Items/Placeables/SmoothVoidstone.png new file mode 100644 index 0000000000..6f096fe018 Binary files /dev/null and b/Items/Placeables/SmoothVoidstone.png differ diff --git a/Items/Placeables/SmoothVoidstonePlatform.cs b/Items/Placeables/SmoothVoidstonePlatform.cs new file mode 100644 index 0000000000..624e8e2fb7 --- /dev/null +++ b/Items/Placeables/SmoothVoidstonePlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SmoothVoidstonePlatform.png b/Items/Placeables/SmoothVoidstonePlatform.png new file mode 100644 index 0000000000..a4f87d3144 Binary files /dev/null and b/Items/Placeables/SmoothVoidstonePlatform.png differ diff --git a/Items/Placeables/SmoothVoidstoneWall.cs b/Items/Placeables/SmoothVoidstoneWall.cs new file mode 100644 index 0000000000..2a4249ffc3 --- /dev/null +++ b/Items/Placeables/SmoothVoidstoneWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SmoothVoidstoneWall.png b/Items/Placeables/SmoothVoidstoneWall.png new file mode 100644 index 0000000000..923591f501 Binary files /dev/null and b/Items/Placeables/SmoothVoidstoneWall.png differ diff --git a/Items/Placeables/StaticRefiner.cs b/Items/Placeables/StaticRefiner.cs new file mode 100644 index 0000000000..10bd599c98 --- /dev/null +++ b/Items/Placeables/StaticRefiner.cs @@ -0,0 +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(); + // } + } +} \ No newline at end of file diff --git a/Items/Placeables/StaticRefiner.png b/Items/Placeables/StaticRefiner.png new file mode 100644 index 0000000000..d4a0bad1c4 Binary files /dev/null and b/Items/Placeables/StaticRefiner.png differ diff --git a/Items/Placeables/StatigelBath.cs b/Items/Placeables/StatigelBath.cs new file mode 100644 index 0000000000..eb53120ee4 --- /dev/null +++ b/Items/Placeables/StatigelBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelBath.png b/Items/Placeables/StatigelBath.png new file mode 100644 index 0000000000..bdc5ea4b9b Binary files /dev/null and b/Items/Placeables/StatigelBath.png differ diff --git a/Items/Placeables/StatigelBed.cs b/Items/Placeables/StatigelBed.cs new file mode 100644 index 0000000000..cbd3c481f0 --- /dev/null +++ b/Items/Placeables/StatigelBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelBed.png b/Items/Placeables/StatigelBed.png new file mode 100644 index 0000000000..48370915a4 Binary files /dev/null and b/Items/Placeables/StatigelBed.png differ diff --git a/Items/Placeables/StatigelBlock.cs b/Items/Placeables/StatigelBlock.cs new file mode 100644 index 0000000000..60903d2d09 --- /dev/null +++ b/Items/Placeables/StatigelBlock.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/StatigelBlock.png b/Items/Placeables/StatigelBlock.png new file mode 100644 index 0000000000..1f06722c90 Binary files /dev/null and b/Items/Placeables/StatigelBlock.png differ diff --git a/Items/Placeables/StatigelBookcase.cs b/Items/Placeables/StatigelBookcase.cs new file mode 100644 index 0000000000..76e569b2d9 --- /dev/null +++ b/Items/Placeables/StatigelBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelBookcase.png b/Items/Placeables/StatigelBookcase.png new file mode 100644 index 0000000000..b8837ea8c7 Binary files /dev/null and b/Items/Placeables/StatigelBookcase.png differ diff --git a/Items/Placeables/StatigelCandelabra.cs b/Items/Placeables/StatigelCandelabra.cs new file mode 100644 index 0000000000..0523db8212 --- /dev/null +++ b/Items/Placeables/StatigelCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelCandelabra.png b/Items/Placeables/StatigelCandelabra.png new file mode 100644 index 0000000000..b895c5f96a Binary files /dev/null and b/Items/Placeables/StatigelCandelabra.png differ diff --git a/Items/Placeables/StatigelCandle.cs b/Items/Placeables/StatigelCandle.cs new file mode 100644 index 0000000000..1695af3ad4 --- /dev/null +++ b/Items/Placeables/StatigelCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelCandle.png b/Items/Placeables/StatigelCandle.png new file mode 100644 index 0000000000..ce32043c36 Binary files /dev/null and b/Items/Placeables/StatigelCandle.png differ diff --git a/Items/Placeables/StatigelChair.cs b/Items/Placeables/StatigelChair.cs new file mode 100644 index 0000000000..e46fa1a9b4 --- /dev/null +++ b/Items/Placeables/StatigelChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelChair.png b/Items/Placeables/StatigelChair.png new file mode 100644 index 0000000000..6be1038cd2 Binary files /dev/null and b/Items/Placeables/StatigelChair.png differ diff --git a/Items/Placeables/StatigelChandelier.cs b/Items/Placeables/StatigelChandelier.cs new file mode 100644 index 0000000000..d2b262c8f4 --- /dev/null +++ b/Items/Placeables/StatigelChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelChandelier.png b/Items/Placeables/StatigelChandelier.png new file mode 100644 index 0000000000..c83bf0544a Binary files /dev/null and b/Items/Placeables/StatigelChandelier.png differ diff --git a/Items/Placeables/StatigelChest.cs b/Items/Placeables/StatigelChest.cs new file mode 100644 index 0000000000..44a1837a55 --- /dev/null +++ b/Items/Placeables/StatigelChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelChest.png b/Items/Placeables/StatigelChest.png new file mode 100644 index 0000000000..a54eec82ba Binary files /dev/null and b/Items/Placeables/StatigelChest.png differ diff --git a/Items/Placeables/StatigelClock.cs b/Items/Placeables/StatigelClock.cs new file mode 100644 index 0000000000..d06cf5ed78 --- /dev/null +++ b/Items/Placeables/StatigelClock.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelClock.png b/Items/Placeables/StatigelClock.png new file mode 100644 index 0000000000..8ac2c4e253 Binary files /dev/null and b/Items/Placeables/StatigelClock.png differ diff --git a/Items/Placeables/StatigelDoor.cs b/Items/Placeables/StatigelDoor.cs new file mode 100644 index 0000000000..5c4eed6458 --- /dev/null +++ b/Items/Placeables/StatigelDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelDoor.png b/Items/Placeables/StatigelDoor.png new file mode 100644 index 0000000000..96cbbabe23 Binary files /dev/null and b/Items/Placeables/StatigelDoor.png differ diff --git a/Items/Placeables/StatigelDresser.cs b/Items/Placeables/StatigelDresser.cs new file mode 100644 index 0000000000..529983eeda --- /dev/null +++ b/Items/Placeables/StatigelDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelDresser.png b/Items/Placeables/StatigelDresser.png new file mode 100644 index 0000000000..68159bf502 Binary files /dev/null and b/Items/Placeables/StatigelDresser.png differ diff --git a/Items/Placeables/StatigelLamp.cs b/Items/Placeables/StatigelLamp.cs new file mode 100644 index 0000000000..f679142660 --- /dev/null +++ b/Items/Placeables/StatigelLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelLamp.png b/Items/Placeables/StatigelLamp.png new file mode 100644 index 0000000000..6c1f78be7d Binary files /dev/null and b/Items/Placeables/StatigelLamp.png differ diff --git a/Items/Placeables/StatigelLantern.cs b/Items/Placeables/StatigelLantern.cs new file mode 100644 index 0000000000..4c76e691b2 --- /dev/null +++ b/Items/Placeables/StatigelLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelLantern.png b/Items/Placeables/StatigelLantern.png new file mode 100644 index 0000000000..6eca920694 Binary files /dev/null and b/Items/Placeables/StatigelLantern.png differ diff --git a/Items/Placeables/StatigelPiano.cs b/Items/Placeables/StatigelPiano.cs new file mode 100644 index 0000000000..71f5de701e --- /dev/null +++ b/Items/Placeables/StatigelPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelPiano.png b/Items/Placeables/StatigelPiano.png new file mode 100644 index 0000000000..3ae9122d37 Binary files /dev/null and b/Items/Placeables/StatigelPiano.png differ diff --git a/Items/Placeables/StatigelPlatform.cs b/Items/Placeables/StatigelPlatform.cs new file mode 100644 index 0000000000..9e82ff9b5c --- /dev/null +++ b/Items/Placeables/StatigelPlatform.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelPlatform.png b/Items/Placeables/StatigelPlatform.png new file mode 100644 index 0000000000..6f17f78e08 Binary files /dev/null and b/Items/Placeables/StatigelPlatform.png differ diff --git a/Items/Placeables/StatigelSink.cs b/Items/Placeables/StatigelSink.cs new file mode 100644 index 0000000000..2fa2571281 --- /dev/null +++ b/Items/Placeables/StatigelSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelSink.png b/Items/Placeables/StatigelSink.png new file mode 100644 index 0000000000..dc0aef798d Binary files /dev/null and b/Items/Placeables/StatigelSink.png differ diff --git a/Items/Placeables/StatigelSofa.cs b/Items/Placeables/StatigelSofa.cs new file mode 100644 index 0000000000..69e1702b07 --- /dev/null +++ b/Items/Placeables/StatigelSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelSofa.png b/Items/Placeables/StatigelSofa.png new file mode 100644 index 0000000000..85d2e07d00 Binary files /dev/null and b/Items/Placeables/StatigelSofa.png differ diff --git a/Items/Placeables/StatigelTable.cs b/Items/Placeables/StatigelTable.cs new file mode 100644 index 0000000000..6477d2da32 --- /dev/null +++ b/Items/Placeables/StatigelTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelTable.png b/Items/Placeables/StatigelTable.png new file mode 100644 index 0000000000..e12c16472f Binary files /dev/null and b/Items/Placeables/StatigelTable.png differ diff --git a/Items/Placeables/StatigelWall.cs b/Items/Placeables/StatigelWall.cs new file mode 100644 index 0000000000..854790ef2e --- /dev/null +++ b/Items/Placeables/StatigelWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelWall.png b/Items/Placeables/StatigelWall.png new file mode 100644 index 0000000000..f4a2d26870 Binary files /dev/null and b/Items/Placeables/StatigelWall.png differ diff --git a/Items/Placeables/StatigelWorkbench.cs b/Items/Placeables/StatigelWorkbench.cs new file mode 100644 index 0000000000..75968c860c --- /dev/null +++ b/Items/Placeables/StatigelWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StatigelWorkbench.png b/Items/Placeables/StatigelWorkbench.png new file mode 100644 index 0000000000..7570010fab Binary files /dev/null and b/Items/Placeables/StatigelWorkbench.png differ diff --git a/Items/Placeables/StormWeaverMusicbox.cs b/Items/Placeables/StormWeaverMusicbox.cs new file mode 100644 index 0000000000..139baae14f --- /dev/null +++ b/Items/Placeables/StormWeaverMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/StormWeaverMusicbox.png b/Items/Placeables/StormWeaverMusicbox.png new file mode 100644 index 0000000000..4c0e1c82ea Binary files /dev/null and b/Items/Placeables/StormWeaverMusicbox.png differ diff --git a/Items/Placeables/SulphurousMusicbox.cs b/Items/Placeables/SulphurousMusicbox.cs new file mode 100644 index 0000000000..a125ce8072 --- /dev/null +++ b/Items/Placeables/SulphurousMusicbox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SulphurousMusicbox.png b/Items/Placeables/SulphurousMusicbox.png new file mode 100644 index 0000000000..8708ee41a7 Binary files /dev/null and b/Items/Placeables/SulphurousMusicbox.png differ diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/SulphurousSand.cs new file mode 100644 index 0000000000..08760e3e8d --- /dev/null +++ b/Items/Placeables/SulphurousSand.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SulphurousSand.png b/Items/Placeables/SulphurousSand.png new file mode 100644 index 0000000000..e33c57ea3e Binary files /dev/null and b/Items/Placeables/SulphurousSand.png differ diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs new file mode 100644 index 0000000000..16a1a08c45 --- /dev/null +++ b/Items/Placeables/Tenebris.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Tenebris.png b/Items/Placeables/Tenebris.png new file mode 100644 index 0000000000..b4540cb2d3 Binary files /dev/null and b/Items/Placeables/Tenebris.png differ diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs new file mode 100644 index 0000000000..6c2cf633a3 --- /dev/null +++ b/Items/Placeables/UelibloomBrick.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/UelibloomBrick.png b/Items/Placeables/UelibloomBrick.png new file mode 100644 index 0000000000..8e31b6ec52 Binary files /dev/null and b/Items/Placeables/UelibloomBrick.png differ diff --git a/Items/Placeables/UelibloomBrickWall.cs b/Items/Placeables/UelibloomBrickWall.cs new file mode 100644 index 0000000000..bcee9507f2 --- /dev/null +++ b/Items/Placeables/UelibloomBrickWall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/UelibloomBrickWall.png b/Items/Placeables/UelibloomBrickWall.png new file mode 100644 index 0000000000..a8a093c6ea Binary files /dev/null and b/Items/Placeables/UelibloomBrickWall.png differ diff --git a/Items/Placeables/UelibloomOre.cs b/Items/Placeables/UelibloomOre.cs new file mode 100644 index 0000000000..b8b39e5a1e --- /dev/null +++ b/Items/Placeables/UelibloomOre.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/UelibloomOre.png b/Items/Placeables/UelibloomOre.png new file mode 100644 index 0000000000..abd4c411db Binary files /dev/null and b/Items/Placeables/UelibloomOre.png differ diff --git a/Items/Placeables/VoidBath.cs b/Items/Placeables/VoidBath.cs new file mode 100644 index 0000000000..084377ebb8 --- /dev/null +++ b/Items/Placeables/VoidBath.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidBath.png b/Items/Placeables/VoidBath.png new file mode 100644 index 0000000000..4f0ad12713 Binary files /dev/null and b/Items/Placeables/VoidBath.png differ diff --git a/Items/Placeables/VoidBed.cs b/Items/Placeables/VoidBed.cs new file mode 100644 index 0000000000..8c2ef7771a --- /dev/null +++ b/Items/Placeables/VoidBed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidBed.png b/Items/Placeables/VoidBed.png new file mode 100644 index 0000000000..7e200bf914 Binary files /dev/null and b/Items/Placeables/VoidBed.png differ diff --git a/Items/Placeables/VoidBookcase.cs b/Items/Placeables/VoidBookcase.cs new file mode 100644 index 0000000000..5b153f69ae --- /dev/null +++ b/Items/Placeables/VoidBookcase.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidBookcase.png b/Items/Placeables/VoidBookcase.png new file mode 100644 index 0000000000..2e1321d68f Binary files /dev/null and b/Items/Placeables/VoidBookcase.png differ diff --git a/Items/Placeables/VoidCandelabra.cs b/Items/Placeables/VoidCandelabra.cs new file mode 100644 index 0000000000..b8ed586751 --- /dev/null +++ b/Items/Placeables/VoidCandelabra.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidCandelabra.png b/Items/Placeables/VoidCandelabra.png new file mode 100644 index 0000000000..7a04fbf90d Binary files /dev/null and b/Items/Placeables/VoidCandelabra.png differ diff --git a/Items/Placeables/VoidCandle.cs b/Items/Placeables/VoidCandle.cs new file mode 100644 index 0000000000..55c9074950 --- /dev/null +++ b/Items/Placeables/VoidCandle.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidCandle.png b/Items/Placeables/VoidCandle.png new file mode 100644 index 0000000000..cab8a4f80f Binary files /dev/null and b/Items/Placeables/VoidCandle.png differ diff --git a/Items/Placeables/VoidChair.cs b/Items/Placeables/VoidChair.cs new file mode 100644 index 0000000000..1e0dc5d8e8 --- /dev/null +++ b/Items/Placeables/VoidChair.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidChair.png b/Items/Placeables/VoidChair.png new file mode 100644 index 0000000000..693ee310f2 Binary files /dev/null and b/Items/Placeables/VoidChair.png differ diff --git a/Items/Placeables/VoidChandelier.cs b/Items/Placeables/VoidChandelier.cs new file mode 100644 index 0000000000..6e3d7702bf --- /dev/null +++ b/Items/Placeables/VoidChandelier.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidChandelier.png b/Items/Placeables/VoidChandelier.png new file mode 100644 index 0000000000..0fc5b28890 Binary files /dev/null and b/Items/Placeables/VoidChandelier.png differ diff --git a/Items/Placeables/VoidChest.cs b/Items/Placeables/VoidChest.cs new file mode 100644 index 0000000000..64e9a58637 --- /dev/null +++ b/Items/Placeables/VoidChest.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidChest.png b/Items/Placeables/VoidChest.png new file mode 100644 index 0000000000..c3da75e1a6 Binary files /dev/null and b/Items/Placeables/VoidChest.png differ diff --git a/Items/Placeables/VoidClock.cs b/Items/Placeables/VoidClock.cs new file mode 100644 index 0000000000..e493a40f92 --- /dev/null +++ b/Items/Placeables/VoidClock.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidClock.png b/Items/Placeables/VoidClock.png new file mode 100644 index 0000000000..33cf4cf3b6 Binary files /dev/null and b/Items/Placeables/VoidClock.png differ diff --git a/Items/Placeables/VoidCondenser.cs b/Items/Placeables/VoidCondenser.cs new file mode 100644 index 0000000000..e0761e30e8 --- /dev/null +++ b/Items/Placeables/VoidCondenser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidCondenser.png b/Items/Placeables/VoidCondenser.png new file mode 100644 index 0000000000..b2b1fc41f3 Binary files /dev/null and b/Items/Placeables/VoidCondenser.png differ diff --git a/Items/Placeables/VoidDoor.cs b/Items/Placeables/VoidDoor.cs new file mode 100644 index 0000000000..f21f410b0c --- /dev/null +++ b/Items/Placeables/VoidDoor.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidDoor.png b/Items/Placeables/VoidDoor.png new file mode 100644 index 0000000000..79a1e82ac6 Binary files /dev/null and b/Items/Placeables/VoidDoor.png differ diff --git a/Items/Placeables/VoidDresser.cs b/Items/Placeables/VoidDresser.cs new file mode 100644 index 0000000000..93815717d7 --- /dev/null +++ b/Items/Placeables/VoidDresser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidDresser.png b/Items/Placeables/VoidDresser.png new file mode 100644 index 0000000000..0dbb8ef311 Binary files /dev/null and b/Items/Placeables/VoidDresser.png differ diff --git a/Items/Placeables/VoidLamp.cs b/Items/Placeables/VoidLamp.cs new file mode 100644 index 0000000000..8ca9696145 --- /dev/null +++ b/Items/Placeables/VoidLamp.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidLamp.png b/Items/Placeables/VoidLamp.png new file mode 100644 index 0000000000..3e7a73bc88 Binary files /dev/null and b/Items/Placeables/VoidLamp.png differ diff --git a/Items/Placeables/VoidLantern.cs b/Items/Placeables/VoidLantern.cs new file mode 100644 index 0000000000..e52b2d692f --- /dev/null +++ b/Items/Placeables/VoidLantern.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidLantern.png b/Items/Placeables/VoidLantern.png new file mode 100644 index 0000000000..023846d83f Binary files /dev/null and b/Items/Placeables/VoidLantern.png differ diff --git a/Items/Placeables/VoidPiano.cs b/Items/Placeables/VoidPiano.cs new file mode 100644 index 0000000000..ab2628debd --- /dev/null +++ b/Items/Placeables/VoidPiano.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidPiano.png b/Items/Placeables/VoidPiano.png new file mode 100644 index 0000000000..d449f8d3ee Binary files /dev/null and b/Items/Placeables/VoidPiano.png differ diff --git a/Items/Placeables/VoidSink.cs b/Items/Placeables/VoidSink.cs new file mode 100644 index 0000000000..eba71db8af --- /dev/null +++ b/Items/Placeables/VoidSink.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidSink.png b/Items/Placeables/VoidSink.png new file mode 100644 index 0000000000..64726add2c Binary files /dev/null and b/Items/Placeables/VoidSink.png differ diff --git a/Items/Placeables/VoidSofa.cs b/Items/Placeables/VoidSofa.cs new file mode 100644 index 0000000000..fd4c5c62be --- /dev/null +++ b/Items/Placeables/VoidSofa.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidSofa.png b/Items/Placeables/VoidSofa.png new file mode 100644 index 0000000000..c88fe97c5a Binary files /dev/null and b/Items/Placeables/VoidSofa.png differ diff --git a/Items/Placeables/VoidTable.cs b/Items/Placeables/VoidTable.cs new file mode 100644 index 0000000000..c1f714ae62 --- /dev/null +++ b/Items/Placeables/VoidTable.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidTable.png b/Items/Placeables/VoidTable.png new file mode 100644 index 0000000000..e28b9b00b2 Binary files /dev/null and b/Items/Placeables/VoidTable.png differ diff --git a/Items/Placeables/VoidWorkbench.cs b/Items/Placeables/VoidWorkbench.cs new file mode 100644 index 0000000000..3b35a7cb76 --- /dev/null +++ b/Items/Placeables/VoidWorkbench.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidWorkbench.png b/Items/Placeables/VoidWorkbench.png new file mode 100644 index 0000000000..bc085a95a0 Binary files /dev/null and b/Items/Placeables/VoidWorkbench.png differ diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs new file mode 100644 index 0000000000..5f8ac6ab67 --- /dev/null +++ b/Items/Placeables/Voidstone.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/Voidstone.png b/Items/Placeables/Voidstone.png new file mode 100644 index 0000000000..3cbb79e8d9 Binary files /dev/null and b/Items/Placeables/Voidstone.png differ diff --git a/Items/Placeables/VoidstoneSlab.cs b/Items/Placeables/VoidstoneSlab.cs new file mode 100644 index 0000000000..f4fe4bbf32 --- /dev/null +++ b/Items/Placeables/VoidstoneSlab.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Placeables/VoidstoneSlab.png b/Items/Placeables/VoidstoneSlab.png new file mode 100644 index 0000000000..7fb3a095fb Binary files /dev/null and b/Items/Placeables/VoidstoneSlab.png differ diff --git a/Items/Placeables/VoidstoneWall.cs b/Items/Placeables/VoidstoneWall.cs new file mode 100644 index 0000000000..fa960f8cdc --- /dev/null +++ b/Items/Placeables/VoidstoneWall.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidstoneWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("VoidstoneWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Voidstone"); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/VoidstoneWall.png b/Items/Placeables/VoidstoneWall.png new file mode 100644 index 0000000000..26ff0d7a52 Binary files /dev/null and b/Items/Placeables/VoidstoneWall.png differ diff --git a/Items/Placeables/WeaverTrophy.cs b/Items/Placeables/WeaverTrophy.cs new file mode 100644 index 0000000000..9f8258be65 --- /dev/null +++ b/Items/Placeables/WeaverTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class WeaverTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weaver Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 12; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/WeaverTrophy.png b/Items/Placeables/WeaverTrophy.png new file mode 100644 index 0000000000..89175a7be1 Binary files /dev/null and b/Items/Placeables/WeaverTrophy.png differ diff --git a/Items/Placeables/YharonTrophy.cs b/Items/Placeables/YharonTrophy.cs new file mode 100644 index 0000000000..9b9b0afe7f --- /dev/null +++ b/Items/Placeables/YharonTrophy.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class YharonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 10; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/YharonTrophy.png b/Items/Placeables/YharonTrophy.png new file mode 100644 index 0000000000..6480a542e4 Binary files /dev/null and b/Items/Placeables/YharonTrophy.png differ diff --git a/Items/PlaguebringerGoliath/Abomination.cs b/Items/PlaguebringerGoliath/Abomination.cs new file mode 100644 index 0000000000..099785203c --- /dev/null +++ b/Items/PlaguebringerGoliath/Abomination.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.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/Abomination.png b/Items/PlaguebringerGoliath/Abomination.png new file mode 100644 index 0000000000..053279c444 Binary files /dev/null and b/Items/PlaguebringerGoliath/Abomination.png differ diff --git a/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs new file mode 100644 index 0000000000..4021a30f2a --- /dev/null +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -0,0 +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); + } + } + } + } + } + } +} diff --git a/Items/PlaguebringerGoliath/BloomStone.png b/Items/PlaguebringerGoliath/BloomStone.png new file mode 100644 index 0000000000..78d99275d2 Binary files /dev/null and b/Items/PlaguebringerGoliath/BloomStone.png differ diff --git a/Items/PlaguebringerGoliath/PlagueCellCluster.cs b/Items/PlaguebringerGoliath/PlagueCellCluster.cs new file mode 100644 index 0000000000..5bb9a71460 --- /dev/null +++ b/Items/PlaguebringerGoliath/PlagueCellCluster.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/PlaguebringerGoliath/PlagueCellCluster.png b/Items/PlaguebringerGoliath/PlagueCellCluster.png new file mode 100644 index 0000000000..f0314d31d7 Binary files /dev/null and b/Items/PlaguebringerGoliath/PlagueCellCluster.png differ diff --git a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs new file mode 100644 index 0000000000..e122f82af4 --- /dev/null +++ b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.png b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.png new file mode 100644 index 0000000000..3d19345050 Binary files /dev/null and b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.png differ diff --git a/Items/PlaguebringerGoliath/ToxicHeart.cs b/Items/PlaguebringerGoliath/ToxicHeart.cs new file mode 100644 index 0000000000..72d42a9859 --- /dev/null +++ b/Items/PlaguebringerGoliath/ToxicHeart.cs @@ -0,0 +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.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/PlaguebringerGoliath/ToxicHeart.png b/Items/PlaguebringerGoliath/ToxicHeart.png new file mode 100644 index 0000000000..b5e66f1e0f Binary files /dev/null and b/Items/PlaguebringerGoliath/ToxicHeart.png differ diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs new file mode 100644 index 0000000000..b2be82daca --- /dev/null +++ b/Items/Polterghast/Affliction.cs @@ -0,0 +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); + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/Polterghast/Affliction.png b/Items/Polterghast/Affliction.png new file mode 100644 index 0000000000..ca8a4f772c Binary files /dev/null and b/Items/Polterghast/Affliction.png differ diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs new file mode 100644 index 0000000000..0d7b3de22f --- /dev/null +++ b/Items/Polterghast/NecroplasmicBeacon.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Polterghast/NecroplasmicBeacon.png b/Items/Polterghast/NecroplasmicBeacon.png new file mode 100644 index 0000000000..1073d371d3 Binary files /dev/null and b/Items/Polterghast/NecroplasmicBeacon.png differ diff --git a/Items/Polterghast/PolterghastBag.cs b/Items/Polterghast/PolterghastBag.cs new file mode 100644 index 0000000000..c6808158b2 --- /dev/null +++ b/Items/Polterghast/PolterghastBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/Polterghast/PolterghastBag.png b/Items/Polterghast/PolterghastBag.png new file mode 100644 index 0000000000..c43913884e Binary files /dev/null and b/Items/Polterghast/PolterghastBag.png differ diff --git a/Items/Polterghast/RuinousSoul.cs b/Items/Polterghast/RuinousSoul.cs new file mode 100644 index 0000000000..da095c9165 --- /dev/null +++ b/Items/Polterghast/RuinousSoul.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Polterghast/RuinousSoul.png b/Items/Polterghast/RuinousSoul.png new file mode 100644 index 0000000000..04dec2f3de Binary files /dev/null and b/Items/Polterghast/RuinousSoul.png differ diff --git a/Items/PotionofOmniscience.cs b/Items/PotionofOmniscience.cs new file mode 100644 index 0000000000..bf9d4b3111 --- /dev/null +++ b/Items/PotionofOmniscience.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/PotionofOmniscience.png b/Items/PotionofOmniscience.png new file mode 100644 index 0000000000..95875297ce Binary files /dev/null and b/Items/PotionofOmniscience.png differ diff --git a/Items/ProfanedGuardian/ProfanedShard.cs b/Items/ProfanedGuardian/ProfanedShard.cs new file mode 100644 index 0000000000..d5bc3b6f97 --- /dev/null +++ b/Items/ProfanedGuardian/ProfanedShard.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/ProfanedGuardian/ProfanedShard.png b/Items/ProfanedGuardian/ProfanedShard.png new file mode 100644 index 0000000000..34550e0eff Binary files /dev/null and b/Items/ProfanedGuardian/ProfanedShard.png differ diff --git a/Items/Providence/DivineGeode.cs b/Items/Providence/DivineGeode.cs new file mode 100644 index 0000000000..4e42fb85ce --- /dev/null +++ b/Items/Providence/DivineGeode.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Items/Providence/DivineGeode.png b/Items/Providence/DivineGeode.png new file mode 100644 index 0000000000..b8d8fa8f07 Binary files /dev/null and b/Items/Providence/DivineGeode.png differ diff --git a/Items/Providence/ElysianAegis.cs b/Items/Providence/ElysianAegis.cs new file mode 100644 index 0000000000..f85390d46a --- /dev/null +++ b/Items/Providence/ElysianAegis.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ElysianAegis.png b/Items/Providence/ElysianAegis.png new file mode 100644 index 0000000000..d9e34ad392 Binary files /dev/null and b/Items/Providence/ElysianAegis.png differ diff --git a/Items/Providence/ElysianAegis_Shield.png b/Items/Providence/ElysianAegis_Shield.png new file mode 100644 index 0000000000..015848af82 Binary files /dev/null and b/Items/Providence/ElysianAegis_Shield.png differ diff --git a/Items/Providence/ElysianWings.cs b/Items/Providence/ElysianWings.cs new file mode 100644 index 0000000000..2a78eef784 --- /dev/null +++ b/Items/Providence/ElysianWings.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Providence/ElysianWings.png b/Items/Providence/ElysianWings.png new file mode 100644 index 0000000000..8cacde9f58 Binary files /dev/null and b/Items/Providence/ElysianWings.png differ diff --git a/Items/Providence/ElysianWings_Wings.png b/Items/Providence/ElysianWings_Wings.png new file mode 100644 index 0000000000..42659430ad Binary files /dev/null and b/Items/Providence/ElysianWings_Wings.png differ diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs new file mode 100644 index 0000000000..906517dfa2 --- /dev/null +++ b/Items/Providence/ProfanedCore.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Providence/ProfanedCore.png b/Items/Providence/ProfanedCore.png new file mode 100644 index 0000000000..1496674bd6 Binary files /dev/null and b/Items/Providence/ProfanedCore.png differ diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs new file mode 100644 index 0000000000..e1a98c12cd --- /dev/null +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Providence/ProfanedCoreUnlimited.png b/Items/Providence/ProfanedCoreUnlimited.png new file mode 100644 index 0000000000..1496674bd6 Binary files /dev/null and b/Items/Providence/ProfanedCoreUnlimited.png differ diff --git a/Items/Providence/ProvidenceBag.cs b/Items/Providence/ProvidenceBag.cs new file mode 100644 index 0000000000..0872a4f02e --- /dev/null +++ b/Items/Providence/ProvidenceBag.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Items/Providence/ProvidenceBag.png b/Items/Providence/ProvidenceBag.png new file mode 100644 index 0000000000..5de6263e6b Binary files /dev/null and b/Items/Providence/ProvidenceBag.png differ diff --git a/Items/Providence/UnholyEssence.cs b/Items/Providence/UnholyEssence.cs new file mode 100644 index 0000000000..10846f9567 --- /dev/null +++ b/Items/Providence/UnholyEssence.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Providence/UnholyEssence.png b/Items/Providence/UnholyEssence.png new file mode 100644 index 0000000000..2a3d7bd435 Binary files /dev/null and b/Items/Providence/UnholyEssence.png differ diff --git a/Items/PurifiedJam.cs b/Items/PurifiedJam.cs new file mode 100644 index 0000000000..149b5b1160 --- /dev/null +++ b/Items/PurifiedJam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/PurifiedJam.png b/Items/PurifiedJam.png new file mode 100644 index 0000000000..a9bf707730 Binary files /dev/null and b/Items/PurifiedJam.png differ diff --git a/Items/RedLightningContainer.cs b/Items/RedLightningContainer.cs new file mode 100644 index 0000000000..9aa4bbbbd3 --- /dev/null +++ b/Items/RedLightningContainer.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/RedLightningContainer.png b/Items/RedLightningContainer.png new file mode 100644 index 0000000000..2aba920004 Binary files /dev/null and b/Items/RedLightningContainer.png differ diff --git a/Items/ReefclawHamaxe.cs b/Items/ReefclawHamaxe.cs new file mode 100644 index 0000000000..90672e370b --- /dev/null +++ b/Items/ReefclawHamaxe.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/ReefclawHamaxe.png b/Items/ReefclawHamaxe.png new file mode 100644 index 0000000000..bb7f8bc105 Binary files /dev/null and b/Items/ReefclawHamaxe.png differ diff --git a/Items/RevivifyPotion.cs b/Items/RevivifyPotion.cs new file mode 100644 index 0000000000..1a5fb7b861 --- /dev/null +++ b/Items/RevivifyPotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/RevivifyPotion.png b/Items/RevivifyPotion.png new file mode 100644 index 0000000000..439c9ea7ac Binary files /dev/null and b/Items/RevivifyPotion.png differ diff --git a/Items/Scavenger/AncientMedallion.cs b/Items/Scavenger/AncientMedallion.cs new file mode 100644 index 0000000000..4ab22c17ee --- /dev/null +++ b/Items/Scavenger/AncientMedallion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Scavenger/AncientMedallion.png b/Items/Scavenger/AncientMedallion.png new file mode 100644 index 0000000000..7606218f53 Binary files /dev/null and b/Items/Scavenger/AncientMedallion.png differ diff --git a/Items/Scavenger/BloodPact.cs b/Items/Scavenger/BloodPact.cs new file mode 100644 index 0000000000..8ac18ae288 --- /dev/null +++ b/Items/Scavenger/BloodPact.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/BloodPact.png b/Items/Scavenger/BloodPact.png new file mode 100644 index 0000000000..6ac1acbcd2 Binary files /dev/null and b/Items/Scavenger/BloodPact.png differ diff --git a/Items/Scavenger/FleshTotem.cs b/Items/Scavenger/FleshTotem.cs new file mode 100644 index 0000000000..709200fe87 --- /dev/null +++ b/Items/Scavenger/FleshTotem.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/FleshTotem.png b/Items/Scavenger/FleshTotem.png new file mode 100644 index 0000000000..48b9eb2d8f Binary files /dev/null and b/Items/Scavenger/FleshTotem.png differ diff --git a/Items/Scavenger/RavagerBag.cs b/Items/Scavenger/RavagerBag.cs new file mode 100644 index 0000000000..6010629eb1 --- /dev/null +++ b/Items/Scavenger/RavagerBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/Scavenger/RavagerBag.png b/Items/Scavenger/RavagerBag.png new file mode 100644 index 0000000000..dfa6c2fae7 Binary files /dev/null and b/Items/Scavenger/RavagerBag.png differ diff --git a/Items/ShadowspecBar.cs b/Items/ShadowspecBar.cs new file mode 100644 index 0000000000..d003d266b5 --- /dev/null +++ b/Items/ShadowspecBar.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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/ShadowspecBar.png b/Items/ShadowspecBar.png new file mode 100644 index 0000000000..e44e03f7e0 Binary files /dev/null and b/Items/ShadowspecBar.png differ diff --git a/Items/ShardlightPickaxe.cs b/Items/ShardlightPickaxe.cs new file mode 100644 index 0000000000..c01dda19fb --- /dev/null +++ b/Items/ShardlightPickaxe.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/ShardlightPickaxe.png b/Items/ShardlightPickaxe.png new file mode 100644 index 0000000000..db19cc06a9 Binary files /dev/null and b/Items/ShardlightPickaxe.png differ diff --git a/Items/SkyfringePickaxe.cs b/Items/SkyfringePickaxe.cs new file mode 100644 index 0000000000..d8f0a34e1a --- /dev/null +++ b/Items/SkyfringePickaxe.cs @@ -0,0 +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); + } + } +}} \ No newline at end of file diff --git a/Items/SkyfringePickaxe.png b/Items/SkyfringePickaxe.png new file mode 100644 index 0000000000..08ba469fff Binary files /dev/null and b/Items/SkyfringePickaxe.png differ diff --git a/Items/SlimeGod/ManaOverloader.cs b/Items/SlimeGod/ManaOverloader.cs new file mode 100644 index 0000000000..497835992f --- /dev/null +++ b/Items/SlimeGod/ManaOverloader.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ManaOverloader.png b/Items/SlimeGod/ManaOverloader.png new file mode 100644 index 0000000000..40b489bef3 Binary files /dev/null and b/Items/SlimeGod/ManaOverloader.png differ diff --git a/Items/SlimeGod/OverloadedSludge.cs b/Items/SlimeGod/OverloadedSludge.cs new file mode 100644 index 0000000000..485d7772a2 --- /dev/null +++ b/Items/SlimeGod/OverloadedSludge.cs @@ -0,0 +1,62 @@ +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")); + } + + 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/OverloadedSludge.png b/Items/SlimeGod/OverloadedSludge.png new file mode 100644 index 0000000000..387cdac50d Binary files /dev/null and b/Items/SlimeGod/OverloadedSludge.png differ diff --git a/Items/SlimeGod/PurifiedGel.cs b/Items/SlimeGod/PurifiedGel.cs new file mode 100644 index 0000000000..35b4ceddf6 --- /dev/null +++ b/Items/SlimeGod/PurifiedGel.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/SlimeGod/PurifiedGel.png b/Items/SlimeGod/PurifiedGel.png new file mode 100644 index 0000000000..37e2e34df9 Binary files /dev/null and b/Items/SlimeGod/PurifiedGel.png differ diff --git a/Items/SlimeGod/SlimeGodBag.cs b/Items/SlimeGod/SlimeGodBag.cs new file mode 100644 index 0000000000..24bd0eb48f --- /dev/null +++ b/Items/SlimeGod/SlimeGodBag.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Items/SlimeGod/SlimeGodBag.png b/Items/SlimeGod/SlimeGodBag.png new file mode 100644 index 0000000000..6e8296a5f2 Binary files /dev/null and b/Items/SlimeGod/SlimeGodBag.png differ diff --git a/Items/SquishyBeanMount.cs b/Items/SquishyBeanMount.cs new file mode 100644 index 0000000000..2f8da20f54 --- /dev/null +++ b/Items/SquishyBeanMount.cs @@ -0,0 +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"); + } + } +} diff --git a/Items/SquishyBeanMount.png b/Items/SquishyBeanMount.png new file mode 100644 index 0000000000..d6c2337f00 Binary files /dev/null and b/Items/SquishyBeanMount.png differ diff --git a/Items/Stardust.cs b/Items/Stardust.cs new file mode 100644 index 0000000000..5143e77ac3 --- /dev/null +++ b/Items/Stardust.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/Stardust.png b/Items/Stardust.png new file mode 100644 index 0000000000..80ae4d462e Binary files /dev/null and b/Items/Stardust.png differ diff --git a/Items/StarlightFuelCell.cs b/Items/StarlightFuelCell.cs new file mode 100644 index 0000000000..f4073f2e25 --- /dev/null +++ b/Items/StarlightFuelCell.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class StarlightFuelCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starlight Fuel Cell"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 7; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.adrenalineBoostTwo) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.adrenalineBoostTwo = true; + } + return true; + } + } +} \ No newline at end of file diff --git a/Items/StarlightFuelCell.png b/Items/StarlightFuelCell.png new file mode 100644 index 0000000000..c4cc1eb622 Binary files /dev/null and b/Items/StarlightFuelCell.png differ diff --git a/Items/StarterBag.cs b/Items/StarterBag.cs new file mode 100644 index 0000000000..0d04be1015 --- /dev/null +++ b/Items/StarterBag.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Items/StarterBag.png b/Items/StarterBag.png new file mode 100644 index 0000000000..303e26ef5b Binary files /dev/null and b/Items/StarterBag.png differ diff --git a/Items/StormlionMandible.cs b/Items/StormlionMandible.cs new file mode 100644 index 0000000000..b5bdae27b3 --- /dev/null +++ b/Items/StormlionMandible.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/StormlionMandible.png b/Items/StormlionMandible.png new file mode 100644 index 0000000000..5d6d9bdb3d Binary files /dev/null and b/Items/StormlionMandible.png differ diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs new file mode 100644 index 0000000000..9e81d806ae --- /dev/null +++ b/Items/SuperDummy.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/SuperDummy.png b/Items/SuperDummy.png new file mode 100644 index 0000000000..d545df3d16 Binary files /dev/null and b/Items/SuperDummy.png differ diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs new file mode 100644 index 0000000000..59f2b784d0 --- /dev/null +++ b/Items/SupremeCalamitas/EyeofExtinction.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/SupremeCalamitas/EyeofExtinction.png b/Items/SupremeCalamitas/EyeofExtinction.png new file mode 100644 index 0000000000..b8f8db0c7b Binary files /dev/null and b/Items/SupremeCalamitas/EyeofExtinction.png differ diff --git a/Items/SupremeHealingPotion.cs b/Items/SupremeHealingPotion.cs new file mode 100644 index 0000000000..aebba08276 --- /dev/null +++ b/Items/SupremeHealingPotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/SupremeHealingPotion.png b/Items/SupremeHealingPotion.png new file mode 100644 index 0000000000..ef4c1cf6bd Binary files /dev/null and b/Items/SupremeHealingPotion.png differ diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs new file mode 100644 index 0000000000..d478ce818a --- /dev/null +++ b/Items/TheDevourerofGods/CosmicWorm.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/TheDevourerofGods/CosmicWorm.png b/Items/TheDevourerofGods/CosmicWorm.png new file mode 100644 index 0000000000..ffb7cba9df Binary files /dev/null and b/Items/TheDevourerofGods/CosmicWorm.png differ diff --git a/Items/TheDevourerofGods/CosmiliteBar.cs b/Items/TheDevourerofGods/CosmiliteBar.cs new file mode 100644 index 0000000000..4cca20f5bd --- /dev/null +++ b/Items/TheDevourerofGods/CosmiliteBar.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CosmiliteBar.png b/Items/TheDevourerofGods/CosmiliteBar.png new file mode 100644 index 0000000000..3ed1a627f1 Binary files /dev/null and b/Items/TheDevourerofGods/CosmiliteBar.png differ diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs new file mode 100644 index 0000000000..a773fa0469 --- /dev/null +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.png b/Items/TheDevourerofGods/DevourerofGodsBag.png new file mode 100644 index 0000000000..58fd0adf49 Binary files /dev/null and b/Items/TheDevourerofGods/DevourerofGodsBag.png differ diff --git a/Items/TheDevourerofGods/NebulousCore.cs b/Items/TheDevourerofGods/NebulousCore.cs new file mode 100644 index 0000000000..862a523b5f --- /dev/null +++ b/Items/TheDevourerofGods/NebulousCore.cs @@ -0,0 +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; + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/TheDevourerofGods/NebulousCore.png b/Items/TheDevourerofGods/NebulousCore.png new file mode 100644 index 0000000000..9a89d296f1 Binary files /dev/null and b/Items/TheDevourerofGods/NebulousCore.png differ diff --git a/Items/TitanScalePotion.cs b/Items/TitanScalePotion.cs new file mode 100644 index 0000000000..af64fe0350 --- /dev/null +++ b/Items/TitanScalePotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/TitanScalePotion.png b/Items/TitanScalePotion.png new file mode 100644 index 0000000000..41dbbd5033 Binary files /dev/null and b/Items/TitanScalePotion.png differ diff --git a/Items/TrapperBulb.cs b/Items/TrapperBulb.cs new file mode 100644 index 0000000000..da0b676cb5 --- /dev/null +++ b/Items/TrapperBulb.cs @@ -0,0 +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; + } +}} \ No newline at end of file diff --git a/Items/TrapperBulb.png b/Items/TrapperBulb.png new file mode 100644 index 0000000000..14e2bd8027 Binary files /dev/null and b/Items/TrapperBulb.png differ diff --git a/Items/UeliaceBar.cs b/Items/UeliaceBar.cs new file mode 100644 index 0000000000..09a245107e --- /dev/null +++ b/Items/UeliaceBar.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/UeliaceBar.png b/Items/UeliaceBar.png new file mode 100644 index 0000000000..92e0fb9a4e Binary files /dev/null and b/Items/UeliaceBar.png differ diff --git a/Items/UnholyCore.cs b/Items/UnholyCore.cs new file mode 100644 index 0000000000..1229fb801f --- /dev/null +++ b/Items/UnholyCore.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/UnholyCore.png b/Items/UnholyCore.png new file mode 100644 index 0000000000..480bddf481 Binary files /dev/null and b/Items/UnholyCore.png differ diff --git a/Items/VerstaltiteBar.cs b/Items/VerstaltiteBar.cs new file mode 100644 index 0000000000..9a19a971d0 --- /dev/null +++ b/Items/VerstaltiteBar.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/VerstaltiteBar.png b/Items/VerstaltiteBar.png new file mode 100644 index 0000000000..ede014b815 Binary files /dev/null and b/Items/VerstaltiteBar.png differ diff --git a/Items/VictideBar.cs b/Items/VictideBar.cs new file mode 100644 index 0000000000..20cc4e3d0e --- /dev/null +++ b/Items/VictideBar.cs @@ -0,0 +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(); + } +}} \ No newline at end of file diff --git a/Items/VictideBar.png b/Items/VictideBar.png new file mode 100644 index 0000000000..cc6e11e2d5 Binary files /dev/null and b/Items/VictideBar.png differ diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs new file mode 100644 index 0000000000..88799fcf0e --- /dev/null +++ b/Items/Weapons/AMR.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AMR.png b/Items/Weapons/AMR.png new file mode 100644 index 0000000000..34816cf6a2 Binary files /dev/null and b/Items/Weapons/AMR.png differ diff --git a/Items/Weapons/AbyssBlade.cs b/Items/Weapons/AbyssBlade.cs new file mode 100644 index 0000000000..feac7c9787 --- /dev/null +++ b/Items/Weapons/AbyssBlade.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } +} diff --git a/Items/Weapons/AbyssBlade.png b/Items/Weapons/AbyssBlade.png new file mode 100644 index 0000000000..1e09fa333c Binary files /dev/null and b/Items/Weapons/AbyssBlade.png differ diff --git a/Items/Weapons/AbyssWeapons/Archerfish.cs b/Items/Weapons/AbyssWeapons/Archerfish.cs new file mode 100644 index 0000000000..e7a08bcf13 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/Archerfish.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/Archerfish.png b/Items/Weapons/AbyssWeapons/Archerfish.png new file mode 100644 index 0000000000..ad368e2088 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/Archerfish.png differ diff --git a/Items/Weapons/AbyssWeapons/BallOFugu.cs b/Items/Weapons/AbyssWeapons/BallOFugu.cs new file mode 100644 index 0000000000..c769cec982 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/BallOFugu.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/BallOFugu.png b/Items/Weapons/AbyssWeapons/BallOFugu.png new file mode 100644 index 0000000000..8325b126c6 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/BallOFugu.png differ diff --git a/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs new file mode 100644 index 0000000000..cfc125f004 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.png b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.png new file mode 100644 index 0000000000..6f037bb9f6 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/BallisticPoisonBomb.png differ diff --git a/Items/Weapons/AbyssWeapons/BlackAnurian.cs b/Items/Weapons/AbyssWeapons/BlackAnurian.cs new file mode 100644 index 0000000000..500d03d7c2 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/BlackAnurian.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/BlackAnurian.png b/Items/Weapons/AbyssWeapons/BlackAnurian.png new file mode 100644 index 0000000000..680a2f302b Binary files /dev/null and b/Items/Weapons/AbyssWeapons/BlackAnurian.png differ diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs new file mode 100644 index 0000000000..d9ab75ecb5 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.png b/Items/Weapons/AbyssWeapons/CalamarisLament.png new file mode 100644 index 0000000000..8e595867e7 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/CalamarisLament.png differ diff --git a/Items/Weapons/AbyssWeapons/DreadmineStaff.cs b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs new file mode 100644 index 0000000000..b4fd7656ae --- /dev/null +++ b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/DreadmineStaff.png b/Items/Weapons/AbyssWeapons/DreadmineStaff.png new file mode 100644 index 0000000000..db85833a8f Binary files /dev/null and b/Items/Weapons/AbyssWeapons/DreadmineStaff.png differ diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.cs b/Items/Weapons/AbyssWeapons/EidolicWail.cs new file mode 100644 index 0000000000..3a4de469b1 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/EidolicWail.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.png b/Items/Weapons/AbyssWeapons/EidolicWail.png new file mode 100644 index 0000000000..06d651032b Binary files /dev/null and b/Items/Weapons/AbyssWeapons/EidolicWail.png differ diff --git a/Items/Weapons/AbyssWeapons/FlakKraken.cs b/Items/Weapons/AbyssWeapons/FlakKraken.cs new file mode 100644 index 0000000000..160e3a53c8 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/FlakKraken.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/FlakKraken.png b/Items/Weapons/AbyssWeapons/FlakKraken.png new file mode 100644 index 0000000000..88f490cdcd Binary files /dev/null and b/Items/Weapons/AbyssWeapons/FlakKraken.png differ diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.cs b/Items/Weapons/AbyssWeapons/HalibutCannon.cs new file mode 100644 index 0000000000..3c49457aa8 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/HalibutCannon.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Halibut Cannon"); + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.png b/Items/Weapons/AbyssWeapons/HalibutCannon.png new file mode 100644 index 0000000000..b677c96640 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/HalibutCannon.png differ diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.cs b/Items/Weapons/AbyssWeapons/HerringStaff.cs new file mode 100644 index 0000000000..2b24642f9b --- /dev/null +++ b/Items/Weapons/AbyssWeapons/HerringStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.png b/Items/Weapons/AbyssWeapons/HerringStaff.png new file mode 100644 index 0000000000..00bcdf2e28 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/HerringStaff.png differ diff --git a/Items/Weapons/AbyssWeapons/Lionfish.cs b/Items/Weapons/AbyssWeapons/Lionfish.cs new file mode 100644 index 0000000000..c13cec5ba5 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/Lionfish.cs @@ -0,0 +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 + { + 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; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/Lionfish.png b/Items/Weapons/AbyssWeapons/Lionfish.png new file mode 100644 index 0000000000..56025eca70 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/Lionfish.png differ diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs new file mode 100644 index 0000000000..3e167a3e38 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/SoulEdge.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.png b/Items/Weapons/AbyssWeapons/SoulEdge.png new file mode 100644 index 0000000000..de04182add Binary files /dev/null and b/Items/Weapons/AbyssWeapons/SoulEdge.png differ diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs new file mode 100644 index 0000000000..8b25c91a00 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs @@ -0,0 +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 + { + 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); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png new file mode 100644 index 0000000000..efd3fc59c2 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png differ diff --git a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs new file mode 100644 index 0000000000..bb1d88baf7 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/TyphonsGreed.png b/Items/Weapons/AbyssWeapons/TyphonsGreed.png new file mode 100644 index 0000000000..c9eda2e22e Binary files /dev/null and b/Items/Weapons/AbyssWeapons/TyphonsGreed.png differ diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs new file mode 100644 index 0000000000..2a1dc6a7b7 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Undine's Retribution"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.png b/Items/Weapons/AbyssWeapons/UndinesRetribution.png new file mode 100644 index 0000000000..fdc108827a Binary files /dev/null and b/Items/Weapons/AbyssWeapons/UndinesRetribution.png differ diff --git a/Items/Weapons/AbyssWeapons/Valediction.cs b/Items/Weapons/AbyssWeapons/Valediction.cs new file mode 100644 index 0000000000..c5431ab9c5 --- /dev/null +++ b/Items/Weapons/AbyssWeapons/Valediction.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } + } +} diff --git a/Items/Weapons/AbyssWeapons/Valediction.png b/Items/Weapons/AbyssWeapons/Valediction.png new file mode 100644 index 0000000000..1c3cefaf35 Binary files /dev/null and b/Items/Weapons/AbyssWeapons/Valediction.png differ diff --git a/Items/Weapons/AccelerationBullet.cs b/Items/Weapons/AccelerationBullet.cs new file mode 100644 index 0000000000..2dc23bf910 --- /dev/null +++ b/Items/Weapons/AccelerationBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AccelerationBullet.png b/Items/Weapons/AccelerationBullet.png new file mode 100644 index 0000000000..aaae66b94b Binary files /dev/null and b/Items/Weapons/AccelerationBullet.png differ diff --git a/Items/Weapons/AccretionDisk.cs b/Items/Weapons/AccretionDisk.cs new file mode 100644 index 0000000000..48d0cdb040 --- /dev/null +++ b/Items/Weapons/AccretionDisk.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/AccretionDisk.png b/Items/Weapons/AccretionDisk.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Items/Weapons/AccretionDisk.png differ diff --git a/Items/Weapons/AccretionDiskMelee.cs b/Items/Weapons/AccretionDiskMelee.cs new file mode 100644 index 0000000000..22a047888d --- /dev/null +++ b/Items/Weapons/AccretionDiskMelee.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/AccretionDiskMelee.png b/Items/Weapons/AccretionDiskMelee.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Items/Weapons/AccretionDiskMelee.png differ diff --git a/Items/Weapons/AcidBullet.cs b/Items/Weapons/AcidBullet.cs new file mode 100644 index 0000000000..e2374cbe08 --- /dev/null +++ b/Items/Weapons/AcidBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AcidBullet.png b/Items/Weapons/AcidBullet.png new file mode 100644 index 0000000000..230853d588 Binary files /dev/null and b/Items/Weapons/AcidBullet.png differ diff --git a/Items/Weapons/AdamantiteThrowingAxe.cs b/Items/Weapons/AdamantiteThrowingAxe.cs new file mode 100644 index 0000000000..8dbb26f607 --- /dev/null +++ b/Items/Weapons/AdamantiteThrowingAxe.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/AdamantiteThrowingAxe.png b/Items/Weapons/AdamantiteThrowingAxe.png new file mode 100644 index 0000000000..e11702e145 Binary files /dev/null and b/Items/Weapons/AdamantiteThrowingAxe.png differ diff --git a/Items/Weapons/AegisBlade.cs b/Items/Weapons/AegisBlade.cs new file mode 100644 index 0000000000..46d6cd9a23 --- /dev/null +++ b/Items/Weapons/AegisBlade.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blade"); + 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" + + "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); + } + } +} diff --git a/Items/Weapons/AegisBlade.png b/Items/Weapons/AegisBlade.png new file mode 100644 index 0000000000..4b015c6a94 Binary files /dev/null and b/Items/Weapons/AegisBlade.png differ diff --git a/Items/Weapons/Aeries.cs b/Items/Weapons/Aeries.cs new file mode 100644 index 0000000000..acebeeb45c --- /dev/null +++ b/Items/Weapons/Aeries.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Aeries.png b/Items/Weapons/Aeries.png new file mode 100644 index 0000000000..a3aee2e65c Binary files /dev/null and b/Items/Weapons/Aeries.png differ diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs new file mode 100644 index 0000000000..72212c4b26 --- /dev/null +++ b/Items/Weapons/AethersWhisper.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AethersWhisper.png b/Items/Weapons/AethersWhisper.png new file mode 100644 index 0000000000..e8f82ecb1b Binary files /dev/null and b/Items/Weapons/AethersWhisper.png differ diff --git a/Items/Weapons/Aftershock.cs b/Items/Weapons/Aftershock.cs new file mode 100644 index 0000000000..cc8a8a52b0 --- /dev/null +++ b/Items/Weapons/Aftershock.cs @@ -0,0 +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 + { + 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); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Aftershock.png b/Items/Weapons/Aftershock.png new file mode 100644 index 0000000000..5020a31a1d Binary files /dev/null and b/Items/Weapons/Aftershock.png differ diff --git a/Items/Weapons/AirSpinner.cs b/Items/Weapons/AirSpinner.cs new file mode 100644 index 0000000000..90a120d4cb --- /dev/null +++ b/Items/Weapons/AirSpinner.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AirSpinner.png b/Items/Weapons/AirSpinner.png new file mode 100644 index 0000000000..36c705f5ec Binary files /dev/null and b/Items/Weapons/AirSpinner.png differ diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs new file mode 100644 index 0000000000..24b53e356c --- /dev/null +++ b/Items/Weapons/Alluvion.cs @@ -0,0 +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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class Alluvion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alluvion"); + Tooltip.SetDefault("Moderate chance to fire sharks\n" + + "Low chance to fire typhoon arrows\n" + + "Typhoons deal MORE damage in Expert Mode\n" + + "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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Alluvion.png b/Items/Weapons/Alluvion.png new file mode 100644 index 0000000000..6285f80f57 Binary files /dev/null and b/Items/Weapons/Alluvion.png differ diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs new file mode 100644 index 0000000000..6732c4eab4 --- /dev/null +++ b/Items/Weapons/AlphaRay.cs @@ -0,0 +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 AlphaRay : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alpha Ray"); + Tooltip.SetDefault("Disintegrates everything\nRight click to change modes"); + } + + + 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/AlphaRay.png b/Items/Weapons/AlphaRay.png new file mode 100644 index 0000000000..429d526d81 Binary files /dev/null and b/Items/Weapons/AlphaRay.png differ diff --git a/Items/Weapons/AnarchyBlade.cs b/Items/Weapons/AnarchyBlade.cs new file mode 100644 index 0000000000..b17d10b1be --- /dev/null +++ b/Items/Weapons/AnarchyBlade.cs @@ -0,0 +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 + { + 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(); + } + } + } +} diff --git a/Items/Weapons/AnarchyBlade.png b/Items/Weapons/AnarchyBlade.png new file mode 100644 index 0000000000..adcdd148ae Binary files /dev/null and b/Items/Weapons/AnarchyBlade.png differ diff --git a/Items/Weapons/AncientCrusher.cs b/Items/Weapons/AncientCrusher.cs new file mode 100644 index 0000000000..e1075730c8 --- /dev/null +++ b/Items/Weapons/AncientCrusher.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/AncientCrusher.png b/Items/Weapons/AncientCrusher.png new file mode 100644 index 0000000000..e5dfebb9b0 Binary files /dev/null and b/Items/Weapons/AncientCrusher.png differ diff --git a/Items/Weapons/AncientIceChunk.cs b/Items/Weapons/AncientIceChunk.cs new file mode 100644 index 0000000000..67b4ccf033 --- /dev/null +++ b/Items/Weapons/AncientIceChunk.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AncientIceChunk.png b/Items/Weapons/AncientIceChunk.png new file mode 100644 index 0000000000..2538db82fc Binary files /dev/null and b/Items/Weapons/AncientIceChunk.png differ diff --git a/Items/Weapons/AncientShiv.cs b/Items/Weapons/AncientShiv.cs new file mode 100644 index 0000000000..52e668eb20 --- /dev/null +++ b/Items/Weapons/AncientShiv.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/AncientShiv.png b/Items/Weapons/AncientShiv.png new file mode 100644 index 0000000000..132c07448c Binary files /dev/null and b/Items/Weapons/AncientShiv.png differ diff --git a/Items/Weapons/Animosity.cs b/Items/Weapons/Animosity.cs new file mode 100644 index 0000000000..b360d0e5f9 --- /dev/null +++ b/Items/Weapons/Animosity.cs @@ -0,0 +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 + { + 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" + + "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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Animosity.png b/Items/Weapons/Animosity.png new file mode 100644 index 0000000000..cbb71f34a4 Binary files /dev/null and b/Items/Weapons/Animosity.png differ diff --git a/Items/Weapons/Animus.cs b/Items/Weapons/Animus.cs new file mode 100644 index 0000000000..da7ac09456 --- /dev/null +++ b/Items/Weapons/Animus.cs @@ -0,0 +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 + { + 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; + } + } + } +} diff --git a/Items/Weapons/Animus.png b/Items/Weapons/Animus.png new file mode 100644 index 0000000000..e334d84301 Binary files /dev/null and b/Items/Weapons/Animus.png differ diff --git a/Items/Weapons/ApoctosisArray.cs b/Items/Weapons/ApoctosisArray.cs new file mode 100644 index 0000000000..3efbcbb442 --- /dev/null +++ b/Items/Weapons/ApoctosisArray.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/ApoctosisArray.png b/Items/Weapons/ApoctosisArray.png new file mode 100644 index 0000000000..9a63365287 Binary files /dev/null and b/Items/Weapons/ApoctosisArray.png differ diff --git a/Items/Weapons/Apotheosis.cs b/Items/Weapons/Apotheosis.cs new file mode 100644 index 0000000000..cd8ce7e908 --- /dev/null +++ b/Items/Weapons/Apotheosis.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/Apotheosis.png b/Items/Weapons/Apotheosis.png new file mode 100644 index 0000000000..1492e01d5c Binary files /dev/null and b/Items/Weapons/Apotheosis.png differ diff --git a/Items/Weapons/AquaticDissolution.cs b/Items/Weapons/AquaticDissolution.cs new file mode 100644 index 0000000000..ca44d8ba4f --- /dev/null +++ b/Items/Weapons/AquaticDissolution.cs @@ -0,0 +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 + { + 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; + } + } + } +} diff --git a/Items/Weapons/AquaticDissolution.png b/Items/Weapons/AquaticDissolution.png new file mode 100644 index 0000000000..595cdd1c79 Binary files /dev/null and b/Items/Weapons/AquaticDissolution.png differ diff --git a/Items/Weapons/AquaticEgg.png b/Items/Weapons/AquaticEgg.png new file mode 100644 index 0000000000..a9accd2cd0 Binary files /dev/null and b/Items/Weapons/AquaticEgg.png differ diff --git a/Items/Weapons/AquaticScourge/Barinautical.cs b/Items/Weapons/AquaticScourge/Barinautical.cs new file mode 100644 index 0000000000..59746a270f --- /dev/null +++ b/Items/Weapons/AquaticScourge/Barinautical.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AquaticScourge/Barinautical.png b/Items/Weapons/AquaticScourge/Barinautical.png new file mode 100644 index 0000000000..5ca5835f63 Binary files /dev/null and b/Items/Weapons/AquaticScourge/Barinautical.png differ diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.cs b/Items/Weapons/AquaticScourge/DeepseaStaff.cs new file mode 100644 index 0000000000..237099b85d --- /dev/null +++ b/Items/Weapons/AquaticScourge/DeepseaStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.png b/Items/Weapons/AquaticScourge/DeepseaStaff.png new file mode 100644 index 0000000000..a2eb7a5345 Binary files /dev/null and b/Items/Weapons/AquaticScourge/DeepseaStaff.png differ diff --git a/Items/Weapons/AquaticScourge/Downpour.cs b/Items/Weapons/AquaticScourge/Downpour.cs new file mode 100644 index 0000000000..f40d3bfe1c --- /dev/null +++ b/Items/Weapons/AquaticScourge/Downpour.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AquaticScourge/Downpour.png b/Items/Weapons/AquaticScourge/Downpour.png new file mode 100644 index 0000000000..db39ab03e4 Binary files /dev/null and b/Items/Weapons/AquaticScourge/Downpour.png differ diff --git a/Items/Weapons/AquaticScourge/SubmarineShocker.cs b/Items/Weapons/AquaticScourge/SubmarineShocker.cs new file mode 100644 index 0000000000..ac4f64dde7 --- /dev/null +++ b/Items/Weapons/AquaticScourge/SubmarineShocker.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/AquaticScourge/SubmarineShocker.png b/Items/Weapons/AquaticScourge/SubmarineShocker.png new file mode 100644 index 0000000000..cfececae90 Binary files /dev/null and b/Items/Weapons/AquaticScourge/SubmarineShocker.png differ diff --git a/Items/Weapons/ArchAmaryllis.cs b/Items/Weapons/ArchAmaryllis.cs new file mode 100644 index 0000000000..07a4b76b2a --- /dev/null +++ b/Items/Weapons/ArchAmaryllis.cs @@ -0,0 +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 ArchAmaryllis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arch Amaryllis"); + Tooltip.SetDefault("Casts a beaming bolt that explodes into smaller homing bolts"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ArchAmaryllis.png b/Items/Weapons/ArchAmaryllis.png new file mode 100644 index 0000000000..f6f0863c2a Binary files /dev/null and b/Items/Weapons/ArchAmaryllis.png differ diff --git a/Items/Weapons/ArcticArrow.cs b/Items/Weapons/ArcticArrow.cs new file mode 100644 index 0000000000..494e50519d --- /dev/null +++ b/Items/Weapons/ArcticArrow.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ArcticArrow.png b/Items/Weapons/ArcticArrow.png new file mode 100644 index 0000000000..348918784f Binary files /dev/null and b/Items/Weapons/ArcticArrow.png differ diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs new file mode 100644 index 0000000000..172cd52d0a --- /dev/null +++ b/Items/Weapons/ArkoftheAncients.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/ArkoftheAncients.png b/Items/Weapons/ArkoftheAncients.png new file mode 100644 index 0000000000..6551c21ef9 Binary files /dev/null and b/Items/Weapons/ArkoftheAncients.png differ diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs new file mode 100644 index 0000000000..254ba27c65 --- /dev/null +++ b/Items/Weapons/ArkoftheCosmos.cs @@ -0,0 +1,223 @@ +using 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"); + Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + + "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + + "Projectiles also change based on moon events"); + } + + public override void SetDefaults() + { + item.width = 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/ArkoftheCosmos.png b/Items/Weapons/ArkoftheCosmos.png new file mode 100644 index 0000000000..9199dd4228 Binary files /dev/null and b/Items/Weapons/ArkoftheCosmos.png differ diff --git a/Items/Weapons/ArkoftheElements.cs b/Items/Weapons/ArkoftheElements.cs new file mode 100644 index 0000000000..3f917786d2 --- /dev/null +++ b/Items/Weapons/ArkoftheElements.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/ArkoftheElements.png b/Items/Weapons/ArkoftheElements.png new file mode 100644 index 0000000000..658f207423 Binary files /dev/null and b/Items/Weapons/ArkoftheElements.png differ diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs new file mode 100644 index 0000000000..adfb416a34 --- /dev/null +++ b/Items/Weapons/ArterialAssault.cs @@ -0,0 +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; +//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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ArterialAssault.png b/Items/Weapons/ArterialAssault.png new file mode 100644 index 0000000000..ff0017d2a6 Binary files /dev/null and b/Items/Weapons/ArterialAssault.png differ diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs new file mode 100644 index 0000000000..f160948a92 --- /dev/null +++ b/Items/Weapons/AsteroidStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AsteroidStaff.png b/Items/Weapons/AsteroidStaff.png new file mode 100644 index 0000000000..f36c23cc26 Binary files /dev/null and b/Items/Weapons/AsteroidStaff.png differ diff --git a/Items/Weapons/Astrageldon/AstralGelStaff.png b/Items/Weapons/Astrageldon/AstralGelStaff.png new file mode 100644 index 0000000000..0a59b58a09 Binary files /dev/null and b/Items/Weapons/Astrageldon/AstralGelStaff.png differ diff --git a/Items/Weapons/Astrageldon/NebulaBlaster.png b/Items/Weapons/Astrageldon/NebulaBlaster.png new file mode 100644 index 0000000000..d98985b3c4 Binary files /dev/null and b/Items/Weapons/Astrageldon/NebulaBlaster.png differ diff --git a/Items/Weapons/AstralBlade.cs b/Items/Weapons/AstralBlade.cs new file mode 100644 index 0000000000..5724cd0e5d --- /dev/null +++ b/Items/Weapons/AstralBlade.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class AstralBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Blade"); + } + + public override void SetDefaults() + { + item.damage = 90; + item.crit += 25; + item.melee = true; + item.width = 44; + item.height = 60; + item.useTime = 9; + item.useAnimation = 9; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5f; + item.value = 350000; + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + 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 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, 173); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AstralBlade.png b/Items/Weapons/AstralBlade.png new file mode 100644 index 0000000000..154c861b08 Binary files /dev/null and b/Items/Weapons/AstralBlade.png differ diff --git a/Items/Weapons/AstralBlaster.cs b/Items/Weapons/AstralBlaster.cs new file mode 100644 index 0000000000..50f1d1ad1e --- /dev/null +++ b/Items/Weapons/AstralBlaster.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AstralBlaster.png b/Items/Weapons/AstralBlaster.png new file mode 100644 index 0000000000..e731f93a2e Binary files /dev/null and b/Items/Weapons/AstralBlaster.png differ diff --git a/Items/Weapons/AstralPike.cs b/Items/Weapons/AstralPike.cs new file mode 100644 index 0000000000..6b77309f6d --- /dev/null +++ b/Items/Weapons/AstralPike.cs @@ -0,0 +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 +{ + 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; + } +}} diff --git a/Items/Weapons/AstralPike.png b/Items/Weapons/AstralPike.png new file mode 100644 index 0000000000..756c22a968 Binary files /dev/null and b/Items/Weapons/AstralPike.png differ diff --git a/Items/Weapons/AstralRepeater.cs b/Items/Weapons/AstralRepeater.cs new file mode 100644 index 0000000000..fc0b7a8729 --- /dev/null +++ b/Items/Weapons/AstralRepeater.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class AstralRepeater : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Repeater"); + } + + public override void SetDefaults() + { + item.damage = 65; + item.crit += 25; + item.ranged = true; + item.width = 50; + item.height = 34; + 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/AstralRepeater.png b/Items/Weapons/AstralRepeater.png new file mode 100644 index 0000000000..245672f8aa Binary files /dev/null and b/Items/Weapons/AstralRepeater.png differ diff --git a/Items/Weapons/AstralStaff.cs b/Items/Weapons/AstralStaff.cs new file mode 100644 index 0000000000..8a5620f018 --- /dev/null +++ b/Items/Weapons/AstralStaff.cs @@ -0,0 +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 AstralStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Staff"); + Tooltip.SetDefault("Summons astral stars from the sky"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 53; + item.crit += 25; + item.magic = true; + item.mana = 15; + item.width = 42; + item.height = 42; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = 350000; + item.rare = 7; + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralStar"); + item.shootSpeed = 15f; + } + + 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 bool 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; + int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[star].magic = true; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AstralStaff.png b/Items/Weapons/AstralStaff.png new file mode 100644 index 0000000000..502d8f0c11 Binary files /dev/null and b/Items/Weapons/AstralStaff.png differ diff --git a/Items/Weapons/AstrealDefeat.cs b/Items/Weapons/AstrealDefeat.cs new file mode 100644 index 0000000000..6a66bd8b4d --- /dev/null +++ b/Items/Weapons/AstrealDefeat.cs @@ -0,0 +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 AstrealDefeat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astreal Defeat"); + Tooltip.SetDefault("Fires Astreal Arrows\n" + + "Ethereal bow of the tyrant king's mother\n" + + "The mother strongly discouraged acts of violence throughout her life\n" + + "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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AstrealDefeat.png b/Items/Weapons/AstrealDefeat.png new file mode 100644 index 0000000000..2bcf13328e Binary files /dev/null and b/Items/Weapons/AstrealDefeat.png differ diff --git a/Items/Weapons/AstrumDeus/BlackBolt.png b/Items/Weapons/AstrumDeus/BlackBolt.png new file mode 100644 index 0000000000..dd7dd3a2aa Binary files /dev/null and b/Items/Weapons/AstrumDeus/BlackBolt.png differ diff --git a/Items/Weapons/AstrumDeus/Nebulash.cs b/Items/Weapons/AstrumDeus/Nebulash.cs new file mode 100644 index 0000000000..cdb0b4b298 --- /dev/null +++ b/Items/Weapons/AstrumDeus/Nebulash.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.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; + } + } +} diff --git a/Items/Weapons/AstrumDeus/Nebulash.png b/Items/Weapons/AstrumDeus/Nebulash.png new file mode 100644 index 0000000000..1e8bfe3b33 Binary files /dev/null and b/Items/Weapons/AstrumDeus/Nebulash.png differ diff --git a/Items/Weapons/AstrumDeus/Starfall.cs b/Items/Weapons/AstrumDeus/Starfall.cs new file mode 100644 index 0000000000..71a66a743d --- /dev/null +++ b/Items/Weapons/AstrumDeus/Starfall.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.AstrumDeus +{ + public class Starfall : ModItem + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AstrumDeus/Starfall.png b/Items/Weapons/AstrumDeus/Starfall.png new file mode 100644 index 0000000000..1e284433c3 Binary files /dev/null and b/Items/Weapons/AstrumDeus/Starfall.png differ diff --git a/Items/Weapons/AuguroftheElements.cs b/Items/Weapons/AuguroftheElements.cs new file mode 100644 index 0000000000..4766098f34 --- /dev/null +++ b/Items/Weapons/AuguroftheElements.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/AuguroftheElements.png b/Items/Weapons/AuguroftheElements.png new file mode 100644 index 0000000000..1e4a20e8f8 Binary files /dev/null and b/Items/Weapons/AuguroftheElements.png differ diff --git a/Items/Weapons/Azathoth.cs b/Items/Weapons/Azathoth.cs new file mode 100644 index 0000000000..3b588187c4 --- /dev/null +++ b/Items/Weapons/Azathoth.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Azathoth.png b/Items/Weapons/Azathoth.png new file mode 100644 index 0000000000..0d1475fa05 Binary files /dev/null and b/Items/Weapons/Azathoth.png differ diff --git a/Items/Weapons/BalefulHarvester.cs b/Items/Weapons/BalefulHarvester.cs new file mode 100644 index 0000000000..037d99e4e5 --- /dev/null +++ b/Items/Weapons/BalefulHarvester.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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); + } + } +} diff --git a/Items/Weapons/BalefulHarvester.png b/Items/Weapons/BalefulHarvester.png new file mode 100644 index 0000000000..d27a4c375f Binary files /dev/null and b/Items/Weapons/BalefulHarvester.png differ diff --git a/Items/Weapons/BarracudaGun.cs b/Items/Weapons/BarracudaGun.cs new file mode 100644 index 0000000000..ddfa26d777 --- /dev/null +++ b/Items/Weapons/BarracudaGun.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BarracudaGun.png b/Items/Weapons/BarracudaGun.png new file mode 100644 index 0000000000..5c0137b4f4 Binary files /dev/null and b/Items/Weapons/BarracudaGun.png differ diff --git a/Items/Weapons/BiomeBlade.cs b/Items/Weapons/BiomeBlade.cs new file mode 100644 index 0000000000..d7038b4524 --- /dev/null +++ b/Items/Weapons/BiomeBlade.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/BiomeBlade.png b/Items/Weapons/BiomeBlade.png new file mode 100644 index 0000000000..541ba410f3 Binary files /dev/null and b/Items/Weapons/BiomeBlade.png differ diff --git a/Items/Weapons/BladecrestOathsword.cs b/Items/Weapons/BladecrestOathsword.cs new file mode 100644 index 0000000000..d5ab74f421 --- /dev/null +++ b/Items/Weapons/BladecrestOathsword.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/BladecrestOathsword.png b/Items/Weapons/BladecrestOathsword.png new file mode 100644 index 0000000000..50f77a274f Binary files /dev/null and b/Items/Weapons/BladecrestOathsword.png differ diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs new file mode 100644 index 0000000000..d72e08b685 --- /dev/null +++ b/Items/Weapons/BladedgeGreatbow.cs @@ -0,0 +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 +{ + 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; + } + 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", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BladedgeGreatbow.png b/Items/Weapons/BladedgeGreatbow.png new file mode 100644 index 0000000000..cfdc842ede Binary files /dev/null and b/Items/Weapons/BladedgeGreatbow.png differ diff --git a/Items/Weapons/BladeofEnmity.cs b/Items/Weapons/BladeofEnmity.cs new file mode 100644 index 0000000000..9c76a52f2c --- /dev/null +++ b/Items/Weapons/BladeofEnmity.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/BladeofEnmity.png b/Items/Weapons/BladeofEnmity.png new file mode 100644 index 0000000000..605b8f54b5 Binary files /dev/null and b/Items/Weapons/BladeofEnmity.png differ diff --git a/Items/Weapons/BloodfireArrow.cs b/Items/Weapons/BloodfireArrow.cs new file mode 100644 index 0000000000..5464f37917 --- /dev/null +++ b/Items/Weapons/BloodfireArrow.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BloodfireArrow.png b/Items/Weapons/BloodfireArrow.png new file mode 100644 index 0000000000..3dda2cfa68 Binary files /dev/null and b/Items/Weapons/BloodfireArrow.png differ diff --git a/Items/Weapons/BloodyEdge.cs b/Items/Weapons/BloodyEdge.cs new file mode 100644 index 0000000000..c824729c5f --- /dev/null +++ b/Items/Weapons/BloodyEdge.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/BloodyEdge.png b/Items/Weapons/BloodyEdge.png new file mode 100644 index 0000000000..f90d25080e Binary files /dev/null and b/Items/Weapons/BloodyEdge.png differ diff --git a/Items/Weapons/BlossomFlux.cs b/Items/Weapons/BlossomFlux.cs new file mode 100644 index 0000000000..02f667b141 --- /dev/null +++ b/Items/Weapons/BlossomFlux.cs @@ -0,0 +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 + { + 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" + + "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; + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BlossomFlux.png b/Items/Weapons/BlossomFlux.png new file mode 100644 index 0000000000..e26e8984d1 Binary files /dev/null and b/Items/Weapons/BlossomFlux.png differ diff --git a/Items/Weapons/BlushieStaff.cs b/Items/Weapons/BlushieStaff.cs new file mode 100644 index 0000000000..8381d49840 --- /dev/null +++ b/Items/Weapons/BlushieStaff.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BlushieStaff.png b/Items/Weapons/BlushieStaff.png new file mode 100644 index 0000000000..694d4e7934 Binary files /dev/null and b/Items/Weapons/BlushieStaff.png differ diff --git a/Items/Weapons/Brimblade.cs b/Items/Weapons/Brimblade.cs new file mode 100644 index 0000000000..8e36e9cc05 --- /dev/null +++ b/Items/Weapons/Brimblade.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} diff --git a/Items/Weapons/Brimblade.png b/Items/Weapons/Brimblade.png new file mode 100644 index 0000000000..d7de00d24b Binary files /dev/null and b/Items/Weapons/Brimblade.png differ diff --git a/Items/Weapons/Brimlash.cs b/Items/Weapons/Brimlash.cs new file mode 100644 index 0000000000..69b06de913 --- /dev/null +++ b/Items/Weapons/Brimlash.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/Brimlash.png b/Items/Weapons/Brimlash.png new file mode 100644 index 0000000000..f3544237e5 Binary files /dev/null and b/Items/Weapons/Brimlash.png differ diff --git a/Items/Weapons/BrimlashBuster.cs b/Items/Weapons/BrimlashBuster.cs new file mode 100644 index 0000000000..3d3748483e --- /dev/null +++ b/Items/Weapons/BrimlashBuster.cs @@ -0,0 +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 + { + 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; + } + } + } +} diff --git a/Items/Weapons/BrimlashBuster.png b/Items/Weapons/BrimlashBuster.png new file mode 100644 index 0000000000..946e98b5da Binary files /dev/null and b/Items/Weapons/BrimlashBuster.png differ diff --git a/Items/Weapons/BrimroseStaff.cs b/Items/Weapons/BrimroseStaff.cs new file mode 100644 index 0000000000..7a12fbcffb --- /dev/null +++ b/Items/Weapons/BrimroseStaff.cs @@ -0,0 +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 BrimroseStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimrose Staff"); + Tooltip.SetDefault("Fires a spread of brimstone beams"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BrimroseStaff.png b/Items/Weapons/BrimroseStaff.png new file mode 100644 index 0000000000..e6c093ff69 Binary files /dev/null and b/Items/Weapons/BrimroseStaff.png differ diff --git a/Items/Weapons/BrimstoneFury.cs b/Items/Weapons/BrimstoneFury.cs new file mode 100644 index 0000000000..b595fe3aba --- /dev/null +++ b/Items/Weapons/BrimstoneFury.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BrimstoneFury.png b/Items/Weapons/BrimstoneFury.png new file mode 100644 index 0000000000..058b9539c3 Binary files /dev/null and b/Items/Weapons/BrimstoneFury.png differ diff --git a/Items/Weapons/BrimstoneWaifu/Brimlance.cs b/Items/Weapons/BrimstoneWaifu/Brimlance.cs new file mode 100644 index 0000000000..0d90eab6aa --- /dev/null +++ b/Items/Weapons/BrimstoneWaifu/Brimlance.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Brimlance.png b/Items/Weapons/BrimstoneWaifu/Brimlance.png new file mode 100644 index 0000000000..91247a2662 Binary files /dev/null and b/Items/Weapons/BrimstoneWaifu/Brimlance.png differ diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs new file mode 100644 index 0000000000..0d5eb1c884 --- /dev/null +++ b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.png b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.png new file mode 100644 index 0000000000..c2b936821a Binary files /dev/null and b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.png differ diff --git a/Items/Weapons/BrinyBaron.cs b/Items/Weapons/BrinyBaron.cs new file mode 100644 index 0000000000..1ce4c3d856 --- /dev/null +++ b/Items/Weapons/BrinyBaron.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Briny Baron"); + 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" + + "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); + } + } +} diff --git a/Items/Weapons/BrinyBaron.png b/Items/Weapons/BrinyBaron.png new file mode 100644 index 0000000000..078aa93a12 Binary files /dev/null and b/Items/Weapons/BrinyBaron.png differ diff --git a/Items/Weapons/Bumblebirb/GildedProboscis.cs b/Items/Weapons/Bumblebirb/GildedProboscis.cs new file mode 100644 index 0000000000..7c9f8e770b --- /dev/null +++ b/Items/Weapons/Bumblebirb/GildedProboscis.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/GildedProboscis.png b/Items/Weapons/Bumblebirb/GildedProboscis.png new file mode 100644 index 0000000000..c8a092a8e6 Binary files /dev/null and b/Items/Weapons/Bumblebirb/GildedProboscis.png differ diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs new file mode 100644 index 0000000000..885f78a074 --- /dev/null +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.png b/Items/Weapons/Bumblebirb/GoldenEagle.png new file mode 100644 index 0000000000..34fa33e3a3 Binary files /dev/null and b/Items/Weapons/Bumblebirb/GoldenEagle.png differ diff --git a/Items/Weapons/Bumblebirb/RougeSlash.cs b/Items/Weapons/Bumblebirb/RougeSlash.cs new file mode 100644 index 0000000000..d84d46a60a --- /dev/null +++ b/Items/Weapons/Bumblebirb/RougeSlash.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Bumblebirb/RougeSlash.png b/Items/Weapons/Bumblebirb/RougeSlash.png new file mode 100644 index 0000000000..a21c4f7f6b Binary files /dev/null and b/Items/Weapons/Bumblebirb/RougeSlash.png differ diff --git a/Items/Weapons/BurningSea.cs b/Items/Weapons/BurningSea.cs new file mode 100644 index 0000000000..641853886a --- /dev/null +++ b/Items/Weapons/BurningSea.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/BurningSea.png b/Items/Weapons/BurningSea.png new file mode 100644 index 0000000000..0107454fa0 Binary files /dev/null and b/Items/Weapons/BurningSea.png differ diff --git a/Items/Weapons/BurntSienna.cs b/Items/Weapons/BurntSienna.cs new file mode 100644 index 0000000000..b2c95f7e59 --- /dev/null +++ b/Items/Weapons/BurntSienna.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/BurntSienna.png b/Items/Weapons/BurntSienna.png new file mode 100644 index 0000000000..da12d0d3c8 Binary files /dev/null and b/Items/Weapons/BurntSienna.png differ diff --git a/Items/Weapons/Butcher.cs b/Items/Weapons/Butcher.cs new file mode 100644 index 0000000000..4da55c16e0 --- /dev/null +++ b/Items/Weapons/Butcher.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Butcher.png b/Items/Weapons/Butcher.png new file mode 100644 index 0000000000..3b6458a45f Binary files /dev/null and b/Items/Weapons/Butcher.png differ diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.cs b/Items/Weapons/Calamitas/BlightedEyeStaff.cs new file mode 100644 index 0000000000..18abf24da8 --- /dev/null +++ b/Items/Weapons/Calamitas/BlightedEyeStaff.cs @@ -0,0 +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 +{ + 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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.png b/Items/Weapons/Calamitas/BlightedEyeStaff.png new file mode 100644 index 0000000000..09c1b8c52b Binary files /dev/null and b/Items/Weapons/Calamitas/BlightedEyeStaff.png differ diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs new file mode 100644 index 0000000000..759d10a2cb --- /dev/null +++ b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.png b/Items/Weapons/Calamitas/BrimstoneFlameblaster.png new file mode 100644 index 0000000000..a44bdf043f Binary files /dev/null and b/Items/Weapons/Calamitas/BrimstoneFlameblaster.png differ diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs new file mode 100644 index 0000000000..ec0788ae41 --- /dev/null +++ b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png new file mode 100644 index 0000000000..eab466724e Binary files /dev/null and b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png differ diff --git a/Items/Weapons/Calamitas/CalamitasInferno.cs b/Items/Weapons/Calamitas/CalamitasInferno.cs new file mode 100644 index 0000000000..e525ba02d8 --- /dev/null +++ b/Items/Weapons/Calamitas/CalamitasInferno.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/CalamitasInferno.png b/Items/Weapons/Calamitas/CalamitasInferno.png new file mode 100644 index 0000000000..38c9176a23 Binary files /dev/null and b/Items/Weapons/Calamitas/CalamitasInferno.png differ diff --git a/Items/Weapons/Calamitas/CrushsawCrasher.cs b/Items/Weapons/Calamitas/CrushsawCrasher.cs new file mode 100644 index 0000000000..3e5f8cef8b --- /dev/null +++ b/Items/Weapons/Calamitas/CrushsawCrasher.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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); + } +}} diff --git a/Items/Weapons/Calamitas/CrushsawCrasher.png b/Items/Weapons/Calamitas/CrushsawCrasher.png new file mode 100644 index 0000000000..160b21d10d Binary files /dev/null and b/Items/Weapons/Calamitas/CrushsawCrasher.png differ diff --git a/Items/Weapons/Calamitas/TheEyeofCalamitas.cs b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs new file mode 100644 index 0000000000..f750c57590 --- /dev/null +++ b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Calamitas/TheEyeofCalamitas.png b/Items/Weapons/Calamitas/TheEyeofCalamitas.png new file mode 100644 index 0000000000..141a1fcf44 Binary files /dev/null and b/Items/Weapons/Calamitas/TheEyeofCalamitas.png differ diff --git a/Items/Weapons/CarnageRay.cs b/Items/Weapons/CarnageRay.cs new file mode 100644 index 0000000000..07fdf4e2e1 --- /dev/null +++ b/Items/Weapons/CarnageRay.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CarnageRay.png b/Items/Weapons/CarnageRay.png new file mode 100644 index 0000000000..99f75e6451 Binary files /dev/null and b/Items/Weapons/CarnageRay.png differ diff --git a/Items/Weapons/CatastropheClaymore.cs b/Items/Weapons/CatastropheClaymore.cs new file mode 100644 index 0000000000..ff9f198d80 --- /dev/null +++ b/Items/Weapons/CatastropheClaymore.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/CatastropheClaymore.png b/Items/Weapons/CatastropheClaymore.png new file mode 100644 index 0000000000..18f5a7b97f Binary files /dev/null and b/Items/Weapons/CatastropheClaymore.png differ diff --git a/Items/Weapons/CausticEdge.cs b/Items/Weapons/CausticEdge.cs new file mode 100644 index 0000000000..e48b16f227 --- /dev/null +++ b/Items/Weapons/CausticEdge.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/CausticEdge.png b/Items/Weapons/CausticEdge.png new file mode 100644 index 0000000000..71a9b11719 Binary files /dev/null and b/Items/Weapons/CausticEdge.png differ diff --git a/Items/Weapons/CelestialClaymore.cs b/Items/Weapons/CelestialClaymore.cs new file mode 100644 index 0000000000..0d83b499da --- /dev/null +++ b/Items/Weapons/CelestialClaymore.cs @@ -0,0 +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 + { + 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; + } + } + } +} diff --git a/Items/Weapons/CelestialClaymore.png b/Items/Weapons/CelestialClaymore.png new file mode 100644 index 0000000000..83a7435b09 Binary files /dev/null and b/Items/Weapons/CelestialClaymore.png differ diff --git a/Items/Weapons/Celestus.cs b/Items/Weapons/Celestus.cs new file mode 100644 index 0000000000..f6a3da7592 --- /dev/null +++ b/Items/Weapons/Celestus.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/Celestus.png b/Items/Weapons/Celestus.png new file mode 100644 index 0000000000..8b52214ea1 Binary files /dev/null and b/Items/Weapons/Celestus.png differ diff --git a/Items/Weapons/Chaotrix.cs b/Items/Weapons/Chaotrix.cs new file mode 100644 index 0000000000..997c84b038 --- /dev/null +++ b/Items/Weapons/Chaotrix.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Chaotrix.png b/Items/Weapons/Chaotrix.png new file mode 100644 index 0000000000..5c28f0f4f5 Binary files /dev/null and b/Items/Weapons/Chaotrix.png differ diff --git a/Items/Weapons/ChargedDartRifle.cs b/Items/Weapons/ChargedDartRifle.cs new file mode 100644 index 0000000000..727ed364ff --- /dev/null +++ b/Items/Weapons/ChargedDartRifle.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ChargedDartRifle.png b/Items/Weapons/ChargedDartRifle.png new file mode 100644 index 0000000000..f1d9e65a8e Binary files /dev/null and b/Items/Weapons/ChargedDartRifle.png differ diff --git a/Items/Weapons/ClaretCannon.cs b/Items/Weapons/ClaretCannon.cs new file mode 100644 index 0000000000..26d5f06cbd --- /dev/null +++ b/Items/Weapons/ClaretCannon.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ClaretCannon.png b/Items/Weapons/ClaretCannon.png new file mode 100644 index 0000000000..c85ef4849d Binary files /dev/null and b/Items/Weapons/ClaretCannon.png differ diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs new file mode 100644 index 0000000000..f3e809efed --- /dev/null +++ b/Items/Weapons/CleansingBlaze.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CleansingBlaze.png b/Items/Weapons/CleansingBlaze.png new file mode 100644 index 0000000000..beec36ab4b Binary files /dev/null and b/Items/Weapons/CleansingBlaze.png differ diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs new file mode 100644 index 0000000000..40239d32cc --- /dev/null +++ b/Items/Weapons/Climax.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Climax : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voltaic Climax"); + Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 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/Climax.png b/Items/Weapons/Climax.png new file mode 100644 index 0000000000..17616c565c Binary files /dev/null and b/Items/Weapons/Climax.png differ diff --git a/Items/Weapons/ClockGatlignum.cs b/Items/Weapons/ClockGatlignum.cs new file mode 100644 index 0000000000..5162cfa0a2 --- /dev/null +++ b/Items/Weapons/ClockGatlignum.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ClockGatlignum.png b/Items/Weapons/ClockGatlignum.png new file mode 100644 index 0000000000..98ad7faa68 Binary files /dev/null and b/Items/Weapons/ClockGatlignum.png differ diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs new file mode 100644 index 0000000000..650ebb01c2 --- /dev/null +++ b/Items/Weapons/ClockworkBow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ClockworkBow.png b/Items/Weapons/ClockworkBow.png new file mode 100644 index 0000000000..8f08853dca Binary files /dev/null and b/Items/Weapons/ClockworkBow.png differ diff --git a/Items/Weapons/Cnidarian.cs b/Items/Weapons/Cnidarian.cs new file mode 100644 index 0000000000..8cccb515a4 --- /dev/null +++ b/Items/Weapons/Cnidarian.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Cnidarian.png b/Items/Weapons/Cnidarian.png new file mode 100644 index 0000000000..773a60fe4f Binary files /dev/null and b/Items/Weapons/Cnidarian.png differ diff --git a/Items/Weapons/CobaltKunai.cs b/Items/Weapons/CobaltKunai.cs new file mode 100644 index 0000000000..b59b43a858 --- /dev/null +++ b/Items/Weapons/CobaltKunai.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/CobaltKunai.png b/Items/Weapons/CobaltKunai.png new file mode 100644 index 0000000000..60efb60324 Binary files /dev/null and b/Items/Weapons/CobaltKunai.png differ diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs new file mode 100644 index 0000000000..7b020909e3 --- /dev/null +++ b/Items/Weapons/CometQuasher.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/CometQuasher.png b/Items/Weapons/CometQuasher.png new file mode 100644 index 0000000000..c4aaa09425 Binary files /dev/null and b/Items/Weapons/CometQuasher.png differ diff --git a/Items/Weapons/ConferenceCall.cs b/Items/Weapons/ConferenceCall.cs new file mode 100644 index 0000000000..16d377ffcb --- /dev/null +++ b/Items/Weapons/ConferenceCall.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ConferenceCall.png b/Items/Weapons/ConferenceCall.png new file mode 100644 index 0000000000..0a0e3263ae Binary files /dev/null and b/Items/Weapons/ConferenceCall.png differ diff --git a/Items/Weapons/Contagion.cs b/Items/Weapons/Contagion.cs new file mode 100644 index 0000000000..7d6ce91fcb --- /dev/null +++ b/Items/Weapons/Contagion.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Contagion.png b/Items/Weapons/Contagion.png new file mode 100644 index 0000000000..4f4f3ffd5e Binary files /dev/null and b/Items/Weapons/Contagion.png differ diff --git a/Items/Weapons/CoralSpout.cs b/Items/Weapons/CoralSpout.cs new file mode 100644 index 0000000000..c1c1464af3 --- /dev/null +++ b/Items/Weapons/CoralSpout.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CoralSpout.png b/Items/Weapons/CoralSpout.png new file mode 100644 index 0000000000..bb3c96dc78 Binary files /dev/null and b/Items/Weapons/CoralSpout.png differ diff --git a/Items/Weapons/CosmicBolter.cs b/Items/Weapons/CosmicBolter.cs new file mode 100644 index 0000000000..22a2775a93 --- /dev/null +++ b/Items/Weapons/CosmicBolter.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CosmicBolter.png b/Items/Weapons/CosmicBolter.png new file mode 100644 index 0000000000..09035f16c5 Binary files /dev/null and b/Items/Weapons/CosmicBolter.png differ diff --git a/Items/Weapons/CosmicDischarge.cs b/Items/Weapons/CosmicDischarge.cs new file mode 100644 index 0000000000..7b424b74d0 --- /dev/null +++ b/Items/Weapons/CosmicDischarge.cs @@ -0,0 +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 + { + 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" + + "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; + } + } +} diff --git a/Items/Weapons/CosmicDischarge.png b/Items/Weapons/CosmicDischarge.png new file mode 100644 index 0000000000..61fac5d428 Binary files /dev/null and b/Items/Weapons/CosmicDischarge.png differ diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs new file mode 100644 index 0000000000..280b5f4558 --- /dev/null +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CosmicImmaterializer.png b/Items/Weapons/CosmicImmaterializer.png new file mode 100644 index 0000000000..aaf579725d Binary files /dev/null and b/Items/Weapons/CosmicImmaterializer.png differ diff --git a/Items/Weapons/CosmicKunai.cs b/Items/Weapons/CosmicKunai.cs new file mode 100644 index 0000000000..1f8835649e --- /dev/null +++ b/Items/Weapons/CosmicKunai.cs @@ -0,0 +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 + { + 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); + } + } + } + } +} diff --git a/Items/Weapons/CosmicKunai.png b/Items/Weapons/CosmicKunai.png new file mode 100644 index 0000000000..645149a78c Binary files /dev/null and b/Items/Weapons/CosmicKunai.png differ diff --git a/Items/Weapons/CosmicRainbow.cs b/Items/Weapons/CosmicRainbow.cs new file mode 100644 index 0000000000..14126ca5e3 --- /dev/null +++ b/Items/Weapons/CosmicRainbow.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CosmicRainbow.png b/Items/Weapons/CosmicRainbow.png new file mode 100644 index 0000000000..a17870b660 Binary files /dev/null and b/Items/Weapons/CosmicRainbow.png differ diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs new file mode 100644 index 0000000000..fb2938ce6b --- /dev/null +++ b/Items/Weapons/Cosmilamp.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Cosmilamp.png b/Items/Weapons/Cosmilamp.png new file mode 100644 index 0000000000..2f2f239a4b Binary files /dev/null and b/Items/Weapons/Cosmilamp.png differ diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs new file mode 100644 index 0000000000..3a51232f03 --- /dev/null +++ b/Items/Weapons/Crabulon/Fungicide.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Crabulon/Fungicide.png b/Items/Weapons/Crabulon/Fungicide.png new file mode 100644 index 0000000000..3fdc8147b9 Binary files /dev/null and b/Items/Weapons/Crabulon/Fungicide.png differ diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs new file mode 100644 index 0000000000..d427d2878d --- /dev/null +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Crabulon/HyphaeRod.png b/Items/Weapons/Crabulon/HyphaeRod.png new file mode 100644 index 0000000000..5705fff04a Binary files /dev/null and b/Items/Weapons/Crabulon/HyphaeRod.png differ diff --git a/Items/Weapons/Crabulon/MycelialClaws.cs b/Items/Weapons/Crabulon/MycelialClaws.cs new file mode 100644 index 0000000000..11caa968df --- /dev/null +++ b/Items/Weapons/Crabulon/MycelialClaws.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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); + } + } + } +} diff --git a/Items/Weapons/Crabulon/MycelialClaws.png b/Items/Weapons/Crabulon/MycelialClaws.png new file mode 100644 index 0000000000..1fa8783301 Binary files /dev/null and b/Items/Weapons/Crabulon/MycelialClaws.png differ diff --git a/Items/Weapons/Crabulon/Mycoroot.cs b/Items/Weapons/Crabulon/Mycoroot.cs new file mode 100644 index 0000000000..c55edbd3a0 --- /dev/null +++ b/Items/Weapons/Crabulon/Mycoroot.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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; + } + } +} diff --git a/Items/Weapons/Crabulon/Mycoroot.png b/Items/Weapons/Crabulon/Mycoroot.png new file mode 100644 index 0000000000..b8bfd1b5d0 Binary files /dev/null and b/Items/Weapons/Crabulon/Mycoroot.png differ diff --git a/Items/Weapons/Crabulon/ShroomlingStaff.png b/Items/Weapons/Crabulon/ShroomlingStaff.png new file mode 100644 index 0000000000..ba7262a270 Binary files /dev/null and b/Items/Weapons/Crabulon/ShroomlingStaff.png differ diff --git a/Items/Weapons/Crimsaber.cs b/Items/Weapons/Crimsaber.cs new file mode 100644 index 0000000000..864652042c --- /dev/null +++ b/Items/Weapons/Crimsaber.cs @@ -0,0 +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 + { + 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); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Crimsaber.png b/Items/Weapons/Crimsaber.png new file mode 100644 index 0000000000..edc553faab Binary files /dev/null and b/Items/Weapons/Crimsaber.png differ diff --git a/Items/Weapons/CryoArrow.png b/Items/Weapons/CryoArrow.png new file mode 100644 index 0000000000..d667dfa5b6 Binary files /dev/null and b/Items/Weapons/CryoArrow.png differ diff --git a/Items/Weapons/Cryogen/BittercoldStaff.cs b/Items/Weapons/Cryogen/BittercoldStaff.cs new file mode 100644 index 0000000000..bb72790404 --- /dev/null +++ b/Items/Weapons/Cryogen/BittercoldStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Cryogen/BittercoldStaff.png b/Items/Weapons/Cryogen/BittercoldStaff.png new file mode 100644 index 0000000000..80eec4cc57 Binary files /dev/null and b/Items/Weapons/Cryogen/BittercoldStaff.png differ diff --git a/Items/Weapons/Cryogen/EffluviumBow.cs b/Items/Weapons/Cryogen/EffluviumBow.cs new file mode 100644 index 0000000000..c906eb54e7 --- /dev/null +++ b/Items/Weapons/Cryogen/EffluviumBow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Cryogen/EffluviumBow.png b/Items/Weapons/Cryogen/EffluviumBow.png new file mode 100644 index 0000000000..4821396777 Binary files /dev/null and b/Items/Weapons/Cryogen/EffluviumBow.png differ diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs new file mode 100644 index 0000000000..c6cd7ca359 --- /dev/null +++ b/Items/Weapons/Cryogen/GlacialCrusher.cs @@ -0,0 +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 +{ + 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); + } +}} diff --git a/Items/Weapons/Cryogen/GlacialCrusher.png b/Items/Weapons/Cryogen/GlacialCrusher.png new file mode 100644 index 0000000000..1e7dfd3c37 Binary files /dev/null and b/Items/Weapons/Cryogen/GlacialCrusher.png differ diff --git a/Items/Weapons/Cryogen/IceStar.cs b/Items/Weapons/Cryogen/IceStar.cs new file mode 100644 index 0000000000..cd5d1982a8 --- /dev/null +++ b/Items/Weapons/Cryogen/IceStar.cs @@ -0,0 +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.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(); + } +}} diff --git a/Items/Weapons/Cryogen/IceStar.png b/Items/Weapons/Cryogen/IceStar.png new file mode 100644 index 0000000000..ec834cdfa5 Binary files /dev/null and b/Items/Weapons/Cryogen/IceStar.png differ diff --git a/Items/Weapons/Cryogen/Icebreaker.cs b/Items/Weapons/Cryogen/Icebreaker.cs new file mode 100644 index 0000000000..dcc03aad60 --- /dev/null +++ b/Items/Weapons/Cryogen/Icebreaker.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/Cryogen/Icebreaker.png b/Items/Weapons/Cryogen/Icebreaker.png new file mode 100644 index 0000000000..7839c05097 Binary files /dev/null and b/Items/Weapons/Cryogen/Icebreaker.png differ diff --git a/Items/Weapons/Cryogen/Permafrost.cs b/Items/Weapons/Cryogen/Permafrost.cs new file mode 100644 index 0000000000..de44cd1da6 --- /dev/null +++ b/Items/Weapons/Cryogen/Permafrost.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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; + } + } +}} diff --git a/Items/Weapons/Cryogen/Permafrost.png b/Items/Weapons/Cryogen/Permafrost.png new file mode 100644 index 0000000000..6c7c5fb9c4 Binary files /dev/null and b/Items/Weapons/Cryogen/Permafrost.png differ diff --git a/Items/Weapons/Cryogen/SnowstormStaff.cs b/Items/Weapons/Cryogen/SnowstormStaff.cs new file mode 100644 index 0000000000..a93448b1e0 --- /dev/null +++ b/Items/Weapons/Cryogen/SnowstormStaff.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/Cryogen/SnowstormStaff.png b/Items/Weapons/Cryogen/SnowstormStaff.png new file mode 100644 index 0000000000..15b88a52f8 Binary files /dev/null and b/Items/Weapons/Cryogen/SnowstormStaff.png differ diff --git a/Items/Weapons/CrystalBlade.cs b/Items/Weapons/CrystalBlade.cs new file mode 100644 index 0000000000..dacf920492 --- /dev/null +++ b/Items/Weapons/CrystalBlade.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/CrystalBlade.png b/Items/Weapons/CrystalBlade.png new file mode 100644 index 0000000000..d44d500e30 Binary files /dev/null and b/Items/Weapons/CrystalBlade.png differ diff --git a/Items/Weapons/CrystalFlareStaff.cs b/Items/Weapons/CrystalFlareStaff.cs new file mode 100644 index 0000000000..a5c4f24a88 --- /dev/null +++ b/Items/Weapons/CrystalFlareStaff.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class CrystalFlareStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Flare Staff"); + Tooltip.SetDefault("Fires blue frost flames that explode"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CrystalFlareStaff.png b/Items/Weapons/CrystalFlareStaff.png new file mode 100644 index 0000000000..7bbc4fbc96 Binary files /dev/null and b/Items/Weapons/CrystalFlareStaff.png differ diff --git a/Items/Weapons/CrystalPiercer.cs b/Items/Weapons/CrystalPiercer.cs new file mode 100644 index 0000000000..722dadedcf --- /dev/null +++ b/Items/Weapons/CrystalPiercer.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/CrystalPiercer.png b/Items/Weapons/CrystalPiercer.png new file mode 100644 index 0000000000..aa9783fb6e Binary files /dev/null and b/Items/Weapons/CrystalPiercer.png differ diff --git a/Items/Weapons/Crystalline.cs b/Items/Weapons/Crystalline.cs new file mode 100644 index 0000000000..b221d17489 --- /dev/null +++ b/Items/Weapons/Crystalline.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} diff --git a/Items/Weapons/Crystalline.png b/Items/Weapons/Crystalline.png new file mode 100644 index 0000000000..f96d923ad7 Binary files /dev/null and b/Items/Weapons/Crystalline.png differ diff --git a/Items/Weapons/CursedCapper.cs b/Items/Weapons/CursedCapper.cs new file mode 100644 index 0000000000..1563fc3ca5 --- /dev/null +++ b/Items/Weapons/CursedCapper.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/CursedCapper.png b/Items/Weapons/CursedCapper.png new file mode 100644 index 0000000000..e957e82c70 Binary files /dev/null and b/Items/Weapons/CursedCapper.png differ diff --git a/Items/Weapons/CursedDagger.cs b/Items/Weapons/CursedDagger.cs new file mode 100644 index 0000000000..4c9b16bc92 --- /dev/null +++ b/Items/Weapons/CursedDagger.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} diff --git a/Items/Weapons/CursedDagger.png b/Items/Weapons/CursedDagger.png new file mode 100644 index 0000000000..9a81c1fccc Binary files /dev/null and b/Items/Weapons/CursedDagger.png differ diff --git a/Items/Weapons/DarkechoGreatbow.cs b/Items/Weapons/DarkechoGreatbow.cs new file mode 100644 index 0000000000..84f108f271 --- /dev/null +++ b/Items/Weapons/DarkechoGreatbow.cs @@ -0,0 +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 +{ + 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; + } + 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, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DarkechoGreatbow.png b/Items/Weapons/DarkechoGreatbow.png new file mode 100644 index 0000000000..52f4544f17 Binary files /dev/null and b/Items/Weapons/DarkechoGreatbow.png differ diff --git a/Items/Weapons/DarklightGreatsword.cs b/Items/Weapons/DarklightGreatsword.cs new file mode 100644 index 0000000000..abc751a261 --- /dev/null +++ b/Items/Weapons/DarklightGreatsword.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/DarklightGreatsword.png b/Items/Weapons/DarklightGreatsword.png new file mode 100644 index 0000000000..a21d093b08 Binary files /dev/null and b/Items/Weapons/DarklightGreatsword.png differ diff --git a/Items/Weapons/DeathValley.cs b/Items/Weapons/DeathValley.cs new file mode 100644 index 0000000000..57a9d4f373 --- /dev/null +++ b/Items/Weapons/DeathValley.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DeathValley.png b/Items/Weapons/DeathValley.png new file mode 100644 index 0000000000..6010147ff4 Binary files /dev/null and b/Items/Weapons/DeathValley.png differ diff --git a/Items/Weapons/DemonicPitchfork.cs b/Items/Weapons/DemonicPitchfork.cs new file mode 100644 index 0000000000..fb148dbd83 --- /dev/null +++ b/Items/Weapons/DemonicPitchfork.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class DemonicPitchfork : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonic Pitchfork"); + Tooltip.SetDefault("Fires a demonic pitchfork"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DemonicPitchfork.png b/Items/Weapons/DemonicPitchfork.png new file mode 100644 index 0000000000..cc7864179d Binary files /dev/null and b/Items/Weapons/DemonicPitchfork.png differ diff --git a/Items/Weapons/DepthBlade.cs b/Items/Weapons/DepthBlade.cs new file mode 100644 index 0000000000..365babae08 --- /dev/null +++ b/Items/Weapons/DepthBlade.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } +} diff --git a/Items/Weapons/DepthBlade.png b/Items/Weapons/DepthBlade.png new file mode 100644 index 0000000000..5fb47c5b02 Binary files /dev/null and b/Items/Weapons/DepthBlade.png differ diff --git a/Items/Weapons/DesertScourge/AquaticDischarge.cs b/Items/Weapons/DesertScourge/AquaticDischarge.cs new file mode 100644 index 0000000000..8be0af3c84 --- /dev/null +++ b/Items/Weapons/DesertScourge/AquaticDischarge.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/DesertScourge/AquaticDischarge.png b/Items/Weapons/DesertScourge/AquaticDischarge.png new file mode 100644 index 0000000000..02237d947d Binary files /dev/null and b/Items/Weapons/DesertScourge/AquaticDischarge.png differ diff --git a/Items/Weapons/DesertScourge/Barinade.cs b/Items/Weapons/DesertScourge/Barinade.cs new file mode 100644 index 0000000000..38d27e408d --- /dev/null +++ b/Items/Weapons/DesertScourge/Barinade.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DesertScourge/Barinade.png b/Items/Weapons/DesertScourge/Barinade.png new file mode 100644 index 0000000000..0884a46051 Binary files /dev/null and b/Items/Weapons/DesertScourge/Barinade.png differ diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.cs b/Items/Weapons/DesertScourge/SeaboundStaff.cs new file mode 100644 index 0000000000..f462cc5483 --- /dev/null +++ b/Items/Weapons/DesertScourge/SeaboundStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.png b/Items/Weapons/DesertScourge/SeaboundStaff.png new file mode 100644 index 0000000000..8a0fe4de66 Binary files /dev/null and b/Items/Weapons/DesertScourge/SeaboundStaff.png differ diff --git a/Items/Weapons/DesertScourge/StormSpray.cs b/Items/Weapons/DesertScourge/StormSpray.cs new file mode 100644 index 0000000000..536db4f0e4 --- /dev/null +++ b/Items/Weapons/DesertScourge/StormSpray.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DesertScourge/StormSpray.png b/Items/Weapons/DesertScourge/StormSpray.png new file mode 100644 index 0000000000..a95d2fa686 Binary files /dev/null and b/Items/Weapons/DesertScourge/StormSpray.png differ diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs new file mode 100644 index 0000000000..9c3ca46c50 --- /dev/null +++ b/Items/Weapons/Devastation.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/Devastation.png b/Items/Weapons/Devastation.png new file mode 100644 index 0000000000..63d990c0d6 Binary files /dev/null and b/Items/Weapons/Devastation.png differ diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs new file mode 100644 index 0000000000..3827a11de0 --- /dev/null +++ b/Items/Weapons/DevilsDevastation.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/DevilsDevastation.png b/Items/Weapons/DevilsDevastation.png new file mode 100644 index 0000000000..59afcbb8e6 Binary files /dev/null and b/Items/Weapons/DevilsDevastation.png differ diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs new file mode 100644 index 0000000000..d7668f7db5 --- /dev/null +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -0,0 +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.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.png b/Items/Weapons/DevourerofGods/DeathhailStaff.png new file mode 100644 index 0000000000..38a03e9ed2 Binary files /dev/null and b/Items/Weapons/DevourerofGods/DeathhailStaff.png differ diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs new file mode 100644 index 0000000000..34b39499a3 --- /dev/null +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//using 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/Deathwind.png b/Items/Weapons/DevourerofGods/Deathwind.png new file mode 100644 index 0000000000..9f440ea148 Binary files /dev/null and b/Items/Weapons/DevourerofGods/Deathwind.png differ diff --git a/Items/Weapons/DevourerofGods/Eradicator.cs b/Items/Weapons/DevourerofGods/Eradicator.cs new file mode 100644 index 0000000000..f622d0ed3f --- /dev/null +++ b/Items/Weapons/DevourerofGods/Eradicator.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/Eradicator.png b/Items/Weapons/DevourerofGods/Eradicator.png new file mode 100644 index 0000000000..e12958fc93 Binary files /dev/null and b/Items/Weapons/DevourerofGods/Eradicator.png differ diff --git a/Items/Weapons/DevourerofGods/EradicatorMelee.cs b/Items/Weapons/DevourerofGods/EradicatorMelee.cs new file mode 100644 index 0000000000..b30472d460 --- /dev/null +++ b/Items/Weapons/DevourerofGods/EradicatorMelee.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/EradicatorMelee.png b/Items/Weapons/DevourerofGods/EradicatorMelee.png new file mode 100644 index 0000000000..e12958fc93 Binary files /dev/null and b/Items/Weapons/DevourerofGods/EradicatorMelee.png differ diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs new file mode 100644 index 0000000000..ebc9df4f6f --- /dev/null +++ b/Items/Weapons/DevourerofGods/Excelsus.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/Excelsus.png b/Items/Weapons/DevourerofGods/Excelsus.png new file mode 100644 index 0000000000..5f43b4abc6 Binary files /dev/null and b/Items/Weapons/DevourerofGods/Excelsus.png differ diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs new file mode 100644 index 0000000000..536110decc --- /dev/null +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -0,0 +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 + { + 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" + + "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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.png b/Items/Weapons/DevourerofGods/StaffoftheMechworm.png new file mode 100644 index 0000000000..553ccdf76a Binary files /dev/null and b/Items/Weapons/DevourerofGods/StaffoftheMechworm.png differ diff --git a/Items/Weapons/DevourerofGods/TheObliterator.cs b/Items/Weapons/DevourerofGods/TheObliterator.cs new file mode 100644 index 0000000000..e9402cbdd1 --- /dev/null +++ b/Items/Weapons/DevourerofGods/TheObliterator.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DevourerofGods/TheObliterator.png b/Items/Weapons/DevourerofGods/TheObliterator.png new file mode 100644 index 0000000000..25f0d6d3a4 Binary files /dev/null and b/Items/Weapons/DevourerofGods/TheObliterator.png differ diff --git a/Items/Weapons/DraconicDestruction.cs b/Items/Weapons/DraconicDestruction.cs new file mode 100644 index 0000000000..d953861e1a --- /dev/null +++ b/Items/Weapons/DraconicDestruction.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/DraconicDestruction.png b/Items/Weapons/DraconicDestruction.png new file mode 100644 index 0000000000..3bdf89458b Binary files /dev/null and b/Items/Weapons/DraconicDestruction.png differ diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs new file mode 100644 index 0000000000..f408c29349 --- /dev/null +++ b/Items/Weapons/DraedonsExoblade.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/DraedonsExoblade.png b/Items/Weapons/DraedonsExoblade.png new file mode 100644 index 0000000000..ab57117c0e Binary files /dev/null and b/Items/Weapons/DraedonsExoblade.png differ diff --git a/Items/Weapons/Drataliornus.cs b/Items/Weapons/Drataliornus.cs new file mode 100644 index 0000000000..bd6cda7de7 --- /dev/null +++ b/Items/Weapons/Drataliornus.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/Drataliornus.png b/Items/Weapons/Drataliornus.png new file mode 100644 index 0000000000..35dab92fcd Binary files /dev/null and b/Items/Weapons/Drataliornus.png differ diff --git a/Items/Weapons/Dualpoon.cs b/Items/Weapons/Dualpoon.cs new file mode 100644 index 0000000000..f64cd61757 --- /dev/null +++ b/Items/Weapons/Dualpoon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Dualpoon.png b/Items/Weapons/Dualpoon.png new file mode 100644 index 0000000000..525a2a87f0 Binary files /dev/null and b/Items/Weapons/Dualpoon.png differ diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs new file mode 100644 index 0000000000..0a05a50e73 --- /dev/null +++ b/Items/Weapons/Earth.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Earth : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + Tooltip.SetDefault("Has a chance to lower enemy defense by 50 when striking them\n" + + "Your attacks will heal you a lot\n" + + "Rains RGB meteors that explode into more meteors after a short time on enemy hits\n" + + "Ice meteors freeze enemies\n" + + "Flame meteors explode\n" + + "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(); + } + } +} diff --git a/Items/Weapons/Earth.png b/Items/Weapons/Earth.png new file mode 100644 index 0000000000..8b7e3adf51 Binary files /dev/null and b/Items/Weapons/Earth.png differ diff --git a/Items/Weapons/EarthenPike.cs b/Items/Weapons/EarthenPike.cs new file mode 100644 index 0000000000..8139949d43 --- /dev/null +++ b/Items/Weapons/EarthenPike.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} diff --git a/Items/Weapons/EarthenPike.png b/Items/Weapons/EarthenPike.png new file mode 100644 index 0000000000..3daddf654d Binary files /dev/null and b/Items/Weapons/EarthenPike.png differ diff --git a/Items/Weapons/Effervescence.cs b/Items/Weapons/Effervescence.cs new file mode 100644 index 0000000000..1da5c869a4 --- /dev/null +++ b/Items/Weapons/Effervescence.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Effervescence.png b/Items/Weapons/Effervescence.png new file mode 100644 index 0000000000..70af7dc56a Binary files /dev/null and b/Items/Weapons/Effervescence.png differ diff --git a/Items/Weapons/ElementalAxe.cs b/Items/Weapons/ElementalAxe.cs new file mode 100644 index 0000000000..980f269476 --- /dev/null +++ b/Items/Weapons/ElementalAxe.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ElementalAxe.png b/Items/Weapons/ElementalAxe.png new file mode 100644 index 0000000000..06ae7fb2e6 Binary files /dev/null and b/Items/Weapons/ElementalAxe.png differ diff --git a/Items/Weapons/ElementalBlaster.cs b/Items/Weapons/ElementalBlaster.cs new file mode 100644 index 0000000000..b6d9c44c46 --- /dev/null +++ b/Items/Weapons/ElementalBlaster.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ElementalBlaster.png b/Items/Weapons/ElementalBlaster.png new file mode 100644 index 0000000000..3ce7de1a2c Binary files /dev/null and b/Items/Weapons/ElementalBlaster.png differ diff --git a/Items/Weapons/ElementalEruption.cs b/Items/Weapons/ElementalEruption.cs new file mode 100644 index 0000000000..7c4278b4ac --- /dev/null +++ b/Items/Weapons/ElementalEruption.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ElementalEruption.png b/Items/Weapons/ElementalEruption.png new file mode 100644 index 0000000000..d5748c9943 Binary files /dev/null and b/Items/Weapons/ElementalEruption.png differ diff --git a/Items/Weapons/ElementalRay.cs b/Items/Weapons/ElementalRay.cs new file mode 100644 index 0000000000..8c27347912 --- /dev/null +++ b/Items/Weapons/ElementalRay.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ElementalRay.png b/Items/Weapons/ElementalRay.png new file mode 100644 index 0000000000..8fdeb5441e Binary files /dev/null and b/Items/Weapons/ElementalRay.png differ diff --git a/Items/Weapons/ElementalShortsword.cs b/Items/Weapons/ElementalShortsword.cs new file mode 100644 index 0000000000..f2b3167319 --- /dev/null +++ b/Items/Weapons/ElementalShortsword.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/ElementalShortsword.png b/Items/Weapons/ElementalShortsword.png new file mode 100644 index 0000000000..c7c7aa1288 Binary files /dev/null and b/Items/Weapons/ElementalShortsword.png differ diff --git a/Items/Weapons/ElysianArrow.cs b/Items/Weapons/ElysianArrow.cs new file mode 100644 index 0000000000..6d7ee68639 --- /dev/null +++ b/Items/Weapons/ElysianArrow.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ElysianArrow.png b/Items/Weapons/ElysianArrow.png new file mode 100644 index 0000000000..ed813a16ae Binary files /dev/null and b/Items/Weapons/ElysianArrow.png differ diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs new file mode 100644 index 0000000000..dd3a537578 --- /dev/null +++ b/Items/Weapons/EmpyreanKnives.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/EmpyreanKnives.png b/Items/Weapons/EmpyreanKnives.png new file mode 100644 index 0000000000..15b3e46fbc Binary files /dev/null and b/Items/Weapons/EmpyreanKnives.png differ diff --git a/Items/Weapons/EmpyreanKnivesThrown.cs b/Items/Weapons/EmpyreanKnivesThrown.cs new file mode 100644 index 0000000000..62d95f1bec --- /dev/null +++ b/Items/Weapons/EmpyreanKnivesThrown.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/EmpyreanKnivesThrown.png b/Items/Weapons/EmpyreanKnivesThrown.png new file mode 100644 index 0000000000..15b3e46fbc Binary files /dev/null and b/Items/Weapons/EmpyreanKnivesThrown.png differ diff --git a/Items/Weapons/EnergyStaff.cs b/Items/Weapons/EnergyStaff.cs new file mode 100644 index 0000000000..7e4d39c289 --- /dev/null +++ b/Items/Weapons/EnergyStaff.cs @@ -0,0 +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 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/EnergyStaff.png b/Items/Weapons/EnergyStaff.png new file mode 100644 index 0000000000..5d9f365fdc Binary files /dev/null and b/Items/Weapons/EnergyStaff.png differ diff --git a/Items/Weapons/EnhancedNanoRound.cs b/Items/Weapons/EnhancedNanoRound.cs new file mode 100644 index 0000000000..8ea89394ad --- /dev/null +++ b/Items/Weapons/EnhancedNanoRound.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/EnhancedNanoRound.png b/Items/Weapons/EnhancedNanoRound.png new file mode 100644 index 0000000000..4ac538c0ec Binary files /dev/null and b/Items/Weapons/EnhancedNanoRound.png differ diff --git a/Items/Weapons/EssenceFlayer.cs b/Items/Weapons/EssenceFlayer.cs new file mode 100644 index 0000000000..0663a20067 --- /dev/null +++ b/Items/Weapons/EssenceFlayer.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/EssenceFlayer.png b/Items/Weapons/EssenceFlayer.png new file mode 100644 index 0000000000..f6966bee47 Binary files /dev/null and b/Items/Weapons/EssenceFlayer.png differ diff --git a/Items/Weapons/EvergladeSpray.cs b/Items/Weapons/EvergladeSpray.cs new file mode 100644 index 0000000000..4c9050df5c --- /dev/null +++ b/Items/Weapons/EvergladeSpray.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/EvergladeSpray.png b/Items/Weapons/EvergladeSpray.png new file mode 100644 index 0000000000..4c0af5fccd Binary files /dev/null and b/Items/Weapons/EvergladeSpray.png differ diff --git a/Items/Weapons/ExcaliburShortsword.cs b/Items/Weapons/ExcaliburShortsword.cs new file mode 100644 index 0000000000..f4978a9994 --- /dev/null +++ b/Items/Weapons/ExcaliburShortsword.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } +} diff --git a/Items/Weapons/ExcaliburShortsword.png b/Items/Weapons/ExcaliburShortsword.png new file mode 100644 index 0000000000..f7050a8f03 Binary files /dev/null and b/Items/Weapons/ExcaliburShortsword.png differ diff --git a/Items/Weapons/ExecutionersBlade.cs b/Items/Weapons/ExecutionersBlade.cs new file mode 100644 index 0000000000..5151dc6dd6 --- /dev/null +++ b/Items/Weapons/ExecutionersBlade.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/ExecutionersBlade.png b/Items/Weapons/ExecutionersBlade.png new file mode 100644 index 0000000000..1a71859059 Binary files /dev/null and b/Items/Weapons/ExecutionersBlade.png differ diff --git a/Items/Weapons/ExsanguinationLance.cs b/Items/Weapons/ExsanguinationLance.cs new file mode 100644 index 0000000000..7e53f90ca9 --- /dev/null +++ b/Items/Weapons/ExsanguinationLance.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/ExsanguinationLance.png b/Items/Weapons/ExsanguinationLance.png new file mode 100644 index 0000000000..22a3c525d9 Binary files /dev/null and b/Items/Weapons/ExsanguinationLance.png differ diff --git a/Items/Weapons/Fabstaff.cs b/Items/Weapons/Fabstaff.cs new file mode 100644 index 0000000000..c73c5d245d --- /dev/null +++ b/Items/Weapons/Fabstaff.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Fabstaff.png b/Items/Weapons/Fabstaff.png new file mode 100644 index 0000000000..0e36ca8917 Binary files /dev/null and b/Items/Weapons/Fabstaff.png differ diff --git a/Items/Weapons/FeatherKnife.cs b/Items/Weapons/FeatherKnife.cs new file mode 100644 index 0000000000..af6bda4d06 --- /dev/null +++ b/Items/Weapons/FeatherKnife.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/FeatherKnife.png b/Items/Weapons/FeatherKnife.png new file mode 100644 index 0000000000..eb0f069f02 Binary files /dev/null and b/Items/Weapons/FeatherKnife.png differ diff --git a/Items/Weapons/FellerofEvergreens.cs b/Items/Weapons/FellerofEvergreens.cs new file mode 100644 index 0000000000..68e1a29636 --- /dev/null +++ b/Items/Weapons/FellerofEvergreens.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FellerofEvergreens.png b/Items/Weapons/FellerofEvergreens.png new file mode 100644 index 0000000000..df8c3ff448 Binary files /dev/null and b/Items/Weapons/FellerofEvergreens.png differ diff --git a/Items/Weapons/FeralthornClaymore.cs b/Items/Weapons/FeralthornClaymore.cs new file mode 100644 index 0000000000..4a05ba3acd --- /dev/null +++ b/Items/Weapons/FeralthornClaymore.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/FeralthornClaymore.png b/Items/Weapons/FeralthornClaymore.png new file mode 100644 index 0000000000..5296ef34e9 Binary files /dev/null and b/Items/Weapons/FeralthornClaymore.png differ diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs new file mode 100644 index 0000000000..970ab71c4a --- /dev/null +++ b/Items/Weapons/FirestormCannon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FirestormCannon.png b/Items/Weapons/FirestormCannon.png new file mode 100644 index 0000000000..6d93c984ae Binary files /dev/null and b/Items/Weapons/FirestormCannon.png differ diff --git a/Items/Weapons/FlameScythe.cs b/Items/Weapons/FlameScythe.cs new file mode 100644 index 0000000000..0c702a164e --- /dev/null +++ b/Items/Weapons/FlameScythe.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} diff --git a/Items/Weapons/FlameScythe.png b/Items/Weapons/FlameScythe.png new file mode 100644 index 0000000000..6df15cd567 Binary files /dev/null and b/Items/Weapons/FlameScythe.png differ diff --git a/Items/Weapons/FlameScytheMelee.cs b/Items/Weapons/FlameScytheMelee.cs new file mode 100644 index 0000000000..e36acada5e --- /dev/null +++ b/Items/Weapons/FlameScytheMelee.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} diff --git a/Items/Weapons/FlameScytheMelee.png b/Items/Weapons/FlameScytheMelee.png new file mode 100644 index 0000000000..6df15cd567 Binary files /dev/null and b/Items/Weapons/FlameScytheMelee.png differ diff --git a/Items/Weapons/FlameburstShortsword.cs b/Items/Weapons/FlameburstShortsword.cs new file mode 100644 index 0000000000..f9ccda3b94 --- /dev/null +++ b/Items/Weapons/FlameburstShortsword.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/FlameburstShortsword.png b/Items/Weapons/FlameburstShortsword.png new file mode 100644 index 0000000000..1c6d747f39 Binary files /dev/null and b/Items/Weapons/FlameburstShortsword.png differ diff --git a/Items/Weapons/FlareBolt.cs b/Items/Weapons/FlareBolt.cs new file mode 100644 index 0000000000..a229b00cf8 --- /dev/null +++ b/Items/Weapons/FlareBolt.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FlareBolt.png b/Items/Weapons/FlareBolt.png new file mode 100644 index 0000000000..70054e25d1 Binary files /dev/null and b/Items/Weapons/FlareBolt.png differ diff --git a/Items/Weapons/FlarefrostBlade.cs b/Items/Weapons/FlarefrostBlade.cs new file mode 100644 index 0000000000..9b61b9ecd4 --- /dev/null +++ b/Items/Weapons/FlarefrostBlade.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/FlarefrostBlade.png b/Items/Weapons/FlarefrostBlade.png new file mode 100644 index 0000000000..84dec1cb86 Binary files /dev/null and b/Items/Weapons/FlarefrostBlade.png differ diff --git a/Items/Weapons/FlarewingBow.cs b/Items/Weapons/FlarewingBow.cs new file mode 100644 index 0000000000..e4293057cb --- /dev/null +++ b/Items/Weapons/FlarewingBow.cs @@ -0,0 +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; +//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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FlarewingBow.png b/Items/Weapons/FlarewingBow.png new file mode 100644 index 0000000000..7d6aba53c7 Binary files /dev/null and b/Items/Weapons/FlarewingBow.png differ diff --git a/Items/Weapons/FlashBullet.cs b/Items/Weapons/FlashBullet.cs new file mode 100644 index 0000000000..afdd16b6e9 --- /dev/null +++ b/Items/Weapons/FlashBullet.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flash Round"); + Tooltip.SetDefault("Gives off a concussive blast that confuses enemies in a large area for a short time"); + } + + public override void SetDefaults() + { + item.damage = 7; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.15f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("FlashBullet"); + item.shootSpeed = 12f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Glass, 3); + recipe.AddIngredient(ItemID.Grenade); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 10); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FlashBullet.png b/Items/Weapons/FlashBullet.png new file mode 100644 index 0000000000..ab535b10d8 Binary files /dev/null and b/Items/Weapons/FlashBullet.png differ diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs new file mode 100644 index 0000000000..43c6fdaa68 --- /dev/null +++ b/Items/Weapons/Floodtide.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Floodtide.png b/Items/Weapons/Floodtide.png new file mode 100644 index 0000000000..18b0f447c6 Binary files /dev/null and b/Items/Weapons/Floodtide.png differ diff --git a/Items/Weapons/ForbiddenOathblade.cs b/Items/Weapons/ForbiddenOathblade.cs new file mode 100644 index 0000000000..e956e81a12 --- /dev/null +++ b/Items/Weapons/ForbiddenOathblade.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/ForbiddenOathblade.png b/Items/Weapons/ForbiddenOathblade.png new file mode 100644 index 0000000000..605fc208d0 Binary files /dev/null and b/Items/Weapons/ForbiddenOathblade.png differ diff --git a/Items/Weapons/ForbiddenSun.cs b/Items/Weapons/ForbiddenSun.cs new file mode 100644 index 0000000000..bec7236b2e --- /dev/null +++ b/Items/Weapons/ForbiddenSun.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ForbiddenSun.png b/Items/Weapons/ForbiddenSun.png new file mode 100644 index 0000000000..2174bb45df Binary files /dev/null and b/Items/Weapons/ForbiddenSun.png differ diff --git a/Items/Weapons/ForsakenSaber.cs b/Items/Weapons/ForsakenSaber.cs new file mode 100644 index 0000000000..fc4dff1e7d --- /dev/null +++ b/Items/Weapons/ForsakenSaber.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/ForsakenSaber.png b/Items/Weapons/ForsakenSaber.png new file mode 100644 index 0000000000..a657cd2327 Binary files /dev/null and b/Items/Weapons/ForsakenSaber.png differ diff --git a/Items/Weapons/FourSeasonsGalaxia.cs b/Items/Weapons/FourSeasonsGalaxia.cs new file mode 100644 index 0000000000..87310f9d4f --- /dev/null +++ b/Items/Weapons/FourSeasonsGalaxia.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/FourSeasonsGalaxia.png b/Items/Weapons/FourSeasonsGalaxia.png new file mode 100644 index 0000000000..077695f27c Binary files /dev/null and b/Items/Weapons/FourSeasonsGalaxia.png differ diff --git a/Items/Weapons/FrigidflashBolt.cs b/Items/Weapons/FrigidflashBolt.cs new file mode 100644 index 0000000000..b450aecf04 --- /dev/null +++ b/Items/Weapons/FrigidflashBolt.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FrigidflashBolt.png b/Items/Weapons/FrigidflashBolt.png new file mode 100644 index 0000000000..d813f81f41 Binary files /dev/null and b/Items/Weapons/FrigidflashBolt.png differ diff --git a/Items/Weapons/FrostBolt.cs b/Items/Weapons/FrostBolt.cs new file mode 100644 index 0000000000..339fa4544a --- /dev/null +++ b/Items/Weapons/FrostBolt.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FrostBolt.png b/Items/Weapons/FrostBolt.png new file mode 100644 index 0000000000..c9f41df048 Binary files /dev/null and b/Items/Weapons/FrostBolt.png differ diff --git a/Items/Weapons/FrostsparkBullet.cs b/Items/Weapons/FrostsparkBullet.cs new file mode 100644 index 0000000000..1a8a76e091 --- /dev/null +++ b/Items/Weapons/FrostsparkBullet.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frostspark Bullet"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/FrostsparkBullet.png b/Items/Weapons/FrostsparkBullet.png new file mode 100644 index 0000000000..0cda33bf5a Binary files /dev/null and b/Items/Weapons/FrostsparkBullet.png differ diff --git a/Items/Weapons/FulgurationHalberd.cs b/Items/Weapons/FulgurationHalberd.cs new file mode 100644 index 0000000000..38f5d8be7c --- /dev/null +++ b/Items/Weapons/FulgurationHalberd.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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(); + } + } +} diff --git a/Items/Weapons/FulgurationHalberd.png b/Items/Weapons/FulgurationHalberd.png new file mode 100644 index 0000000000..59439fcf1c Binary files /dev/null and b/Items/Weapons/FulgurationHalberd.png differ diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs new file mode 100644 index 0000000000..803ea80168 --- /dev/null +++ b/Items/Weapons/GalacticaBlade.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/GalacticaBlade.png b/Items/Weapons/GalacticaBlade.png new file mode 100644 index 0000000000..e88afdb88e Binary files /dev/null and b/Items/Weapons/GalacticaBlade.png differ diff --git a/Items/Weapons/Galeforce.cs b/Items/Weapons/Galeforce.cs new file mode 100644 index 0000000000..7633b2104c --- /dev/null +++ b/Items/Weapons/Galeforce.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Galeforce.png b/Items/Weapons/Galeforce.png new file mode 100644 index 0000000000..0e46f86739 Binary files /dev/null and b/Items/Weapons/Galeforce.png differ diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs new file mode 100644 index 0000000000..58b6c99892 --- /dev/null +++ b/Items/Weapons/GammaFusillade.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GammaFusillade.png b/Items/Weapons/GammaFusillade.png new file mode 100644 index 0000000000..ddf1e36a85 Binary files /dev/null and b/Items/Weapons/GammaFusillade.png differ diff --git a/Items/Weapons/Genisis.cs b/Items/Weapons/Genisis.cs new file mode 100644 index 0000000000..cbf5ebe122 --- /dev/null +++ b/Items/Weapons/Genisis.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Genisis.png b/Items/Weapons/Genisis.png new file mode 100644 index 0000000000..a7d8fbdcca Binary files /dev/null and b/Items/Weapons/Genisis.png differ diff --git a/Items/Weapons/GleamingMagnolia.cs b/Items/Weapons/GleamingMagnolia.cs new file mode 100644 index 0000000000..a5f3ba3e22 --- /dev/null +++ b/Items/Weapons/GleamingMagnolia.cs @@ -0,0 +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 GleamingMagnolia : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gleaming Magnolia"); + Tooltip.SetDefault("Casts a gleaming bolt that explodes into smaller bolts"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GleamingMagnolia.png b/Items/Weapons/GleamingMagnolia.png new file mode 100644 index 0000000000..5dfff19f86 Binary files /dev/null and b/Items/Weapons/GleamingMagnolia.png differ diff --git a/Items/Weapons/GoldenGun.cs b/Items/Weapons/GoldenGun.cs new file mode 100644 index 0000000000..2fdd0e0ab4 --- /dev/null +++ b/Items/Weapons/GoldenGun.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GoldenGun.png b/Items/Weapons/GoldenGun.png new file mode 100644 index 0000000000..c3fd046f08 Binary files /dev/null and b/Items/Weapons/GoldenGun.png differ diff --git a/Items/Weapons/GoldplumeSpear.cs b/Items/Weapons/GoldplumeSpear.cs new file mode 100644 index 0000000000..2e02c46623 --- /dev/null +++ b/Items/Weapons/GoldplumeSpear.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/GoldplumeSpear.png b/Items/Weapons/GoldplumeSpear.png new file mode 100644 index 0000000000..eeef29cfa1 Binary files /dev/null and b/Items/Weapons/GoldplumeSpear.png differ diff --git a/Items/Weapons/GrandGuardian.cs b/Items/Weapons/GrandGuardian.cs new file mode 100644 index 0000000000..abd2ba96ed --- /dev/null +++ b/Items/Weapons/GrandGuardian.cs @@ -0,0 +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 GrandGuardian : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Guardian"); + Tooltip.SetDefault("Has a chance to lower enemy defense by 30 when striking them\n" + + "If enemy defense is 0 or below your attacks will heal you\n" + + "Striking enemies causes a large explosion\n" + + "Striking enemies that have under half life will make you release rainbow bolts\n" + + "Enemies spawn healing orbs on death"); + } + + public override void SetDefaults() + { + item.width = 124; + item.damage = 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(); + } + } +} diff --git a/Items/Weapons/GrandGuardian.png b/Items/Weapons/GrandGuardian.png new file mode 100644 index 0000000000..4d7d9bdf12 Binary files /dev/null and b/Items/Weapons/GrandGuardian.png differ diff --git a/Items/Weapons/Grax.cs b/Items/Weapons/Grax.cs new file mode 100644 index 0000000000..b7aa4ce874 --- /dev/null +++ b/Items/Weapons/Grax.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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); + } + } +} diff --git a/Items/Weapons/Grax.png b/Items/Weapons/Grax.png new file mode 100644 index 0000000000..1340de82e1 Binary files /dev/null and b/Items/Weapons/Grax.png differ diff --git a/Items/Weapons/GreatSandShark/DuststormInABottle.cs b/Items/Weapons/GreatSandShark/DuststormInABottle.cs new file mode 100644 index 0000000000..15469f4143 --- /dev/null +++ b/Items/Weapons/GreatSandShark/DuststormInABottle.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/DuststormInABottle.png b/Items/Weapons/GreatSandShark/DuststormInABottle.png new file mode 100644 index 0000000000..1e049812e3 Binary files /dev/null and b/Items/Weapons/GreatSandShark/DuststormInABottle.png differ diff --git a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs new file mode 100644 index 0000000000..9c796cf434 --- /dev/null +++ b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GreatSandShark/SandSharknadoStaff.png b/Items/Weapons/GreatSandShark/SandSharknadoStaff.png new file mode 100644 index 0000000000..04b2edf521 Binary files /dev/null and b/Items/Weapons/GreatSandShark/SandSharknadoStaff.png differ diff --git a/Items/Weapons/GreatSandShark/Sandstorm.cs b/Items/Weapons/GreatSandShark/Sandstorm.cs new file mode 100644 index 0000000000..9e5a3e1be5 --- /dev/null +++ b/Items/Weapons/GreatSandShark/Sandstorm.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GreatSandShark/Sandstorm.png b/Items/Weapons/GreatSandShark/Sandstorm.png new file mode 100644 index 0000000000..246cea6570 Binary files /dev/null and b/Items/Weapons/GreatSandShark/Sandstorm.png differ diff --git a/Items/Weapons/GreatSandShark/ShiftingSands.cs b/Items/Weapons/GreatSandShark/ShiftingSands.cs new file mode 100644 index 0000000000..dc3aa95dd0 --- /dev/null +++ b/Items/Weapons/GreatSandShark/ShiftingSands.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/ShiftingSands.png b/Items/Weapons/GreatSandShark/ShiftingSands.png new file mode 100644 index 0000000000..96b9e1287f Binary files /dev/null and b/Items/Weapons/GreatSandShark/ShiftingSands.png differ diff --git a/Items/Weapons/GreatSandShark/Tumbleweed.cs b/Items/Weapons/GreatSandShark/Tumbleweed.cs new file mode 100644 index 0000000000..ed1640ae35 --- /dev/null +++ b/Items/Weapons/GreatSandShark/Tumbleweed.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.GreatSandShark +{ + public class Tumbleweed : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GreatSandShark/Tumbleweed.png b/Items/Weapons/GreatSandShark/Tumbleweed.png new file mode 100644 index 0000000000..8c71e120ee Binary files /dev/null and b/Items/Weapons/GreatSandShark/Tumbleweed.png differ diff --git a/Items/Weapons/GreatbowofTurmoil.cs b/Items/Weapons/GreatbowofTurmoil.cs new file mode 100644 index 0000000000..a9715026bc --- /dev/null +++ b/Items/Weapons/GreatbowofTurmoil.cs @@ -0,0 +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; +//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; + } + 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, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/GreatbowofTurmoil.png b/Items/Weapons/GreatbowofTurmoil.png new file mode 100644 index 0000000000..038bbf3f05 Binary files /dev/null and b/Items/Weapons/GreatbowofTurmoil.png differ diff --git a/Items/Weapons/GreatswordofBlah.cs b/Items/Weapons/GreatswordofBlah.cs new file mode 100644 index 0000000000..106dc71f7b --- /dev/null +++ b/Items/Weapons/GreatswordofBlah.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class GreatswordofBlah : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatsword of Blah"); + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + "You can hear faint yet comforting whispers emanating from the blade\n" + + "'No matter where you may be you are never alone.\n" + + "I shall always be at your side, my lord'"); + } + + public override void SetDefaults() + { + item.width = 110; + item.damage = 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/GreatswordofBlah.png b/Items/Weapons/GreatswordofBlah.png new file mode 100644 index 0000000000..9dbb9c816e Binary files /dev/null and b/Items/Weapons/GreatswordofBlah.png differ diff --git a/Items/Weapons/GreatswordofJudgement.cs b/Items/Weapons/GreatswordofJudgement.cs new file mode 100644 index 0000000000..ea4497f277 --- /dev/null +++ b/Items/Weapons/GreatswordofJudgement.cs @@ -0,0 +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 GreatswordofJudgement : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatsword of Judgement"); + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + "You can hear faint yet comforting whispers emanating from the blade\n" + + "'No matter where you may be you are never alone.\n" + + "I shall always be at your side, my lord'"); + } + + public override void SetDefaults() + { + item.width = 70; + item.damage = 58; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = 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/GreatswordofJudgement.png b/Items/Weapons/GreatswordofJudgement.png new file mode 100644 index 0000000000..8317b0d4c6 Binary files /dev/null and b/Items/Weapons/GreatswordofJudgement.png differ diff --git a/Items/Weapons/HarvestStaff.cs b/Items/Weapons/HarvestStaff.cs new file mode 100644 index 0000000000..ad038beeeb --- /dev/null +++ b/Items/Weapons/HarvestStaff.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class HarvestStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Harvest Staff"); + Tooltip.SetDefault("Casts flaming pumpkins"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HarvestStaff.png b/Items/Weapons/HarvestStaff.png new file mode 100644 index 0000000000..324f7b450e Binary files /dev/null and b/Items/Weapons/HarvestStaff.png differ diff --git a/Items/Weapons/HeartRapier.cs b/Items/Weapons/HeartRapier.cs new file mode 100644 index 0000000000..813c5adaf7 --- /dev/null +++ b/Items/Weapons/HeartRapier.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/HeartRapier.png b/Items/Weapons/HeartRapier.png new file mode 100644 index 0000000000..586badb7a3 Binary files /dev/null and b/Items/Weapons/HeartRapier.png differ diff --git a/Items/Weapons/HeavenlyGale.cs b/Items/Weapons/HeavenlyGale.cs new file mode 100644 index 0000000000..20f9e5fe8a --- /dev/null +++ b/Items/Weapons/HeavenlyGale.cs @@ -0,0 +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 + { + 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" + + "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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HeavenlyGale.png b/Items/Weapons/HeavenlyGale.png new file mode 100644 index 0000000000..2288859de7 Binary files /dev/null and b/Items/Weapons/HeavenlyGale.png differ diff --git a/Items/Weapons/HellBurst.cs b/Items/Weapons/HellBurst.cs new file mode 100644 index 0000000000..dfcfe78094 --- /dev/null +++ b/Items/Weapons/HellBurst.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HellBurst.png b/Items/Weapons/HellBurst.png new file mode 100644 index 0000000000..8bcae5d30e Binary files /dev/null and b/Items/Weapons/HellBurst.png differ diff --git a/Items/Weapons/HellfireFlamberge.cs b/Items/Weapons/HellfireFlamberge.cs new file mode 100644 index 0000000000..cd004fe3aa --- /dev/null +++ b/Items/Weapons/HellfireFlamberge.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/HellfireFlamberge.png b/Items/Weapons/HellfireFlamberge.png new file mode 100644 index 0000000000..fe4144d514 Binary files /dev/null and b/Items/Weapons/HellfireFlamberge.png differ diff --git a/Items/Weapons/HellionFlowerSpear.cs b/Items/Weapons/HellionFlowerSpear.cs new file mode 100644 index 0000000000..ebe2a14606 --- /dev/null +++ b/Items/Weapons/HellionFlowerSpear.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/HellionFlowerSpear.png b/Items/Weapons/HellionFlowerSpear.png new file mode 100644 index 0000000000..325095bd58 Binary files /dev/null and b/Items/Weapons/HellionFlowerSpear.png differ diff --git a/Items/Weapons/Hellkite.cs b/Items/Weapons/Hellkite.cs new file mode 100644 index 0000000000..dadf69ba4d --- /dev/null +++ b/Items/Weapons/Hellkite.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/Hellkite.png b/Items/Weapons/Hellkite.png new file mode 100644 index 0000000000..b034512fcf Binary files /dev/null and b/Items/Weapons/Hellkite.png differ diff --git a/Items/Weapons/HellwingStaff.cs b/Items/Weapons/HellwingStaff.cs new file mode 100644 index 0000000000..13edcf6329 --- /dev/null +++ b/Items/Weapons/HellwingStaff.cs @@ -0,0 +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 HellwingStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellwing Staff"); + Tooltip.SetDefault("Unleashes pillars of flame"); + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HellwingStaff.png b/Items/Weapons/HellwingStaff.png new file mode 100644 index 0000000000..5639180ceb Binary files /dev/null and b/Items/Weapons/HellwingStaff.png differ diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs new file mode 100644 index 0000000000..81f0fe7871 --- /dev/null +++ b/Items/Weapons/Helstorm.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Helstorm.png b/Items/Weapons/Helstorm.png new file mode 100644 index 0000000000..4ef6056eba Binary files /dev/null and b/Items/Weapons/Helstorm.png differ diff --git a/Items/Weapons/HiveMind/DankStaff.cs b/Items/Weapons/HiveMind/DankStaff.cs new file mode 100644 index 0000000000..8b5dc24d40 --- /dev/null +++ b/Items/Weapons/HiveMind/DankStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HiveMind/DankStaff.png b/Items/Weapons/HiveMind/DankStaff.png new file mode 100644 index 0000000000..086a3ab2df Binary files /dev/null and b/Items/Weapons/HiveMind/DankStaff.png differ diff --git a/Items/Weapons/HiveMind/LeechingDagger.cs b/Items/Weapons/HiveMind/LeechingDagger.cs new file mode 100644 index 0000000000..200981e889 --- /dev/null +++ b/Items/Weapons/HiveMind/LeechingDagger.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } +} diff --git a/Items/Weapons/HiveMind/LeechingDagger.png b/Items/Weapons/HiveMind/LeechingDagger.png new file mode 100644 index 0000000000..acad0f3cec Binary files /dev/null and b/Items/Weapons/HiveMind/LeechingDagger.png differ diff --git a/Items/Weapons/HiveMind/PerfectDark.cs b/Items/Weapons/HiveMind/PerfectDark.cs new file mode 100644 index 0000000000..57ce204c04 --- /dev/null +++ b/Items/Weapons/HiveMind/PerfectDark.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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(); + } + } +} diff --git a/Items/Weapons/HiveMind/PerfectDark.png b/Items/Weapons/HiveMind/PerfectDark.png new file mode 100644 index 0000000000..8070b4a6cc Binary files /dev/null and b/Items/Weapons/HiveMind/PerfectDark.png differ diff --git a/Items/Weapons/HiveMind/RotBall.cs b/Items/Weapons/HiveMind/RotBall.cs new file mode 100644 index 0000000000..1bc63548e0 --- /dev/null +++ b/Items/Weapons/HiveMind/RotBall.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/HiveMind/RotBall.png b/Items/Weapons/HiveMind/RotBall.png new file mode 100644 index 0000000000..d8ca1fc108 Binary files /dev/null and b/Items/Weapons/HiveMind/RotBall.png differ diff --git a/Items/Weapons/HiveMind/ShaderainStaff.cs b/Items/Weapons/HiveMind/ShaderainStaff.cs new file mode 100644 index 0000000000..62ab1d0e70 --- /dev/null +++ b/Items/Weapons/HiveMind/ShaderainStaff.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HiveMind/ShaderainStaff.png b/Items/Weapons/HiveMind/ShaderainStaff.png new file mode 100644 index 0000000000..6ea89566de Binary files /dev/null and b/Items/Weapons/HiveMind/ShaderainStaff.png differ diff --git a/Items/Weapons/HiveMind/Shadethrower.cs b/Items/Weapons/HiveMind/Shadethrower.cs new file mode 100644 index 0000000000..37a5948c9f --- /dev/null +++ b/Items/Weapons/HiveMind/Shadethrower.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HiveMind/Shadethrower.png b/Items/Weapons/HiveMind/Shadethrower.png new file mode 100644 index 0000000000..f9830b1a33 Binary files /dev/null and b/Items/Weapons/HiveMind/Shadethrower.png differ diff --git a/Items/Weapons/HiveMind/ShadowdropStaff.cs b/Items/Weapons/HiveMind/ShadowdropStaff.cs new file mode 100644 index 0000000000..9526681ba0 --- /dev/null +++ b/Items/Weapons/HiveMind/ShadowdropStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HiveMind/ShadowdropStaff.png b/Items/Weapons/HiveMind/ShadowdropStaff.png new file mode 100644 index 0000000000..0a8c7958ec Binary files /dev/null and b/Items/Weapons/HiveMind/ShadowdropStaff.png differ diff --git a/Items/Weapons/HolidayHalberd.cs b/Items/Weapons/HolidayHalberd.cs new file mode 100644 index 0000000000..3517586991 --- /dev/null +++ b/Items/Weapons/HolidayHalberd.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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; + } + } +} diff --git a/Items/Weapons/HolidayHalberd.png b/Items/Weapons/HolidayHalberd.png new file mode 100644 index 0000000000..ec611738c4 Binary files /dev/null and b/Items/Weapons/HolidayHalberd.png differ diff --git a/Items/Weapons/HolyFireBullet.cs b/Items/Weapons/HolyFireBullet.cs new file mode 100644 index 0000000000..af87ee4281 --- /dev/null +++ b/Items/Weapons/HolyFireBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HolyFireBullet.png b/Items/Weapons/HolyFireBullet.png new file mode 100644 index 0000000000..8b5d628085 Binary files /dev/null and b/Items/Weapons/HolyFireBullet.png differ diff --git a/Items/Weapons/HyperiusBullet.cs b/Items/Weapons/HyperiusBullet.cs new file mode 100644 index 0000000000..9c5794585f --- /dev/null +++ b/Items/Weapons/HyperiusBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/HyperiusBullet.png b/Items/Weapons/HyperiusBullet.png new file mode 100644 index 0000000000..10362f6c99 Binary files /dev/null and b/Items/Weapons/HyperiusBullet.png differ diff --git a/Items/Weapons/IchorSpear.cs b/Items/Weapons/IchorSpear.cs new file mode 100644 index 0000000000..b8d77100a1 --- /dev/null +++ b/Items/Weapons/IchorSpear.cs @@ -0,0 +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 + { + 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; + } + } +} diff --git a/Items/Weapons/IchorSpear.png b/Items/Weapons/IchorSpear.png new file mode 100644 index 0000000000..6c8e3be05f Binary files /dev/null and b/Items/Weapons/IchorSpear.png differ diff --git a/Items/Weapons/IcicleStaff.cs b/Items/Weapons/IcicleStaff.cs new file mode 100644 index 0000000000..cbef8bf366 --- /dev/null +++ b/Items/Weapons/IcicleStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/IcicleStaff.png b/Items/Weapons/IcicleStaff.png new file mode 100644 index 0000000000..30f3999968 Binary files /dev/null and b/Items/Weapons/IcicleStaff.png differ diff --git a/Items/Weapons/Impaler.cs b/Items/Weapons/Impaler.cs new file mode 100644 index 0000000000..b0a34eea57 --- /dev/null +++ b/Items/Weapons/Impaler.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Impaler.png b/Items/Weapons/Impaler.png new file mode 100644 index 0000000000..b3b76b309a Binary files /dev/null and b/Items/Weapons/Impaler.png differ diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs new file mode 100644 index 0000000000..eb41bba3ef --- /dev/null +++ b/Items/Weapons/InfernaCutter.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/InfernaCutter.png b/Items/Weapons/InfernaCutter.png new file mode 100644 index 0000000000..668df7465d Binary files /dev/null and b/Items/Weapons/InfernaCutter.png differ diff --git a/Items/Weapons/InfernalRift.cs b/Items/Weapons/InfernalRift.cs new file mode 100644 index 0000000000..f236505471 --- /dev/null +++ b/Items/Weapons/InfernalRift.cs @@ -0,0 +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 InfernalRift : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Rift"); + Tooltip.SetDefault("Summons infernal blades"); + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/InfernalRift.png b/Items/Weapons/InfernalRift.png new file mode 100644 index 0000000000..4ca112b75d Binary files /dev/null and b/Items/Weapons/InfernalRift.png differ diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs new file mode 100644 index 0000000000..2abbee0a8e --- /dev/null +++ b/Items/Weapons/Interfacer.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Interfacer.png b/Items/Weapons/Interfacer.png new file mode 100644 index 0000000000..2c008f984f Binary files /dev/null and b/Items/Weapons/Interfacer.png differ diff --git a/Items/Weapons/IonBlaster.cs b/Items/Weapons/IonBlaster.cs new file mode 100644 index 0000000000..e58043a345 --- /dev/null +++ b/Items/Weapons/IonBlaster.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/IonBlaster.png b/Items/Weapons/IonBlaster.png new file mode 100644 index 0000000000..fc9e66e340 Binary files /dev/null and b/Items/Weapons/IonBlaster.png differ diff --git a/Items/Weapons/Judgement.cs b/Items/Weapons/Judgement.cs new file mode 100644 index 0000000000..40bd82749e --- /dev/null +++ b/Items/Weapons/Judgement.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Judgement.png b/Items/Weapons/Judgement.png new file mode 100644 index 0000000000..e0678d8cc0 Binary files /dev/null and b/Items/Weapons/Judgement.png differ diff --git a/Items/Weapons/Lacerator.cs b/Items/Weapons/Lacerator.cs new file mode 100644 index 0000000000..01da50ef30 --- /dev/null +++ b/Items/Weapons/Lacerator.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Lacerator.png b/Items/Weapons/Lacerator.png new file mode 100644 index 0000000000..849cca255f Binary files /dev/null and b/Items/Weapons/Lacerator.png differ diff --git a/Items/Weapons/Lazhar.cs b/Items/Weapons/Lazhar.cs new file mode 100644 index 0000000000..6f925966d0 --- /dev/null +++ b/Items/Weapons/Lazhar.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Lazhar.png b/Items/Weapons/Lazhar.png new file mode 100644 index 0000000000..d250d2920e Binary files /dev/null and b/Items/Weapons/Lazhar.png differ diff --git a/Items/Weapons/Leviathan/Atlantis.cs b/Items/Weapons/Leviathan/Atlantis.cs new file mode 100644 index 0000000000..1fc366c47b --- /dev/null +++ b/Items/Weapons/Leviathan/Atlantis.cs @@ -0,0 +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"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Leviathan/Atlantis.png b/Items/Weapons/Leviathan/Atlantis.png new file mode 100644 index 0000000000..1ef12fd080 Binary files /dev/null and b/Items/Weapons/Leviathan/Atlantis.png differ diff --git a/Items/Weapons/Leviathan/BrackishFlask.cs b/Items/Weapons/Leviathan/BrackishFlask.cs new file mode 100644 index 0000000000..b87dab9e43 --- /dev/null +++ b/Items/Weapons/Leviathan/BrackishFlask.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/Leviathan/BrackishFlask.png b/Items/Weapons/Leviathan/BrackishFlask.png new file mode 100644 index 0000000000..c0101e465c Binary files /dev/null and b/Items/Weapons/Leviathan/BrackishFlask.png differ diff --git a/Items/Weapons/Leviathan/Greentide.cs b/Items/Weapons/Leviathan/Greentide.cs new file mode 100644 index 0000000000..8edf9ba0a6 --- /dev/null +++ b/Items/Weapons/Leviathan/Greentide.cs @@ -0,0 +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.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); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Leviathan/Greentide.png b/Items/Weapons/Leviathan/Greentide.png new file mode 100644 index 0000000000..a3af9daf60 Binary files /dev/null and b/Items/Weapons/Leviathan/Greentide.png differ diff --git a/Items/Weapons/Leviathan/Leviatitan.cs b/Items/Weapons/Leviathan/Leviatitan.cs new file mode 100644 index 0000000000..78c1f0df80 --- /dev/null +++ b/Items/Weapons/Leviathan/Leviatitan.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Leviathan/Leviatitan.png b/Items/Weapons/Leviathan/Leviatitan.png new file mode 100644 index 0000000000..89fe64b156 Binary files /dev/null and b/Items/Weapons/Leviathan/Leviatitan.png differ diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.cs b/Items/Weapons/Leviathan/LureofEnthrallment.cs new file mode 100644 index 0000000000..50025e5abc --- /dev/null +++ b/Items/Weapons/Leviathan/LureofEnthrallment.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.png b/Items/Weapons/Leviathan/LureofEnthrallment.png new file mode 100644 index 0000000000..91eb37c1de Binary files /dev/null and b/Items/Weapons/Leviathan/LureofEnthrallment.png differ diff --git a/Items/Weapons/Leviathan/SirensSong.cs b/Items/Weapons/Leviathan/SirensSong.cs new file mode 100644 index 0000000000..2809fd24c8 --- /dev/null +++ b/Items/Weapons/Leviathan/SirensSong.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Leviathan/SirensSong.png b/Items/Weapons/Leviathan/SirensSong.png new file mode 100644 index 0000000000..5c53c88263 Binary files /dev/null and b/Items/Weapons/Leviathan/SirensSong.png differ diff --git a/Items/Weapons/LifefruitScythe.cs b/Items/Weapons/LifefruitScythe.cs new file mode 100644 index 0000000000..5dfbbd6923 --- /dev/null +++ b/Items/Weapons/LifefruitScythe.cs @@ -0,0 +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 + { + 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); + } + } +} diff --git a/Items/Weapons/LifefruitScythe.png b/Items/Weapons/LifefruitScythe.png new file mode 100644 index 0000000000..0bd1c8432b Binary files /dev/null and b/Items/Weapons/LifefruitScythe.png differ diff --git a/Items/Weapons/Lucrecia.cs b/Items/Weapons/Lucrecia.cs new file mode 100644 index 0000000000..431f88c97c --- /dev/null +++ b/Items/Weapons/Lucrecia.cs @@ -0,0 +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 + { + 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; + } + } + } +} diff --git a/Items/Weapons/Lucrecia.png b/Items/Weapons/Lucrecia.png new file mode 100644 index 0000000000..ed64e31beb Binary files /dev/null and b/Items/Weapons/Lucrecia.png differ diff --git a/Items/Weapons/LunarianBow.cs b/Items/Weapons/LunarianBow.cs new file mode 100644 index 0000000000..5e846bdc94 --- /dev/null +++ b/Items/Weapons/LunarianBow.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/LunarianBow.png b/Items/Weapons/LunarianBow.png new file mode 100644 index 0000000000..e5a7e3b499 Binary files /dev/null and b/Items/Weapons/LunarianBow.png differ diff --git a/Items/Weapons/LunicEye.cs b/Items/Weapons/LunicEye.cs new file mode 100644 index 0000000000..80f5be9e26 --- /dev/null +++ b/Items/Weapons/LunicEye.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/LunicEye.png b/Items/Weapons/LunicEye.png new file mode 100644 index 0000000000..f80d56e5f0 Binary files /dev/null and b/Items/Weapons/LunicEye.png differ diff --git a/Items/Weapons/MagnaCannon.cs b/Items/Weapons/MagnaCannon.cs new file mode 100644 index 0000000000..c831703e45 --- /dev/null +++ b/Items/Weapons/MagnaCannon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MagnaCannon.png b/Items/Weapons/MagnaCannon.png new file mode 100644 index 0000000000..16ff1da64a Binary files /dev/null and b/Items/Weapons/MagnaCannon.png differ diff --git a/Items/Weapons/MagnaStriker.cs b/Items/Weapons/MagnaStriker.cs new file mode 100644 index 0000000000..8ecedb050f --- /dev/null +++ b/Items/Weapons/MagnaStriker.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MagnaStriker.png b/Items/Weapons/MagnaStriker.png new file mode 100644 index 0000000000..eaf3c35ea1 Binary files /dev/null and b/Items/Weapons/MagnaStriker.png differ diff --git a/Items/Weapons/MagneticMeltdown.cs b/Items/Weapons/MagneticMeltdown.cs new file mode 100644 index 0000000000..cec8758ad4 --- /dev/null +++ b/Items/Weapons/MagneticMeltdown.cs @@ -0,0 +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 MagneticMeltdown : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnetic Meltdown"); + Tooltip.SetDefault("Fires a spread of magnetic orbs"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MagneticMeltdown.png b/Items/Weapons/MagneticMeltdown.png new file mode 100644 index 0000000000..713d255ead Binary files /dev/null and b/Items/Weapons/MagneticMeltdown.png differ diff --git a/Items/Weapons/MajesticGuard.cs b/Items/Weapons/MajesticGuard.cs new file mode 100644 index 0000000000..85fe8c4b01 --- /dev/null +++ b/Items/Weapons/MajesticGuard.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/MajesticGuard.png b/Items/Weapons/MajesticGuard.png new file mode 100644 index 0000000000..2773c1526f Binary files /dev/null and b/Items/Weapons/MajesticGuard.png differ diff --git a/Items/Weapons/Malachite.cs b/Items/Weapons/Malachite.cs new file mode 100644 index 0000000000..e4ce681c91 --- /dev/null +++ b/Items/Weapons/Malachite.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + 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" + + "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; + } + } + } +} diff --git a/Items/Weapons/Malachite.png b/Items/Weapons/Malachite.png new file mode 100644 index 0000000000..fcd0137dba Binary files /dev/null and b/Items/Weapons/Malachite.png differ diff --git a/Items/Weapons/ManaRose.cs b/Items/Weapons/ManaRose.cs new file mode 100644 index 0000000000..3eb3b9b7e9 --- /dev/null +++ b/Items/Weapons/ManaRose.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class ManaRose : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Rose"); + Tooltip.SetDefault("Casts a mana bolt that explodes into smaller bolts"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ManaRose.png b/Items/Weapons/ManaRose.png new file mode 100644 index 0000000000..22d915cb2e Binary files /dev/null and b/Items/Weapons/ManaRose.png differ diff --git a/Items/Weapons/MandibleBow.cs b/Items/Weapons/MandibleBow.cs new file mode 100644 index 0000000000..99fdc51499 --- /dev/null +++ b/Items/Weapons/MandibleBow.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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"); + }*/ + } +} \ No newline at end of file diff --git a/Items/Weapons/MandibleBow.png b/Items/Weapons/MandibleBow.png new file mode 100644 index 0000000000..6f817a210c Binary files /dev/null and b/Items/Weapons/MandibleBow.png differ diff --git a/Items/Weapons/MandibleClaws.cs b/Items/Weapons/MandibleClaws.cs new file mode 100644 index 0000000000..45851dab64 --- /dev/null +++ b/Items/Weapons/MandibleClaws.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} diff --git a/Items/Weapons/MandibleClaws.png b/Items/Weapons/MandibleClaws.png new file mode 100644 index 0000000000..f860016731 Binary files /dev/null and b/Items/Weapons/MandibleClaws.png differ diff --git a/Items/Weapons/MangroveChakram.cs b/Items/Weapons/MangroveChakram.cs new file mode 100644 index 0000000000..0d59177b3e --- /dev/null +++ b/Items/Weapons/MangroveChakram.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/MangroveChakram.png b/Items/Weapons/MangroveChakram.png new file mode 100644 index 0000000000..aad8e4a516 Binary files /dev/null and b/Items/Weapons/MangroveChakram.png differ diff --git a/Items/Weapons/MangroveChakramMelee.cs b/Items/Weapons/MangroveChakramMelee.cs new file mode 100644 index 0000000000..b524593fea --- /dev/null +++ b/Items/Weapons/MangroveChakramMelee.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/MangroveChakramMelee.png b/Items/Weapons/MangroveChakramMelee.png new file mode 100644 index 0000000000..aad8e4a516 Binary files /dev/null and b/Items/Weapons/MangroveChakramMelee.png differ diff --git a/Items/Weapons/MantisClaws.cs b/Items/Weapons/MantisClaws.cs new file mode 100644 index 0000000000..d41d30dc71 --- /dev/null +++ b/Items/Weapons/MantisClaws.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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); + } + } +} diff --git a/Items/Weapons/MantisClaws.png b/Items/Weapons/MantisClaws.png new file mode 100644 index 0000000000..80afecc3b9 Binary files /dev/null and b/Items/Weapons/MantisClaws.png differ diff --git a/Items/Weapons/Mariana.cs b/Items/Weapons/Mariana.cs new file mode 100644 index 0000000000..cd21077e10 --- /dev/null +++ b/Items/Weapons/Mariana.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/Mariana.png b/Items/Weapons/Mariana.png new file mode 100644 index 0000000000..c8fbe8524b Binary files /dev/null and b/Items/Weapons/Mariana.png differ diff --git a/Items/Weapons/MarkedMagnum.cs b/Items/Weapons/MarkedMagnum.cs new file mode 100644 index 0000000000..80aa8e85a4 --- /dev/null +++ b/Items/Weapons/MarkedMagnum.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MarkedMagnum.png b/Items/Weapons/MarkedMagnum.png new file mode 100644 index 0000000000..ee838bbb1c Binary files /dev/null and b/Items/Weapons/MarkedMagnum.png differ diff --git a/Items/Weapons/MarniteRifleSpear.cs b/Items/Weapons/MarniteRifleSpear.cs new file mode 100644 index 0000000000..347435bb58 --- /dev/null +++ b/Items/Weapons/MarniteRifleSpear.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MarniteRifleSpear.png b/Items/Weapons/MarniteRifleSpear.png new file mode 100644 index 0000000000..dd61dc9c92 Binary files /dev/null and b/Items/Weapons/MarniteRifleSpear.png differ diff --git a/Items/Weapons/MarniteSpear.cs b/Items/Weapons/MarniteSpear.cs new file mode 100644 index 0000000000..d374d7cb8f --- /dev/null +++ b/Items/Weapons/MarniteSpear.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/MarniteSpear.png b/Items/Weapons/MarniteSpear.png new file mode 100644 index 0000000000..8315e86d45 Binary files /dev/null and b/Items/Weapons/MarniteSpear.png differ diff --git a/Items/Weapons/Megafleet.cs b/Items/Weapons/Megafleet.cs new file mode 100644 index 0000000000..18484d6f1e --- /dev/null +++ b/Items/Weapons/Megafleet.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Megafleet.png b/Items/Weapons/Megafleet.png new file mode 100644 index 0000000000..34fbdc1c95 Binary files /dev/null and b/Items/Weapons/Megafleet.png differ diff --git a/Items/Weapons/Megalodon.cs b/Items/Weapons/Megalodon.cs new file mode 100644 index 0000000000..ff255327e9 --- /dev/null +++ b/Items/Weapons/Megalodon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Megalodon.png b/Items/Weapons/Megalodon.png new file mode 100644 index 0000000000..483e468810 Binary files /dev/null and b/Items/Weapons/Megalodon.png differ diff --git a/Items/Weapons/Meowthrower.cs b/Items/Weapons/Meowthrower.cs new file mode 100644 index 0000000000..cbd22fcda1 --- /dev/null +++ b/Items/Weapons/Meowthrower.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Meowthrower.png b/Items/Weapons/Meowthrower.png new file mode 100644 index 0000000000..d76908c34e Binary files /dev/null and b/Items/Weapons/Meowthrower.png differ diff --git a/Items/Weapons/MeteorFist.cs b/Items/Weapons/MeteorFist.cs new file mode 100644 index 0000000000..2f6115d852 --- /dev/null +++ b/Items/Weapons/MeteorFist.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/MeteorFist.png b/Items/Weapons/MeteorFist.png new file mode 100644 index 0000000000..951f8ef858 Binary files /dev/null and b/Items/Weapons/MeteorFist.png differ diff --git a/Items/Weapons/MineralMortar.cs b/Items/Weapons/MineralMortar.cs new file mode 100644 index 0000000000..f24b5b3b43 --- /dev/null +++ b/Items/Weapons/MineralMortar.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MineralMortar.png b/Items/Weapons/MineralMortar.png new file mode 100644 index 0000000000..acb111dcea Binary files /dev/null and b/Items/Weapons/MineralMortar.png differ diff --git a/Items/Weapons/Minigun.cs b/Items/Weapons/Minigun.cs new file mode 100644 index 0000000000..bde9837e0e --- /dev/null +++ b/Items/Weapons/Minigun.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Minigun.png b/Items/Weapons/Minigun.png new file mode 100644 index 0000000000..e8b742b354 Binary files /dev/null and b/Items/Weapons/Minigun.png differ diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs new file mode 100644 index 0000000000..95a3eb7f85 --- /dev/null +++ b/Items/Weapons/MirrorBlade.cs @@ -0,0 +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 + { + 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; + } + } +} diff --git a/Items/Weapons/MirrorBlade.png b/Items/Weapons/MirrorBlade.png new file mode 100644 index 0000000000..27bfa9882f Binary files /dev/null and b/Items/Weapons/MirrorBlade.png differ diff --git a/Items/Weapons/Mistlestorm.cs b/Items/Weapons/Mistlestorm.cs new file mode 100644 index 0000000000..1eacd74f2f --- /dev/null +++ b/Items/Weapons/Mistlestorm.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Mistlestorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mistlestorm"); + Tooltip.SetDefault("Casts a storm of pine needles and leaves"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Mistlestorm.png b/Items/Weapons/Mistlestorm.png new file mode 100644 index 0000000000..d289a60730 Binary files /dev/null and b/Items/Weapons/Mistlestorm.png differ diff --git a/Items/Weapons/MolecularManipulator.cs b/Items/Weapons/MolecularManipulator.cs new file mode 100644 index 0000000000..c1eab97446 --- /dev/null +++ b/Items/Weapons/MolecularManipulator.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MolecularManipulator.png b/Items/Weapons/MolecularManipulator.png new file mode 100644 index 0000000000..a13a3964d4 Binary files /dev/null and b/Items/Weapons/MolecularManipulator.png differ diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs new file mode 100644 index 0000000000..02fa3189c9 --- /dev/null +++ b/Items/Weapons/Monsoon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Monsoon.png b/Items/Weapons/Monsoon.png new file mode 100644 index 0000000000..d2b3323594 Binary files /dev/null and b/Items/Weapons/Monsoon.png differ diff --git a/Items/Weapons/MortarRound.cs b/Items/Weapons/MortarRound.cs new file mode 100644 index 0000000000..eabb25ff9f --- /dev/null +++ b/Items/Weapons/MortarRound.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/MortarRound.png b/Items/Weapons/MortarRound.png new file mode 100644 index 0000000000..37ef5e341c Binary files /dev/null and b/Items/Weapons/MortarRound.png differ diff --git a/Items/Weapons/Mourningstar.cs b/Items/Weapons/Mourningstar.cs new file mode 100644 index 0000000000..8cbad32f4f --- /dev/null +++ b/Items/Weapons/Mourningstar.cs @@ -0,0 +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 + { + 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; + } + } +} diff --git a/Items/Weapons/Mourningstar.png b/Items/Weapons/Mourningstar.png new file mode 100644 index 0000000000..e3e0be42ce Binary files /dev/null and b/Items/Weapons/Mourningstar.png differ diff --git a/Items/Weapons/Murasama.cs b/Items/Weapons/Murasama.cs new file mode 100644 index 0000000000..c4f6950cdd --- /dev/null +++ b/Items/Weapons/Murasama.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Murasama : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murasama"); + 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; + } + } + } +} diff --git a/Items/Weapons/Murasama.png b/Items/Weapons/Murasama.png new file mode 100644 index 0000000000..d0a4b3f1dd Binary files /dev/null and b/Items/Weapons/Murasama.png differ diff --git a/Items/Weapons/MythrilKnife.cs b/Items/Weapons/MythrilKnife.cs new file mode 100644 index 0000000000..085f6beba9 --- /dev/null +++ b/Items/Weapons/MythrilKnife.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/MythrilKnife.png b/Items/Weapons/MythrilKnife.png new file mode 100644 index 0000000000..8ff7d5aede Binary files /dev/null and b/Items/Weapons/MythrilKnife.png differ diff --git a/Items/Weapons/NapalmArrow.cs b/Items/Weapons/NapalmArrow.cs new file mode 100644 index 0000000000..12388f7c1d --- /dev/null +++ b/Items/Weapons/NapalmArrow.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Napalm Arrow"); + Tooltip.SetDefault("Explodes into fire shards"); + } + + public override void SetDefaults() + { + item.damage = 13; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("NapalmArrow"); + item.shootSpeed = 13f; + item.ammo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(ItemID.WoodenArrow, 250); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/NapalmArrow.png b/Items/Weapons/NapalmArrow.png new file mode 100644 index 0000000000..254f05c605 Binary files /dev/null and b/Items/Weapons/NapalmArrow.png differ diff --git a/Items/Weapons/Needler.cs b/Items/Weapons/Needler.cs new file mode 100644 index 0000000000..16ee628dd3 --- /dev/null +++ b/Items/Weapons/Needler.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Needler.png b/Items/Weapons/Needler.png new file mode 100644 index 0000000000..5ae90b6cb2 Binary files /dev/null and b/Items/Weapons/Needler.png differ diff --git a/Items/Weapons/NeptunesBounty.cs b/Items/Weapons/NeptunesBounty.cs new file mode 100644 index 0000000000..db2c7c2394 --- /dev/null +++ b/Items/Weapons/NeptunesBounty.cs @@ -0,0 +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 + { + 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"); + } + + 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/NeptunesBounty.png b/Items/Weapons/NeptunesBounty.png new file mode 100644 index 0000000000..a2539b2a37 Binary files /dev/null and b/Items/Weapons/NeptunesBounty.png differ diff --git a/Items/Weapons/NettlelineGreatbow.cs b/Items/Weapons/NettlelineGreatbow.cs new file mode 100644 index 0000000000..399801c39b --- /dev/null +++ b/Items/Weapons/NettlelineGreatbow.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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; + } + 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", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/NettlelineGreatbow.png b/Items/Weapons/NettlelineGreatbow.png new file mode 100644 index 0000000000..7954f9c8d3 Binary files /dev/null and b/Items/Weapons/NettlelineGreatbow.png differ diff --git a/Items/Weapons/NightsRay.cs b/Items/Weapons/NightsRay.cs new file mode 100644 index 0000000000..dc49d6bb54 --- /dev/null +++ b/Items/Weapons/NightsRay.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/NightsRay.png b/Items/Weapons/NightsRay.png new file mode 100644 index 0000000000..e403bcd1bb Binary files /dev/null and b/Items/Weapons/NightsRay.png differ diff --git a/Items/Weapons/NightsStabber.cs b/Items/Weapons/NightsStabber.cs new file mode 100644 index 0000000000..e3eeaea4f6 --- /dev/null +++ b/Items/Weapons/NightsStabber.cs @@ -0,0 +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 + { + 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); + } + } + } + } +} diff --git a/Items/Weapons/NightsStabber.png b/Items/Weapons/NightsStabber.png new file mode 100644 index 0000000000..194726f41c Binary files /dev/null and b/Items/Weapons/NightsStabber.png differ diff --git a/Items/Weapons/NuclearFury.cs b/Items/Weapons/NuclearFury.cs new file mode 100644 index 0000000000..65a83526fa --- /dev/null +++ b/Items/Weapons/NuclearFury.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/NuclearFury.png b/Items/Weapons/NuclearFury.png new file mode 100644 index 0000000000..4d27ba75b8 Binary files /dev/null and b/Items/Weapons/NuclearFury.png differ diff --git a/Items/Weapons/NullificationRifle.cs b/Items/Weapons/NullificationRifle.cs new file mode 100644 index 0000000000..08502ead1b --- /dev/null +++ b/Items/Weapons/NullificationRifle.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/NullificationRifle.png b/Items/Weapons/NullificationRifle.png new file mode 100644 index 0000000000..dd2b683b9d Binary files /dev/null and b/Items/Weapons/NullificationRifle.png differ diff --git a/Items/Weapons/OldLordOathsword.cs b/Items/Weapons/OldLordOathsword.cs new file mode 100644 index 0000000000..b3bde92cd5 --- /dev/null +++ b/Items/Weapons/OldLordOathsword.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} diff --git a/Items/Weapons/OldLordOathsword.png b/Items/Weapons/OldLordOathsword.png new file mode 100644 index 0000000000..178a8f1f06 Binary files /dev/null and b/Items/Weapons/OldLordOathsword.png differ diff --git a/Items/Weapons/OmegaBiomeBlade.cs b/Items/Weapons/OmegaBiomeBlade.cs new file mode 100644 index 0000000000..c986e5eba3 --- /dev/null +++ b/Items/Weapons/OmegaBiomeBlade.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/OmegaBiomeBlade.png b/Items/Weapons/OmegaBiomeBlade.png new file mode 100644 index 0000000000..dabdb0737f Binary files /dev/null and b/Items/Weapons/OmegaBiomeBlade.png differ diff --git a/Items/Weapons/Omniblade.cs b/Items/Weapons/Omniblade.cs new file mode 100644 index 0000000000..952b466b00 --- /dev/null +++ b/Items/Weapons/Omniblade.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Omniblade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omniblade"); + Tooltip.SetDefault("An ancient blade forged by the legendary Omnir\n" + + "Has a 20% chance to give enemies the whispering death debuff on hit\n" + + "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(); + } + } +} diff --git a/Items/Weapons/Omniblade.png b/Items/Weapons/Omniblade.png new file mode 100644 index 0000000000..61e71568dc Binary files /dev/null and b/Items/Weapons/Omniblade.png differ diff --git a/Items/Weapons/OnyxChainBlaster.cs b/Items/Weapons/OnyxChainBlaster.cs new file mode 100644 index 0000000000..aab4122a64 --- /dev/null +++ b/Items/Weapons/OnyxChainBlaster.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/OnyxChainBlaster.png b/Items/Weapons/OnyxChainBlaster.png new file mode 100644 index 0000000000..ac11d5df28 Binary files /dev/null and b/Items/Weapons/OnyxChainBlaster.png differ diff --git a/Items/Weapons/OpalStriker.cs b/Items/Weapons/OpalStriker.cs new file mode 100644 index 0000000000..45738807f1 --- /dev/null +++ b/Items/Weapons/OpalStriker.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/OpalStriker.png b/Items/Weapons/OpalStriker.png new file mode 100644 index 0000000000..72da079908 Binary files /dev/null and b/Items/Weapons/OpalStriker.png differ diff --git a/Items/Weapons/OrichalcumSpikedGemstone.cs b/Items/Weapons/OrichalcumSpikedGemstone.cs new file mode 100644 index 0000000000..eebf4ce227 --- /dev/null +++ b/Items/Weapons/OrichalcumSpikedGemstone.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/OrichalcumSpikedGemstone.png b/Items/Weapons/OrichalcumSpikedGemstone.png new file mode 100644 index 0000000000..7f94126948 Binary files /dev/null and b/Items/Weapons/OrichalcumSpikedGemstone.png differ diff --git a/Items/Weapons/P90.cs b/Items/Weapons/P90.cs new file mode 100644 index 0000000000..def4cc21e4 --- /dev/null +++ b/Items/Weapons/P90.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/P90.png b/Items/Weapons/P90.png new file mode 100644 index 0000000000..0d799d8343 Binary files /dev/null and b/Items/Weapons/P90.png differ diff --git a/Items/Weapons/PaintballBlaster.cs b/Items/Weapons/PaintballBlaster.cs new file mode 100644 index 0000000000..8dc7df9219 --- /dev/null +++ b/Items/Weapons/PaintballBlaster.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PaintballBlaster.png b/Items/Weapons/PaintballBlaster.png new file mode 100644 index 0000000000..df74da69d0 Binary files /dev/null and b/Items/Weapons/PaintballBlaster.png differ diff --git a/Items/Weapons/PalladiumJavelin.cs b/Items/Weapons/PalladiumJavelin.cs new file mode 100644 index 0000000000..2e4c862a06 --- /dev/null +++ b/Items/Weapons/PalladiumJavelin.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/PalladiumJavelin.png b/Items/Weapons/PalladiumJavelin.png new file mode 100644 index 0000000000..6d94f8c580 Binary files /dev/null and b/Items/Weapons/PalladiumJavelin.png differ diff --git a/Items/Weapons/Perforators/Aorta.cs b/Items/Weapons/Perforators/Aorta.cs new file mode 100644 index 0000000000..ac95591322 --- /dev/null +++ b/Items/Weapons/Perforators/Aorta.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Perforators/Aorta.png b/Items/Weapons/Perforators/Aorta.png new file mode 100644 index 0000000000..f7ced9830f Binary files /dev/null and b/Items/Weapons/Perforators/Aorta.png differ diff --git a/Items/Weapons/Perforators/BloodBath.cs b/Items/Weapons/Perforators/BloodBath.cs new file mode 100644 index 0000000000..2257b4cfee --- /dev/null +++ b/Items/Weapons/Perforators/BloodBath.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Perforators/BloodBath.png b/Items/Weapons/Perforators/BloodBath.png new file mode 100644 index 0000000000..07b448ed11 Binary files /dev/null and b/Items/Weapons/Perforators/BloodBath.png differ diff --git a/Items/Weapons/Perforators/BloodClotStaff.cs b/Items/Weapons/Perforators/BloodClotStaff.cs new file mode 100644 index 0000000000..84f3bc0388 --- /dev/null +++ b/Items/Weapons/Perforators/BloodClotStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Perforators/BloodClotStaff.png b/Items/Weapons/Perforators/BloodClotStaff.png new file mode 100644 index 0000000000..8951c39fb4 Binary files /dev/null and b/Items/Weapons/Perforators/BloodClotStaff.png differ diff --git a/Items/Weapons/Perforators/BloodyRupture.cs b/Items/Weapons/Perforators/BloodyRupture.cs new file mode 100644 index 0000000000..9ef0588d29 --- /dev/null +++ b/Items/Weapons/Perforators/BloodyRupture.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } +} diff --git a/Items/Weapons/Perforators/BloodyRupture.png b/Items/Weapons/Perforators/BloodyRupture.png new file mode 100644 index 0000000000..47ab724d1d Binary files /dev/null and b/Items/Weapons/Perforators/BloodyRupture.png differ diff --git a/Items/Weapons/Perforators/Eviscerator.cs b/Items/Weapons/Perforators/Eviscerator.cs new file mode 100644 index 0000000000..19aecbab29 --- /dev/null +++ b/Items/Weapons/Perforators/Eviscerator.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Perforators/Eviscerator.png b/Items/Weapons/Perforators/Eviscerator.png new file mode 100644 index 0000000000..0ca39cf816 Binary files /dev/null and b/Items/Weapons/Perforators/Eviscerator.png differ diff --git a/Items/Weapons/Perforators/SausageMaker.cs b/Items/Weapons/Perforators/SausageMaker.cs new file mode 100644 index 0000000000..d4ff0ee5d5 --- /dev/null +++ b/Items/Weapons/Perforators/SausageMaker.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/Perforators/SausageMaker.png b/Items/Weapons/Perforators/SausageMaker.png new file mode 100644 index 0000000000..4aeb8ac128 Binary files /dev/null and b/Items/Weapons/Perforators/SausageMaker.png differ diff --git a/Items/Weapons/Perforators/ToothBall.cs b/Items/Weapons/Perforators/ToothBall.cs new file mode 100644 index 0000000000..9f949c615a --- /dev/null +++ b/Items/Weapons/Perforators/ToothBall.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/Perforators/ToothBall.png b/Items/Weapons/Perforators/ToothBall.png new file mode 100644 index 0000000000..a60c17ad50 Binary files /dev/null and b/Items/Weapons/Perforators/ToothBall.png differ diff --git a/Items/Weapons/Perforators/VeinBurster.cs b/Items/Weapons/Perforators/VeinBurster.cs new file mode 100644 index 0000000000..6ff5f72da0 --- /dev/null +++ b/Items/Weapons/Perforators/VeinBurster.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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(); + } + } +} diff --git a/Items/Weapons/Perforators/VeinBurster.png b/Items/Weapons/Perforators/VeinBurster.png new file mode 100644 index 0000000000..c9409349a4 Binary files /dev/null and b/Items/Weapons/Perforators/VeinBurster.png differ diff --git a/Items/Weapons/Phangasm.cs b/Items/Weapons/Phangasm.cs new file mode 100644 index 0000000000..ac863b5e8c --- /dev/null +++ b/Items/Weapons/Phangasm.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Phangasm.png b/Items/Weapons/Phangasm.png new file mode 100644 index 0000000000..000767334c Binary files /dev/null and b/Items/Weapons/Phangasm.png differ diff --git a/Items/Weapons/PhantasmalFury.cs b/Items/Weapons/PhantasmalFury.cs new file mode 100644 index 0000000000..2057597718 --- /dev/null +++ b/Items/Weapons/PhantasmalFury.cs @@ -0,0 +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 PhantasmalFury : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantasmal Fury"); + Tooltip.SetDefault("Casts a phantasmal bolt that explodes into more bolts"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PhantasmalFury.png b/Items/Weapons/PhantasmalFury.png new file mode 100644 index 0000000000..a4f169f45d Binary files /dev/null and b/Items/Weapons/PhantasmalFury.png differ diff --git a/Items/Weapons/PhoenixBlade.cs b/Items/Weapons/PhoenixBlade.cs new file mode 100644 index 0000000000..75d00152e7 --- /dev/null +++ b/Items/Weapons/PhoenixBlade.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/PhoenixBlade.png b/Items/Weapons/PhoenixBlade.png new file mode 100644 index 0000000000..600eda9fdf Binary files /dev/null and b/Items/Weapons/PhoenixBlade.png differ diff --git a/Items/Weapons/Photoviscerator.cs b/Items/Weapons/Photoviscerator.cs new file mode 100644 index 0000000000..9f88a15ba7 --- /dev/null +++ b/Items/Weapons/Photoviscerator.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Photoviscerator"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Photoviscerator.png b/Items/Weapons/Photoviscerator.png new file mode 100644 index 0000000000..e48518e0e3 Binary files /dev/null and b/Items/Weapons/Photoviscerator.png differ diff --git a/Items/Weapons/PlagueCaller.png b/Items/Weapons/PlagueCaller.png new file mode 100644 index 0000000000..0e2fc86d84 Binary files /dev/null and b/Items/Weapons/PlagueCaller.png differ diff --git a/Items/Weapons/PlagueKeeper.png b/Items/Weapons/PlagueKeeper.png new file mode 100644 index 0000000000..d3ad835963 Binary files /dev/null and b/Items/Weapons/PlagueKeeper.png differ diff --git a/Items/Weapons/Plaguebringer/DiseasedPike.cs b/Items/Weapons/Plaguebringer/DiseasedPike.cs new file mode 100644 index 0000000000..1cb55f9a21 --- /dev/null +++ b/Items/Weapons/Plaguebringer/DiseasedPike.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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/DiseasedPike.png b/Items/Weapons/Plaguebringer/DiseasedPike.png new file mode 100644 index 0000000000..9d19829810 Binary files /dev/null and b/Items/Weapons/Plaguebringer/DiseasedPike.png differ diff --git a/Items/Weapons/Plaguebringer/Malevolence.cs b/Items/Weapons/Plaguebringer/Malevolence.cs new file mode 100644 index 0000000000..b07c74de27 --- /dev/null +++ b/Items/Weapons/Plaguebringer/Malevolence.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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/Malevolence.png b/Items/Weapons/Plaguebringer/Malevolence.png new file mode 100644 index 0000000000..6cfb539fd8 Binary files /dev/null and b/Items/Weapons/Plaguebringer/Malevolence.png differ diff --git a/Items/Weapons/Plaguebringer/MepheticSprayer.cs b/Items/Weapons/Plaguebringer/MepheticSprayer.cs new file mode 100644 index 0000000000..0095fba8d0 --- /dev/null +++ b/Items/Weapons/Plaguebringer/MepheticSprayer.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/MepheticSprayer.png b/Items/Weapons/Plaguebringer/MepheticSprayer.png new file mode 100644 index 0000000000..9adfb41642 Binary files /dev/null and b/Items/Weapons/Plaguebringer/MepheticSprayer.png differ diff --git a/Items/Weapons/Plaguebringer/PestilentDefiler.cs b/Items/Weapons/Plaguebringer/PestilentDefiler.cs new file mode 100644 index 0000000000..3e37b911da --- /dev/null +++ b/Items/Weapons/Plaguebringer/PestilentDefiler.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/PestilentDefiler.png b/Items/Weapons/Plaguebringer/PestilentDefiler.png new file mode 100644 index 0000000000..6c39d01bf3 Binary files /dev/null and b/Items/Weapons/Plaguebringer/PestilentDefiler.png differ diff --git a/Items/Weapons/Plaguebringer/PlagueStaff.cs b/Items/Weapons/Plaguebringer/PlagueStaff.cs new file mode 100644 index 0000000000..e70393f4a4 --- /dev/null +++ b/Items/Weapons/Plaguebringer/PlagueStaff.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/PlagueStaff.png b/Items/Weapons/Plaguebringer/PlagueStaff.png new file mode 100644 index 0000000000..e4d5f65f79 Binary files /dev/null and b/Items/Weapons/Plaguebringer/PlagueStaff.png differ diff --git a/Items/Weapons/Plaguebringer/TheHive.cs b/Items/Weapons/Plaguebringer/TheHive.cs new file mode 100644 index 0000000000..433c2539ea --- /dev/null +++ b/Items/Weapons/Plaguebringer/TheHive.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/TheHive.png b/Items/Weapons/Plaguebringer/TheHive.png new file mode 100644 index 0000000000..1d7b1d8a5f Binary files /dev/null and b/Items/Weapons/Plaguebringer/TheHive.png differ diff --git a/Items/Weapons/Plaguebringer/ThePlaguebringer.cs b/Items/Weapons/Plaguebringer/ThePlaguebringer.cs new file mode 100644 index 0000000000..59f9e71abc --- /dev/null +++ b/Items/Weapons/Plaguebringer/ThePlaguebringer.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Plaguebringer/ThePlaguebringer.png b/Items/Weapons/Plaguebringer/ThePlaguebringer.png new file mode 100644 index 0000000000..ef2cea7913 Binary files /dev/null and b/Items/Weapons/Plaguebringer/ThePlaguebringer.png differ diff --git a/Items/Weapons/Plaguebringer/VirulentKatana.cs b/Items/Weapons/Plaguebringer/VirulentKatana.cs new file mode 100644 index 0000000000..781aced43d --- /dev/null +++ b/Items/Weapons/Plaguebringer/VirulentKatana.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/Plaguebringer/VirulentKatana.png b/Items/Weapons/Plaguebringer/VirulentKatana.png new file mode 100644 index 0000000000..75e2e081f1 Binary files /dev/null and b/Items/Weapons/Plaguebringer/VirulentKatana.png differ diff --git a/Items/Weapons/PlanetaryAnnihilation.cs b/Items/Weapons/PlanetaryAnnihilation.cs new file mode 100644 index 0000000000..06780d37e4 --- /dev/null +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//using 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PlanetaryAnnihilation.png b/Items/Weapons/PlanetaryAnnihilation.png new file mode 100644 index 0000000000..6604f63ef5 Binary files /dev/null and b/Items/Weapons/PlanetaryAnnihilation.png differ diff --git a/Items/Weapons/PlasmaRifle.cs b/Items/Weapons/PlasmaRifle.cs new file mode 100644 index 0000000000..c0bcc2163d --- /dev/null +++ b/Items/Weapons/PlasmaRifle.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PlasmaRifle.png b/Items/Weapons/PlasmaRifle.png new file mode 100644 index 0000000000..712ed89215 Binary files /dev/null and b/Items/Weapons/PlasmaRifle.png differ diff --git a/Items/Weapons/PlasmaRod.cs b/Items/Weapons/PlasmaRod.cs new file mode 100644 index 0000000000..414a941108 --- /dev/null +++ b/Items/Weapons/PlasmaRod.cs @@ -0,0 +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 + { + 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" + + "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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PlasmaRod.png b/Items/Weapons/PlasmaRod.png new file mode 100644 index 0000000000..bd48a173f6 Binary files /dev/null and b/Items/Weapons/PlasmaRod.png differ diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs new file mode 100644 index 0000000000..a326b6645e --- /dev/null +++ b/Items/Weapons/Polterghast/BansheeHook.cs @@ -0,0 +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; + } + } +} diff --git a/Items/Weapons/Polterghast/BansheeHook.png b/Items/Weapons/Polterghast/BansheeHook.png new file mode 100644 index 0000000000..a38706bb64 Binary files /dev/null and b/Items/Weapons/Polterghast/BansheeHook.png differ diff --git a/Items/Weapons/Polterghast/DaemonsFlame.cs b/Items/Weapons/Polterghast/DaemonsFlame.cs new file mode 100644 index 0000000000..bca419ae77 --- /dev/null +++ b/Items/Weapons/Polterghast/DaemonsFlame.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Polterghast/DaemonsFlame.png b/Items/Weapons/Polterghast/DaemonsFlame.png new file mode 100644 index 0000000000..622701afe1 Binary files /dev/null and b/Items/Weapons/Polterghast/DaemonsFlame.png differ diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs new file mode 100644 index 0000000000..992c50ed61 --- /dev/null +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.png b/Items/Weapons/Polterghast/EtherealSubjugator.png new file mode 100644 index 0000000000..b555172e5d Binary files /dev/null and b/Items/Weapons/Polterghast/EtherealSubjugator.png differ diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs new file mode 100644 index 0000000000..49cdd234a2 --- /dev/null +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Polterghast/FatesReveal.png b/Items/Weapons/Polterghast/FatesReveal.png new file mode 100644 index 0000000000..2e626510ea Binary files /dev/null and b/Items/Weapons/Polterghast/FatesReveal.png differ diff --git a/Items/Weapons/Polterghast/GhastlyVisage.cs b/Items/Weapons/Polterghast/GhastlyVisage.cs new file mode 100644 index 0000000000..d4a9a990fe --- /dev/null +++ b/Items/Weapons/Polterghast/GhastlyVisage.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.Polterghast +{ + public class GhastlyVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Visage"); + Tooltip.SetDefault("Fires homing ghast energy that explodes"); + } + + + public override void SetDefaults() + { + item.damage = 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/GhastlyVisage.png b/Items/Weapons/Polterghast/GhastlyVisage.png new file mode 100644 index 0000000000..9da521c831 Binary files /dev/null and b/Items/Weapons/Polterghast/GhastlyVisage.png differ diff --git a/Items/Weapons/Polterghast/GhoulishGouger.cs b/Items/Weapons/Polterghast/GhoulishGouger.cs new file mode 100644 index 0000000000..65a0b3a4e0 --- /dev/null +++ b/Items/Weapons/Polterghast/GhoulishGouger.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } + } +} diff --git a/Items/Weapons/Polterghast/GhoulishGouger.png b/Items/Weapons/Polterghast/GhoulishGouger.png new file mode 100644 index 0000000000..409d9d01df Binary files /dev/null and b/Items/Weapons/Polterghast/GhoulishGouger.png differ diff --git a/Items/Weapons/Polterghast/TerrorBlade.cs b/Items/Weapons/Polterghast/TerrorBlade.cs new file mode 100644 index 0000000000..6d8e278a66 --- /dev/null +++ b/Items/Weapons/Polterghast/TerrorBlade.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } +} diff --git a/Items/Weapons/Polterghast/TerrorBlade.png b/Items/Weapons/Polterghast/TerrorBlade.png new file mode 100644 index 0000000000..f382fbc6f0 Binary files /dev/null and b/Items/Weapons/Polterghast/TerrorBlade.png differ diff --git a/Items/Weapons/PrimordialAncient.cs b/Items/Weapons/PrimordialAncient.cs new file mode 100644 index 0000000000..fc6f9e5cd2 --- /dev/null +++ b/Items/Weapons/PrimordialAncient.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PrimordialAncient.png b/Items/Weapons/PrimordialAncient.png new file mode 100644 index 0000000000..3aa592c583 Binary files /dev/null and b/Items/Weapons/PrimordialAncient.png differ diff --git a/Items/Weapons/PrimordialEarth.cs b/Items/Weapons/PrimordialEarth.cs new file mode 100644 index 0000000000..f4db7e33ec --- /dev/null +++ b/Items/Weapons/PrimordialEarth.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PrimordialEarth.png b/Items/Weapons/PrimordialEarth.png new file mode 100644 index 0000000000..72b36db9b2 Binary files /dev/null and b/Items/Weapons/PrimordialEarth.png differ diff --git a/Items/Weapons/ProfanedSword.cs b/Items/Weapons/ProfanedSword.cs new file mode 100644 index 0000000000..d5ba3fd7b6 --- /dev/null +++ b/Items/Weapons/ProfanedSword.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ProfanedSword.png b/Items/Weapons/ProfanedSword.png new file mode 100644 index 0000000000..41758d95bf Binary files /dev/null and b/Items/Weapons/ProfanedSword.png differ diff --git a/Items/Weapons/ProporsePistol.cs b/Items/Weapons/ProporsePistol.cs new file mode 100644 index 0000000000..2c3e8642e0 --- /dev/null +++ b/Items/Weapons/ProporsePistol.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ProporsePistol.png b/Items/Weapons/ProporsePistol.png new file mode 100644 index 0000000000..7f8c029dc9 Binary files /dev/null and b/Items/Weapons/ProporsePistol.png differ diff --git a/Items/Weapons/Providence/BlissfulBombardier.cs b/Items/Weapons/Providence/BlissfulBombardier.cs new file mode 100644 index 0000000000..45d7e0ed43 --- /dev/null +++ b/Items/Weapons/Providence/BlissfulBombardier.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Providence/BlissfulBombardier.png b/Items/Weapons/Providence/BlissfulBombardier.png new file mode 100644 index 0000000000..4950236e7d Binary files /dev/null and b/Items/Weapons/Providence/BlissfulBombardier.png differ diff --git a/Items/Weapons/Providence/HolyCollider.cs b/Items/Weapons/Providence/HolyCollider.cs new file mode 100644 index 0000000000..71b68a4834 --- /dev/null +++ b/Items/Weapons/Providence/HolyCollider.cs @@ -0,0 +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.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; + } + } + } +} diff --git a/Items/Weapons/Providence/HolyCollider.png b/Items/Weapons/Providence/HolyCollider.png new file mode 100644 index 0000000000..5c4c4d5698 Binary files /dev/null and b/Items/Weapons/Providence/HolyCollider.png differ diff --git a/Items/Weapons/Providence/MoltenAmputator.cs b/Items/Weapons/Providence/MoltenAmputator.cs new file mode 100644 index 0000000000..d81b34f2dc --- /dev/null +++ b/Items/Weapons/Providence/MoltenAmputator.cs @@ -0,0 +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 +{ + 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); + } + } + } +}} diff --git a/Items/Weapons/Providence/MoltenAmputator.png b/Items/Weapons/Providence/MoltenAmputator.png new file mode 100644 index 0000000000..4e44d58710 Binary files /dev/null and b/Items/Weapons/Providence/MoltenAmputator.png differ diff --git a/Items/Weapons/Providence/PurgeGuzzler.cs b/Items/Weapons/Providence/PurgeGuzzler.cs new file mode 100644 index 0000000000..3ca28bf5e1 --- /dev/null +++ b/Items/Weapons/Providence/PurgeGuzzler.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Providence/PurgeGuzzler.png b/Items/Weapons/Providence/PurgeGuzzler.png new file mode 100644 index 0000000000..ba116a437c Binary files /dev/null and b/Items/Weapons/Providence/PurgeGuzzler.png differ diff --git a/Items/Weapons/Providence/SolarFlare.cs b/Items/Weapons/Providence/SolarFlare.cs new file mode 100644 index 0000000000..2e958b561f --- /dev/null +++ b/Items/Weapons/Providence/SolarFlare.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SolarFlare.png b/Items/Weapons/Providence/SolarFlare.png new file mode 100644 index 0000000000..96bcbf2574 Binary files /dev/null and b/Items/Weapons/Providence/SolarFlare.png differ diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs new file mode 100644 index 0000000000..404dc2377b --- /dev/null +++ b/Items/Weapons/Providence/TelluricGlare.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Providence/TelluricGlare.png b/Items/Weapons/Providence/TelluricGlare.png new file mode 100644 index 0000000000..a4c34f0dbd Binary files /dev/null and b/Items/Weapons/Providence/TelluricGlare.png differ diff --git a/Items/Weapons/Pumpler.cs b/Items/Weapons/Pumpler.cs new file mode 100644 index 0000000000..621b5a57f1 --- /dev/null +++ b/Items/Weapons/Pumpler.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Pumpler.png b/Items/Weapons/Pumpler.png new file mode 100644 index 0000000000..a679090014 Binary files /dev/null and b/Items/Weapons/Pumpler.png differ diff --git a/Items/Weapons/Purge.cs b/Items/Weapons/Purge.cs new file mode 100644 index 0000000000..3d5ac6d03a --- /dev/null +++ b/Items/Weapons/Purge.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Purge.png b/Items/Weapons/Purge.png new file mode 100644 index 0000000000..770f46c352 Binary files /dev/null and b/Items/Weapons/Purge.png differ diff --git a/Items/Weapons/PurityAxe.cs b/Items/Weapons/PurityAxe.cs new file mode 100644 index 0000000000..3ec8767010 --- /dev/null +++ b/Items/Weapons/PurityAxe.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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); + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/PurityAxe.png b/Items/Weapons/PurityAxe.png new file mode 100644 index 0000000000..75b68ffd8d Binary files /dev/null and b/Items/Weapons/PurityAxe.png differ diff --git a/Items/Weapons/Pwnagehammer.cs b/Items/Weapons/Pwnagehammer.cs new file mode 100644 index 0000000000..3514faedc9 --- /dev/null +++ b/Items/Weapons/Pwnagehammer.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } + } +} diff --git a/Items/Weapons/Pwnagehammer.png b/Items/Weapons/Pwnagehammer.png new file mode 100644 index 0000000000..7a6cb7bc22 Binary files /dev/null and b/Items/Weapons/Pwnagehammer.png differ diff --git a/Items/Weapons/PwnagehammerMelee.cs b/Items/Weapons/PwnagehammerMelee.cs new file mode 100644 index 0000000000..6e895dd2d5 --- /dev/null +++ b/Items/Weapons/PwnagehammerMelee.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/PwnagehammerMelee.png b/Items/Weapons/PwnagehammerMelee.png new file mode 100644 index 0000000000..7a6cb7bc22 Binary files /dev/null and b/Items/Weapons/PwnagehammerMelee.png differ diff --git a/Items/Weapons/Quagmire.cs b/Items/Weapons/Quagmire.cs new file mode 100644 index 0000000000..19a0a3751f --- /dev/null +++ b/Items/Weapons/Quagmire.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Quagmire.png b/Items/Weapons/Quagmire.png new file mode 100644 index 0000000000..acd535aad6 Binary files /dev/null and b/Items/Weapons/Quagmire.png differ diff --git a/Items/Weapons/RaidersGlory.cs b/Items/Weapons/RaidersGlory.cs new file mode 100644 index 0000000000..232357aab2 --- /dev/null +++ b/Items/Weapons/RaidersGlory.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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/RaidersGlory.png b/Items/Weapons/RaidersGlory.png new file mode 100644 index 0000000000..40b507aa2f Binary files /dev/null and b/Items/Weapons/RaidersGlory.png differ diff --git a/Items/Weapons/Ravager/DrillCannon.png b/Items/Weapons/Ravager/DrillCannon.png new file mode 100644 index 0000000000..a2832da98d Binary files /dev/null and b/Items/Weapons/Ravager/DrillCannon.png differ diff --git a/Items/Weapons/Ravager/Hematemesis.cs b/Items/Weapons/Ravager/Hematemesis.cs new file mode 100644 index 0000000000..4f4a2f04af --- /dev/null +++ b/Items/Weapons/Ravager/Hematemesis.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Ravager/Hematemesis.png b/Items/Weapons/Ravager/Hematemesis.png new file mode 100644 index 0000000000..18e3ababe6 Binary files /dev/null and b/Items/Weapons/Ravager/Hematemesis.png differ diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs new file mode 100644 index 0000000000..9ae36ba9fc --- /dev/null +++ b/Items/Weapons/RedSun.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/RedSun.png b/Items/Weapons/RedSun.png new file mode 100644 index 0000000000..aa0820b4db Binary files /dev/null and b/Items/Weapons/RedSun.png differ diff --git a/Items/Weapons/RedtideSword.cs b/Items/Weapons/RedtideSword.cs new file mode 100644 index 0000000000..9b3d328f21 --- /dev/null +++ b/Items/Weapons/RedtideSword.cs @@ -0,0 +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 +{ + 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(); + } +}} diff --git a/Items/Weapons/RedtideSword.png b/Items/Weapons/RedtideSword.png new file mode 100644 index 0000000000..ece69dc72e Binary files /dev/null and b/Items/Weapons/RedtideSword.png differ diff --git a/Items/Weapons/RelicofRuin.cs b/Items/Weapons/RelicofRuin.cs new file mode 100644 index 0000000000..4579b709d2 --- /dev/null +++ b/Items/Weapons/RelicofRuin.cs @@ -0,0 +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 +{ + 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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/RelicofRuin.png b/Items/Weapons/RelicofRuin.png new file mode 100644 index 0000000000..63750c1293 Binary files /dev/null and b/Items/Weapons/RelicofRuin.png differ diff --git a/Items/Weapons/RoyalKnives.cs b/Items/Weapons/RoyalKnives.cs new file mode 100644 index 0000000000..4b17a2aadc --- /dev/null +++ b/Items/Weapons/RoyalKnives.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/RoyalKnives.png b/Items/Weapons/RoyalKnives.png new file mode 100644 index 0000000000..f54945e13e Binary files /dev/null and b/Items/Weapons/RoyalKnives.png differ diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs new file mode 100644 index 0000000000..e6b027f3c5 --- /dev/null +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/RoyalKnivesMelee.png b/Items/Weapons/RoyalKnivesMelee.png new file mode 100644 index 0000000000..f54945e13e Binary files /dev/null and b/Items/Weapons/RoyalKnivesMelee.png differ diff --git a/Items/Weapons/RubberMortarRound.cs b/Items/Weapons/RubberMortarRound.cs new file mode 100644 index 0000000000..cd83b854a7 --- /dev/null +++ b/Items/Weapons/RubberMortarRound.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RubberMortarRound.png b/Items/Weapons/RubberMortarRound.png new file mode 100644 index 0000000000..a7e8a177e1 Binary files /dev/null and b/Items/Weapons/RubberMortarRound.png differ diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs new file mode 100644 index 0000000000..ca1e4faa69 --- /dev/null +++ b/Items/Weapons/SDFMG.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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/SDFMG.png b/Items/Weapons/SDFMG.png new file mode 100644 index 0000000000..08ca9259b3 Binary files /dev/null and b/Items/Weapons/SDFMG.png differ diff --git a/Items/Weapons/SHPC.cs b/Items/Weapons/SHPC.cs new file mode 100644 index 0000000000..0c8abb355f --- /dev/null +++ b/Items/Weapons/SHPC.cs @@ -0,0 +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 + { + 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" + + "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; + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SHPC.png b/Items/Weapons/SHPC.png new file mode 100644 index 0000000000..5076987e82 Binary files /dev/null and b/Items/Weapons/SHPC.png differ diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs new file mode 100644 index 0000000000..ff25fab5f0 --- /dev/null +++ b/Items/Weapons/SanguineFlare.cs @@ -0,0 +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 SanguineFlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sanguine Flare"); + Tooltip.SetDefault("Fires a blast of sanguine flares that drain enemy life"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SanguineFlare.png b/Items/Weapons/SanguineFlare.png new file mode 100644 index 0000000000..1770591b91 Binary files /dev/null and b/Items/Weapons/SanguineFlare.png differ diff --git a/Items/Weapons/Scorpion.cs b/Items/Weapons/Scorpion.cs new file mode 100644 index 0000000000..434f9d2fc1 --- /dev/null +++ b/Items/Weapons/Scorpion.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Scorpion.png b/Items/Weapons/Scorpion.png new file mode 100644 index 0000000000..2a1bab81e0 Binary files /dev/null and b/Items/Weapons/Scorpion.png differ diff --git a/Items/Weapons/ScourgeoftheCosmos.cs b/Items/Weapons/ScourgeoftheCosmos.cs new file mode 100644 index 0000000000..df28f0ae68 --- /dev/null +++ b/Items/Weapons/ScourgeoftheCosmos.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/ScourgeoftheCosmos.png b/Items/Weapons/ScourgeoftheCosmos.png new file mode 100644 index 0000000000..bc1fc66277 Binary files /dev/null and b/Items/Weapons/ScourgeoftheCosmos.png differ diff --git a/Items/Weapons/ScourgeoftheCosmosThrown.cs b/Items/Weapons/ScourgeoftheCosmosThrown.cs new file mode 100644 index 0000000000..7d58bf740f --- /dev/null +++ b/Items/Weapons/ScourgeoftheCosmosThrown.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} diff --git a/Items/Weapons/ScourgeoftheCosmosThrown.png b/Items/Weapons/ScourgeoftheCosmosThrown.png new file mode 100644 index 0000000000..bc1fc66277 Binary files /dev/null and b/Items/Weapons/ScourgeoftheCosmosThrown.png differ diff --git a/Items/Weapons/ScourgeoftheDesert.cs b/Items/Weapons/ScourgeoftheDesert.cs new file mode 100644 index 0000000000..b52af02701 --- /dev/null +++ b/Items/Weapons/ScourgeoftheDesert.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class ScourgeoftheDesert : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge of the Desert"); + 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; + } + } +} diff --git a/Items/Weapons/ScourgeoftheDesert.png b/Items/Weapons/ScourgeoftheDesert.png new file mode 100644 index 0000000000..93f9a0eefd Binary files /dev/null and b/Items/Weapons/ScourgeoftheDesert.png differ diff --git a/Items/Weapons/Seabow.cs b/Items/Weapons/Seabow.cs new file mode 100644 index 0000000000..ac7c834fcc --- /dev/null +++ b/Items/Weapons/Seabow.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//using 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/Seabow.png b/Items/Weapons/Seabow.png new file mode 100644 index 0000000000..f09a632c6f Binary files /dev/null and b/Items/Weapons/Seabow.png differ diff --git a/Items/Weapons/Seadragon.cs b/Items/Weapons/Seadragon.cs new file mode 100644 index 0000000000..0f904d0d2b --- /dev/null +++ b/Items/Weapons/Seadragon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Seadragon.png b/Items/Weapons/Seadragon.png new file mode 100644 index 0000000000..3e7745cc33 Binary files /dev/null and b/Items/Weapons/Seadragon.png differ diff --git a/Items/Weapons/SeashellBoomerang.cs b/Items/Weapons/SeashellBoomerang.cs new file mode 100644 index 0000000000..b01e269c75 --- /dev/null +++ b/Items/Weapons/SeashellBoomerang.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/SeashellBoomerang.png b/Items/Weapons/SeashellBoomerang.png new file mode 100644 index 0000000000..4e0fba13e0 Binary files /dev/null and b/Items/Weapons/SeashellBoomerang.png differ diff --git a/Items/Weapons/SeashellBoomerangMelee.cs b/Items/Weapons/SeashellBoomerangMelee.cs new file mode 100644 index 0000000000..f82c7489ce --- /dev/null +++ b/Items/Weapons/SeashellBoomerangMelee.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/SeashellBoomerangMelee.png b/Items/Weapons/SeashellBoomerangMelee.png new file mode 100644 index 0000000000..4e0fba13e0 Binary files /dev/null and b/Items/Weapons/SeashellBoomerangMelee.png differ diff --git a/Items/Weapons/ShadecrystalTome.cs b/Items/Weapons/ShadecrystalTome.cs new file mode 100644 index 0000000000..a2117551a4 --- /dev/null +++ b/Items/Weapons/ShadecrystalTome.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/ShadecrystalTome.png b/Items/Weapons/ShadecrystalTome.png new file mode 100644 index 0000000000..e1f00a47c6 Binary files /dev/null and b/Items/Weapons/ShadecrystalTome.png differ diff --git a/Items/Weapons/ShadowboltStaff.cs b/Items/Weapons/ShadowboltStaff.cs new file mode 100644 index 0000000000..7d1d0f1a4e --- /dev/null +++ b/Items/Weapons/ShadowboltStaff.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/ShadowboltStaff.png b/Items/Weapons/ShadowboltStaff.png new file mode 100644 index 0000000000..c950e434b2 Binary files /dev/null and b/Items/Weapons/ShadowboltStaff.png differ diff --git a/Items/Weapons/Shimmerspark.cs b/Items/Weapons/Shimmerspark.cs new file mode 100644 index 0000000000..8d53eebc77 --- /dev/null +++ b/Items/Weapons/Shimmerspark.cs @@ -0,0 +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 +{ + 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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/Shimmerspark.png b/Items/Weapons/Shimmerspark.png new file mode 100644 index 0000000000..ed95ccfa65 Binary files /dev/null and b/Items/Weapons/Shimmerspark.png differ diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs new file mode 100644 index 0000000000..a3d8abc798 --- /dev/null +++ b/Items/Weapons/Shredder.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class Shredder : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shredder"); + Tooltip.SetDefault("The myth, the legend, the weapon that drops more frames than any other\n" + + "Fires a barrage of energy bolts that split and bounce\n" + + "Right click to fire a barrage of normal bullets"); + } + + public override void SetDefaults() + { + item.damage = 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/Shredder.png b/Items/Weapons/Shredder.png new file mode 100644 index 0000000000..3623844b82 Binary files /dev/null and b/Items/Weapons/Shredder.png differ diff --git a/Items/Weapons/Shroomer.cs b/Items/Weapons/Shroomer.cs new file mode 100644 index 0000000000..216d96c3c0 --- /dev/null +++ b/Items/Weapons/Shroomer.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/Shroomer.png b/Items/Weapons/Shroomer.png new file mode 100644 index 0000000000..05044fbba2 Binary files /dev/null and b/Items/Weapons/Shroomer.png differ diff --git a/Items/Weapons/SkyGlaze.cs b/Items/Weapons/SkyGlaze.cs new file mode 100644 index 0000000000..dbbb85a173 --- /dev/null +++ b/Items/Weapons/SkyGlaze.cs @@ -0,0 +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 SkyGlaze : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Glaze"); + Tooltip.SetDefault("Fires feathers from the sky that stick to enemies and tiles and explode"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 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/SkyGlaze.png b/Items/Weapons/SkyGlaze.png new file mode 100644 index 0000000000..226dcd9358 Binary files /dev/null and b/Items/Weapons/SkyGlaze.png differ diff --git a/Items/Weapons/SlagMagnum.cs b/Items/Weapons/SlagMagnum.cs new file mode 100644 index 0000000000..bf18a9069a --- /dev/null +++ b/Items/Weapons/SlagMagnum.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/SlagMagnum.png b/Items/Weapons/SlagMagnum.png new file mode 100644 index 0000000000..d0120c23c4 Binary files /dev/null and b/Items/Weapons/SlagMagnum.png differ diff --git a/Items/Weapons/SlimeGod/AbyssalTome.cs b/Items/Weapons/SlimeGod/AbyssalTome.cs new file mode 100644 index 0000000000..3637bdbcb5 --- /dev/null +++ b/Items/Weapons/SlimeGod/AbyssalTome.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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 new file mode 100644 index 0000000000..0b1ed2c541 Binary files /dev/null and b/Items/Weapons/SlimeGod/AbyssalTome.png differ diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.cs b/Items/Weapons/SlimeGod/CorroslimeStaff.cs new file mode 100644 index 0000000000..51311996a1 --- /dev/null +++ b/Items/Weapons/SlimeGod/CorroslimeStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.png b/Items/Weapons/SlimeGod/CorroslimeStaff.png new file mode 100644 index 0000000000..1bd2624269 Binary files /dev/null and b/Items/Weapons/SlimeGod/CorroslimeStaff.png differ diff --git a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs new file mode 100644 index 0000000000..5fc35845ab --- /dev/null +++ b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/CorruptedCrusherBlade.png b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.png new file mode 100644 index 0000000000..e1cc27907b Binary files /dev/null and b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.png differ diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.cs b/Items/Weapons/SlimeGod/CrimslimeStaff.cs new file mode 100644 index 0000000000..869cff00f9 --- /dev/null +++ b/Items/Weapons/SlimeGod/CrimslimeStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.png b/Items/Weapons/SlimeGod/CrimslimeStaff.png new file mode 100644 index 0000000000..e9d9de8a01 Binary files /dev/null and b/Items/Weapons/SlimeGod/CrimslimeStaff.png differ diff --git a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs new file mode 100644 index 0000000000..d91956af08 --- /dev/null +++ b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/CrimsonCrusherBlade.png b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.png new file mode 100644 index 0000000000..fe76b18b91 Binary files /dev/null and b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.png differ diff --git a/Items/Weapons/SlimeGod/EldritchTome.cs b/Items/Weapons/SlimeGod/EldritchTome.cs new file mode 100644 index 0000000000..b7b4e2c450 --- /dev/null +++ b/Items/Weapons/SlimeGod/EldritchTome.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/EldritchTome.png b/Items/Weapons/SlimeGod/EldritchTome.png new file mode 100644 index 0000000000..5791ff3da4 Binary files /dev/null and b/Items/Weapons/SlimeGod/EldritchTome.png differ diff --git a/Items/Weapons/SlimeGod/GelDart.cs b/Items/Weapons/SlimeGod/GelDart.cs new file mode 100644 index 0000000000..05b3b00036 --- /dev/null +++ b/Items/Weapons/SlimeGod/GelDart.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/SlimeGod/GelDart.png b/Items/Weapons/SlimeGod/GelDart.png new file mode 100644 index 0000000000..a584390e21 Binary files /dev/null and b/Items/Weapons/SlimeGod/GelDart.png differ diff --git a/Items/Weapons/SlimeGod/GeliticBlade.cs b/Items/Weapons/SlimeGod/GeliticBlade.cs new file mode 100644 index 0000000000..476bdb6793 --- /dev/null +++ b/Items/Weapons/SlimeGod/GeliticBlade.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/SlimeGod/GeliticBlade.png b/Items/Weapons/SlimeGod/GeliticBlade.png new file mode 100644 index 0000000000..ddc346ad64 Binary files /dev/null and b/Items/Weapons/SlimeGod/GeliticBlade.png differ diff --git a/Items/Weapons/SlimeGod/Goobow.cs b/Items/Weapons/SlimeGod/Goobow.cs new file mode 100644 index 0000000000..86f0386a4c --- /dev/null +++ b/Items/Weapons/SlimeGod/Goobow.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//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/Goobow.png b/Items/Weapons/SlimeGod/Goobow.png new file mode 100644 index 0000000000..40ca867a73 Binary files /dev/null and b/Items/Weapons/SlimeGod/Goobow.png differ diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs new file mode 100644 index 0000000000..c61cf29298 --- /dev/null +++ b/Items/Weapons/SlimeGod/GunkShot.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/GunkShot.png b/Items/Weapons/SlimeGod/GunkShot.png new file mode 100644 index 0000000000..fd70fc2e78 Binary files /dev/null and b/Items/Weapons/SlimeGod/GunkShot.png differ diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs new file mode 100644 index 0000000000..3f484c3032 --- /dev/null +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -0,0 +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 + { + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.png b/Items/Weapons/SlimeGod/OverloadedBlaster.png new file mode 100644 index 0000000000..249bd3de5f Binary files /dev/null and b/Items/Weapons/SlimeGod/OverloadedBlaster.png differ diff --git a/Items/Weapons/SlimeGod/TheGodsGambit.cs b/Items/Weapons/SlimeGod/TheGodsGambit.cs new file mode 100644 index 0000000000..5438688d7f --- /dev/null +++ b/Items/Weapons/SlimeGod/TheGodsGambit.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/TheGodsGambit.png b/Items/Weapons/SlimeGod/TheGodsGambit.png new file mode 100644 index 0000000000..7a9eb79ab2 Binary files /dev/null and b/Items/Weapons/SlimeGod/TheGodsGambit.png differ diff --git a/Items/Weapons/SolsticeClaymore.cs b/Items/Weapons/SolsticeClaymore.cs new file mode 100644 index 0000000000..fd8ae10070 --- /dev/null +++ b/Items/Weapons/SolsticeClaymore.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/Weapons/SolsticeClaymore.png b/Items/Weapons/SolsticeClaymore.png new file mode 100644 index 0000000000..becb3b8406 Binary files /dev/null and b/Items/Weapons/SolsticeClaymore.png differ diff --git a/Items/Weapons/SomaPrime.cs b/Items/Weapons/SomaPrime.cs new file mode 100644 index 0000000000..54711ae6ab --- /dev/null +++ b/Items/Weapons/SomaPrime.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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/SomaPrime.png b/Items/Weapons/SomaPrime.png new file mode 100644 index 0000000000..5f91bd4517 Binary files /dev/null and b/Items/Weapons/SomaPrime.png differ diff --git a/Items/Weapons/SoulHarvester.cs b/Items/Weapons/SoulHarvester.cs new file mode 100644 index 0000000000..d8fd14a328 --- /dev/null +++ b/Items/Weapons/SoulHarvester.cs @@ -0,0 +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; + } + } + } + } +} diff --git a/Items/Weapons/SoulHarvester.png b/Items/Weapons/SoulHarvester.png new file mode 100644 index 0000000000..d047f2a0dd Binary files /dev/null and b/Items/Weapons/SoulHarvester.png differ diff --git a/Items/Weapons/SoulPiercer.cs b/Items/Weapons/SoulPiercer.cs new file mode 100644 index 0000000000..4738fe56bc --- /dev/null +++ b/Items/Weapons/SoulPiercer.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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/SoulPiercer.png b/Items/Weapons/SoulPiercer.png new file mode 100644 index 0000000000..4a1981bdba Binary files /dev/null and b/Items/Weapons/SoulPiercer.png differ diff --git a/Items/Weapons/SpatialLance.cs b/Items/Weapons/SpatialLance.cs new file mode 100644 index 0000000000..30c3b0e7e3 --- /dev/null +++ b/Items/Weapons/SpatialLance.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/SpatialLance.png b/Items/Weapons/SpatialLance.png new file mode 100644 index 0000000000..bbf16bd646 Binary files /dev/null and b/Items/Weapons/SpatialLance.png differ diff --git a/Items/Weapons/SpearofPaleolith.cs b/Items/Weapons/SpearofPaleolith.cs new file mode 100644 index 0000000000..fc2f1201f6 --- /dev/null +++ b/Items/Weapons/SpearofPaleolith.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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/SpearofPaleolith.png b/Items/Weapons/SpearofPaleolith.png new file mode 100644 index 0000000000..45ec221cf2 Binary files /dev/null and b/Items/Weapons/SpearofPaleolith.png differ diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs new file mode 100644 index 0000000000..a4afcad259 --- /dev/null +++ b/Items/Weapons/SpectralstormCannon.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SpectralstormCannon.png b/Items/Weapons/SpectralstormCannon.png new file mode 100644 index 0000000000..ac0bc7f5e9 Binary files /dev/null and b/Items/Weapons/SpectralstormCannon.png differ diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs new file mode 100644 index 0000000000..08aa3c6f7f --- /dev/null +++ b/Items/Weapons/SpectreRifle.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/SpectreRifle.png b/Items/Weapons/SpectreRifle.png new file mode 100644 index 0000000000..1bf30289f4 Binary files /dev/null and b/Items/Weapons/SpectreRifle.png differ diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs new file mode 100644 index 0000000000..774bd672e2 --- /dev/null +++ b/Items/Weapons/SporeKnife.cs @@ -0,0 +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 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); + } + } +}} diff --git a/Items/Weapons/SporeKnife.png b/Items/Weapons/SporeKnife.png new file mode 100644 index 0000000000..3627904887 Binary files /dev/null and b/Items/Weapons/SporeKnife.png differ diff --git a/Items/Weapons/Spyker.cs b/Items/Weapons/Spyker.cs new file mode 100644 index 0000000000..7a81fd88e9 --- /dev/null +++ b/Items/Weapons/Spyker.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Spyker.png b/Items/Weapons/Spyker.png new file mode 100644 index 0000000000..c16af3bef7 Binary files /dev/null and b/Items/Weapons/Spyker.png differ diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs new file mode 100644 index 0000000000..919c08be12 --- /dev/null +++ b/Items/Weapons/StarCannonEX.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/StarCannonEX.png b/Items/Weapons/StarCannonEX.png new file mode 100644 index 0000000000..58968eafee Binary files /dev/null and b/Items/Weapons/StarCannonEX.png differ diff --git a/Items/Weapons/StardustStaff.cs b/Items/Weapons/StardustStaff.cs new file mode 100644 index 0000000000..b653bb0dec --- /dev/null +++ b/Items/Weapons/StardustStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/StardustStaff.png b/Items/Weapons/StardustStaff.png new file mode 100644 index 0000000000..64823415e9 Binary files /dev/null and b/Items/Weapons/StardustStaff.png differ diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs new file mode 100644 index 0000000000..39052c501b --- /dev/null +++ b/Items/Weapons/Starfleet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Starfleet.png b/Items/Weapons/Starfleet.png new file mode 100644 index 0000000000..d2d9c405d0 Binary files /dev/null and b/Items/Weapons/Starfleet.png differ diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs new file mode 100644 index 0000000000..fc471d5431 --- /dev/null +++ b/Items/Weapons/StarfleetMK2.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/StarfleetMK2.png b/Items/Weapons/StarfleetMK2.png new file mode 100644 index 0000000000..f6a9035595 Binary files /dev/null and b/Items/Weapons/StarfleetMK2.png differ diff --git a/Items/Weapons/StarnightLance.cs b/Items/Weapons/StarnightLance.cs new file mode 100644 index 0000000000..5916651eec --- /dev/null +++ b/Items/Weapons/StarnightLance.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } +}} diff --git a/Items/Weapons/StarnightLance.png b/Items/Weapons/StarnightLance.png new file mode 100644 index 0000000000..bde3ddab6c Binary files /dev/null and b/Items/Weapons/StarnightLance.png differ diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs new file mode 100644 index 0000000000..e856f8da1d --- /dev/null +++ b/Items/Weapons/StellarStriker.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +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(); + } + } +} diff --git a/Items/Weapons/StellarStriker.png b/Items/Weapons/StellarStriker.png new file mode 100644 index 0000000000..b784fd1bf9 Binary files /dev/null and b/Items/Weapons/StellarStriker.png differ diff --git a/Items/Weapons/StormDragoon.cs b/Items/Weapons/StormDragoon.cs new file mode 100644 index 0000000000..11cf50e65b --- /dev/null +++ b/Items/Weapons/StormDragoon.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/StormDragoon.png b/Items/Weapons/StormDragoon.png new file mode 100644 index 0000000000..da8a466b98 Binary files /dev/null and b/Items/Weapons/StormDragoon.png differ diff --git a/Items/Weapons/StormRuler.cs b/Items/Weapons/StormRuler.cs new file mode 100644 index 0000000000..f4ac384fc5 --- /dev/null +++ b/Items/Weapons/StormRuler.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.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/StormRuler.png b/Items/Weapons/StormRuler.png new file mode 100644 index 0000000000..f9d3b49b6d Binary files /dev/null and b/Items/Weapons/StormRuler.png differ diff --git a/Items/Weapons/StormSaber.cs b/Items/Weapons/StormSaber.cs new file mode 100644 index 0000000000..0b446961b9 --- /dev/null +++ b/Items/Weapons/StormSaber.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons +{ + 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/StormSaber.png b/Items/Weapons/StormSaber.png new file mode 100644 index 0000000000..8b0670ae28 Binary files /dev/null and b/Items/Weapons/StormSaber.png differ diff --git a/Items/Weapons/StormSurge.cs b/Items/Weapons/StormSurge.cs new file mode 100644 index 0000000000..64f3f2b9d8 --- /dev/null +++ b/Items/Weapons/StormSurge.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/StormSurge.png b/Items/Weapons/StormSurge.png new file mode 100644 index 0000000000..86f9b5ac18 Binary files /dev/null and b/Items/Weapons/StormSurge.png differ diff --git a/Items/Weapons/StreamGouge.cs b/Items/Weapons/StreamGouge.cs new file mode 100644 index 0000000000..e04ecd5bfe --- /dev/null +++ b/Items/Weapons/StreamGouge.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/StreamGouge.png b/Items/Weapons/StreamGouge.png new file mode 100644 index 0000000000..7dd206a901 Binary files /dev/null and b/Items/Weapons/StreamGouge.png differ diff --git a/Items/Weapons/SubsumingVortex.cs b/Items/Weapons/SubsumingVortex.cs new file mode 100644 index 0000000000..97b15c29ce --- /dev/null +++ b/Items/Weapons/SubsumingVortex.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SubsumingVortex.png b/Items/Weapons/SubsumingVortex.png new file mode 100644 index 0000000000..35d30164d2 Binary files /dev/null and b/Items/Weapons/SubsumingVortex.png differ diff --git a/Items/Weapons/SunGodStaff.cs b/Items/Weapons/SunGodStaff.cs new file mode 100644 index 0000000000..39f33085c4 --- /dev/null +++ b/Items/Weapons/SunGodStaff.cs @@ -0,0 +1,102 @@ +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SunGodStaff.png b/Items/Weapons/SunGodStaff.png new file mode 100644 index 0000000000..eb6e2a4027 Binary files /dev/null and b/Items/Weapons/SunGodStaff.png differ diff --git a/Items/Weapons/SunSpiritStaff.cs b/Items/Weapons/SunSpiritStaff.cs new file mode 100644 index 0000000000..a370d3bcb5 --- /dev/null +++ b/Items/Weapons/SunSpiritStaff.cs @@ -0,0 +1,99 @@ +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SunSpiritStaff.png b/Items/Weapons/SunSpiritStaff.png new file mode 100644 index 0000000000..65e3a45f4f Binary files /dev/null and b/Items/Weapons/SunSpiritStaff.png differ diff --git a/Items/Weapons/SuperballBullet.cs b/Items/Weapons/SuperballBullet.cs new file mode 100644 index 0000000000..077626f922 --- /dev/null +++ b/Items/Weapons/SuperballBullet.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Superball Bullet"); + Tooltip.SetDefault("Bounces at extreme speeds"); + } + + public override void SetDefaults() + { + item.damage = 6; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("SuperballBullet"); + item.shootSpeed = 1f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteorShot, 150); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/SuperballBullet.png b/Items/Weapons/SuperballBullet.png new file mode 100644 index 0000000000..1b2fa87413 Binary files /dev/null and b/Items/Weapons/SuperballBullet.png differ diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs new file mode 100644 index 0000000000..560a0e4f1a --- /dev/null +++ b/Items/Weapons/Svantechnical.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Svantechnical.png b/Items/Weapons/Svantechnical.png new file mode 100644 index 0000000000..e5bd61bab6 Binary files /dev/null and b/Items/Weapons/Svantechnical.png differ diff --git a/Items/Weapons/T1000.cs b/Items/Weapons/T1000.cs new file mode 100644 index 0000000000..a07fb3b671 --- /dev/null +++ b/Items/Weapons/T1000.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/T1000.png b/Items/Weapons/T1000.png new file mode 100644 index 0000000000..019dc1c48b Binary files /dev/null and b/Items/Weapons/T1000.png differ diff --git a/Items/Weapons/TarragonThrowingDart.cs b/Items/Weapons/TarragonThrowingDart.cs new file mode 100644 index 0000000000..f50763c414 --- /dev/null +++ b/Items/Weapons/TarragonThrowingDart.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TarragonThrowingDart.png b/Items/Weapons/TarragonThrowingDart.png new file mode 100644 index 0000000000..0b2aceb318 Binary files /dev/null and b/Items/Weapons/TarragonThrowingDart.png differ diff --git a/Items/Weapons/TeardropCleaver.cs b/Items/Weapons/TeardropCleaver.cs new file mode 100644 index 0000000000..58afd59ca7 --- /dev/null +++ b/Items/Weapons/TeardropCleaver.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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); + } +}} diff --git a/Items/Weapons/TeardropCleaver.png b/Items/Weapons/TeardropCleaver.png new file mode 100644 index 0000000000..941021e145 Binary files /dev/null and b/Items/Weapons/TeardropCleaver.png differ diff --git a/Items/Weapons/TearsofHeaven.cs b/Items/Weapons/TearsofHeaven.cs new file mode 100644 index 0000000000..a1a41f1c54 --- /dev/null +++ b/Items/Weapons/TearsofHeaven.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TearsofHeaven.png b/Items/Weapons/TearsofHeaven.png new file mode 100644 index 0000000000..b471a3f3ed Binary files /dev/null and b/Items/Weapons/TearsofHeaven.png differ diff --git a/Items/Weapons/TemporalFloeSword.cs b/Items/Weapons/TemporalFloeSword.cs new file mode 100644 index 0000000000..b5666e96d1 --- /dev/null +++ b/Items/Weapons/TemporalFloeSword.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/TemporalFloeSword.png b/Items/Weapons/TemporalFloeSword.png new file mode 100644 index 0000000000..b9f372dd53 Binary files /dev/null and b/Items/Weapons/TemporalFloeSword.png differ diff --git a/Items/Weapons/TerraArrow.cs b/Items/Weapons/TerraArrow.cs new file mode 100644 index 0000000000..1b73399771 --- /dev/null +++ b/Items/Weapons/TerraArrow.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TerraArrow.png b/Items/Weapons/TerraArrow.png new file mode 100644 index 0000000000..683c3247f1 Binary files /dev/null and b/Items/Weapons/TerraArrow.png differ diff --git a/Items/Weapons/TerraBullet.cs b/Items/Weapons/TerraBullet.cs new file mode 100644 index 0000000000..bb45ed7be5 --- /dev/null +++ b/Items/Weapons/TerraBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TerraBullet.png b/Items/Weapons/TerraBullet.png new file mode 100644 index 0000000000..382db505ce Binary files /dev/null and b/Items/Weapons/TerraBullet.png differ diff --git a/Items/Weapons/TerraEdge.cs b/Items/Weapons/TerraEdge.cs new file mode 100644 index 0000000000..cfcbc50d2d --- /dev/null +++ b/Items/Weapons/TerraEdge.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/TerraEdge.png b/Items/Weapons/TerraEdge.png new file mode 100644 index 0000000000..5fa9311583 Binary files /dev/null and b/Items/Weapons/TerraEdge.png differ diff --git a/Items/Weapons/TerraFlameburster.cs b/Items/Weapons/TerraFlameburster.cs new file mode 100644 index 0000000000..5978e4c2d6 --- /dev/null +++ b/Items/Weapons/TerraFlameburster.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TerraFlameburster.png b/Items/Weapons/TerraFlameburster.png new file mode 100644 index 0000000000..12d14a4c8c Binary files /dev/null and b/Items/Weapons/TerraFlameburster.png differ diff --git a/Items/Weapons/TerraLance.cs b/Items/Weapons/TerraLance.cs new file mode 100644 index 0000000000..5bc0785109 --- /dev/null +++ b/Items/Weapons/TerraLance.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +public class TerraLance : ModItem +{ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Lance"); + } + + 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/TerraLance.png b/Items/Weapons/TerraLance.png new file mode 100644 index 0000000000..1cbe24ba15 Binary files /dev/null and b/Items/Weapons/TerraLance.png differ diff --git a/Items/Weapons/TerraRay.cs b/Items/Weapons/TerraRay.cs new file mode 100644 index 0000000000..10b55e075a --- /dev/null +++ b/Items/Weapons/TerraRay.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/TerraRay.png b/Items/Weapons/TerraRay.png new file mode 100644 index 0000000000..d3c796eb03 Binary files /dev/null and b/Items/Weapons/TerraRay.png differ diff --git a/Items/Weapons/TerraShiv.cs b/Items/Weapons/TerraShiv.cs new file mode 100644 index 0000000000..232337216c --- /dev/null +++ b/Items/Weapons/TerraShiv.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/TerraShiv.png b/Items/Weapons/TerraShiv.png new file mode 100644 index 0000000000..6ad23693b0 Binary files /dev/null and b/Items/Weapons/TerraShiv.png differ diff --git a/Items/Weapons/Terracotta.cs b/Items/Weapons/Terracotta.cs new file mode 100644 index 0000000000..0f299f0f98 --- /dev/null +++ b/Items/Weapons/Terracotta.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } + } +} diff --git a/Items/Weapons/Terracotta.png b/Items/Weapons/Terracotta.png new file mode 100644 index 0000000000..66d10b9a30 Binary files /dev/null and b/Items/Weapons/Terracotta.png differ diff --git a/Items/Weapons/Terratomere.cs b/Items/Weapons/Terratomere.cs new file mode 100644 index 0000000000..0c4e7aed55 --- /dev/null +++ b/Items/Weapons/Terratomere.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/Terratomere.png b/Items/Weapons/Terratomere.png new file mode 100644 index 0000000000..c8d070ef99 Binary files /dev/null and b/Items/Weapons/Terratomere.png differ diff --git a/Items/Weapons/TheBallista.cs b/Items/Weapons/TheBallista.cs new file mode 100644 index 0000000000..72a7656d89 --- /dev/null +++ b/Items/Weapons/TheBallista.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TheBallista.png b/Items/Weapons/TheBallista.png new file mode 100644 index 0000000000..36692496e0 Binary files /dev/null and b/Items/Weapons/TheBallista.png differ diff --git a/Items/Weapons/TheEmpyrean.cs b/Items/Weapons/TheEmpyrean.cs new file mode 100644 index 0000000000..c250e33961 --- /dev/null +++ b/Items/Weapons/TheEmpyrean.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TheEmpyrean.png b/Items/Weapons/TheEmpyrean.png new file mode 100644 index 0000000000..78910571a1 Binary files /dev/null and b/Items/Weapons/TheEmpyrean.png differ diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs new file mode 100644 index 0000000000..03870699cc --- /dev/null +++ b/Items/Weapons/TheEnforcer.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class 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(); + } + } +} diff --git a/Items/Weapons/TheEnforcer.png b/Items/Weapons/TheEnforcer.png new file mode 100644 index 0000000000..5a6d73d9d5 Binary files /dev/null and b/Items/Weapons/TheEnforcer.png differ diff --git a/Items/Weapons/TheMutilator.cs b/Items/Weapons/TheMutilator.cs new file mode 100644 index 0000000000..cf69548de7 --- /dev/null +++ b/Items/Weapons/TheMutilator.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TheMutilator.png b/Items/Weapons/TheMutilator.png new file mode 100644 index 0000000000..db127ea0fc Binary files /dev/null and b/Items/Weapons/TheMutilator.png differ diff --git a/Items/Weapons/TheStorm.cs b/Items/Weapons/TheStorm.cs new file mode 100644 index 0000000000..75946d337e --- /dev/null +++ b/Items/Weapons/TheStorm.cs @@ -0,0 +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; +//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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TheStorm.png b/Items/Weapons/TheStorm.png new file mode 100644 index 0000000000..813babc1ff Binary files /dev/null and b/Items/Weapons/TheStorm.png differ diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs new file mode 100644 index 0000000000..eed1a93169 --- /dev/null +++ b/Items/Weapons/TheSwarmer.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/TheSwarmer.png b/Items/Weapons/TheSwarmer.png new file mode 100644 index 0000000000..c48d8195b3 Binary files /dev/null and b/Items/Weapons/TheSwarmer.png differ diff --git a/Items/Weapons/TheWand.cs b/Items/Weapons/TheWand.cs new file mode 100644 index 0000000000..64f1a6a0d3 --- /dev/null +++ b/Items/Weapons/TheWand.cs @@ -0,0 +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 + { + 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); + } + } + } +} diff --git a/Items/Weapons/TheWand.png b/Items/Weapons/TheWand.png new file mode 100644 index 0000000000..d631598b1c Binary files /dev/null and b/Items/Weapons/TheWand.png differ diff --git a/Items/Weapons/TitaniumRailgun.cs b/Items/Weapons/TitaniumRailgun.cs new file mode 100644 index 0000000000..9ad1c8f0a3 --- /dev/null +++ b/Items/Weapons/TitaniumRailgun.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/TitaniumRailgun.png b/Items/Weapons/TitaniumRailgun.png new file mode 100644 index 0000000000..7a58e41c3a Binary files /dev/null and b/Items/Weapons/TitaniumRailgun.png differ diff --git a/Items/Weapons/TitaniumShuriken.cs b/Items/Weapons/TitaniumShuriken.cs new file mode 100644 index 0000000000..4488a7f72e --- /dev/null +++ b/Items/Weapons/TitaniumShuriken.cs @@ -0,0 +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 +{ + 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(); + } +}} diff --git a/Items/Weapons/TitaniumShuriken.png b/Items/Weapons/TitaniumShuriken.png new file mode 100644 index 0000000000..e3f185f3c3 Binary files /dev/null and b/Items/Weapons/TitaniumShuriken.png differ diff --git a/Items/Weapons/TomeofFates.cs b/Items/Weapons/TomeofFates.cs new file mode 100644 index 0000000000..0acd36b487 --- /dev/null +++ b/Items/Weapons/TomeofFates.cs @@ -0,0 +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 +{ + 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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/TomeofFates.png b/Items/Weapons/TomeofFates.png new file mode 100644 index 0000000000..d33492dbf1 Binary files /dev/null and b/Items/Weapons/TomeofFates.png differ diff --git a/Items/Weapons/Tradewinds.cs b/Items/Weapons/Tradewinds.cs new file mode 100644 index 0000000000..e1fc7f7301 --- /dev/null +++ b/Items/Weapons/Tradewinds.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons { +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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/Tradewinds.png b/Items/Weapons/Tradewinds.png new file mode 100644 index 0000000000..1d18e2be8d Binary files /dev/null and b/Items/Weapons/Tradewinds.png differ diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs new file mode 100644 index 0000000000..1c8d5dc52a --- /dev/null +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMight.png b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.png new file mode 100644 index 0000000000..3f86fa3c6d Binary files /dev/null and b/Items/Weapons/TriactisTruePaladinianMageHammerofMight.png differ diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs new file mode 100644 index 0000000000..1356b58f1c --- /dev/null +++ b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.png b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.png new file mode 100644 index 0000000000..3f86fa3c6d Binary files /dev/null and b/Items/Weapons/TriactisTruePaladinianMageHammerofMightMelee.png differ diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs new file mode 100644 index 0000000000..98ef6a87ed --- /dev/null +++ b/Items/Weapons/Trinity.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/Weapons/Trinity.png b/Items/Weapons/Trinity.png new file mode 100644 index 0000000000..5f511ea1aa Binary files /dev/null and b/Items/Weapons/Trinity.png differ diff --git a/Items/Weapons/Triploon.cs b/Items/Weapons/Triploon.cs new file mode 100644 index 0000000000..18c4cda80b --- /dev/null +++ b/Items/Weapons/Triploon.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Triploon.png b/Items/Weapons/Triploon.png new file mode 100644 index 0000000000..6c981a9d77 Binary files /dev/null and b/Items/Weapons/Triploon.png differ diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs new file mode 100644 index 0000000000..70d8a3b494 --- /dev/null +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/Weapons/TrueArkoftheAncients.png b/Items/Weapons/TrueArkoftheAncients.png new file mode 100644 index 0000000000..9bcb7bd2f8 Binary files /dev/null and b/Items/Weapons/TrueArkoftheAncients.png differ diff --git a/Items/Weapons/TrueBiomeBlade.cs b/Items/Weapons/TrueBiomeBlade.cs new file mode 100644 index 0000000000..f02f6d2464 --- /dev/null +++ b/Items/Weapons/TrueBiomeBlade.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/Weapons/TrueBiomeBlade.png b/Items/Weapons/TrueBiomeBlade.png new file mode 100644 index 0000000000..8008a39998 Binary files /dev/null and b/Items/Weapons/TrueBiomeBlade.png differ diff --git a/Items/Weapons/TrueBloodyEdge.cs b/Items/Weapons/TrueBloodyEdge.cs new file mode 100644 index 0000000000..81f6c622ca --- /dev/null +++ b/Items/Weapons/TrueBloodyEdge.cs @@ -0,0 +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); + } + } + } +} diff --git a/Items/Weapons/TrueBloodyEdge.png b/Items/Weapons/TrueBloodyEdge.png new file mode 100644 index 0000000000..c83b981a18 Binary files /dev/null and b/Items/Weapons/TrueBloodyEdge.png differ diff --git a/Items/Weapons/TrueCausticEdge.cs b/Items/Weapons/TrueCausticEdge.cs new file mode 100644 index 0000000000..fc6ae9e340 --- /dev/null +++ b/Items/Weapons/TrueCausticEdge.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/TrueCausticEdge.png b/Items/Weapons/TrueCausticEdge.png new file mode 100644 index 0000000000..e0f9719138 Binary files /dev/null and b/Items/Weapons/TrueCausticEdge.png differ diff --git a/Items/Weapons/TrueExcaliburShortsword.cs b/Items/Weapons/TrueExcaliburShortsword.cs new file mode 100644 index 0000000000..664403e702 --- /dev/null +++ b/Items/Weapons/TrueExcaliburShortsword.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } +}} diff --git a/Items/Weapons/TrueExcaliburShortsword.png b/Items/Weapons/TrueExcaliburShortsword.png new file mode 100644 index 0000000000..d7915266d6 Binary files /dev/null and b/Items/Weapons/TrueExcaliburShortsword.png differ diff --git a/Items/Weapons/TrueForbiddenOathblade.cs b/Items/Weapons/TrueForbiddenOathblade.cs new file mode 100644 index 0000000000..40cdf0e93f --- /dev/null +++ b/Items/Weapons/TrueForbiddenOathblade.cs @@ -0,0 +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 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); + } + } +} diff --git a/Items/Weapons/TrueForbiddenOathblade.png b/Items/Weapons/TrueForbiddenOathblade.png new file mode 100644 index 0000000000..309864b6ae Binary files /dev/null and b/Items/Weapons/TrueForbiddenOathblade.png differ diff --git a/Items/Weapons/TrueNightsStabber.cs b/Items/Weapons/TrueNightsStabber.cs new file mode 100644 index 0000000000..c119190dd7 --- /dev/null +++ b/Items/Weapons/TrueNightsStabber.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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); + } + } +}} diff --git a/Items/Weapons/TrueNightsStabber.png b/Items/Weapons/TrueNightsStabber.png new file mode 100644 index 0000000000..18179a1f39 Binary files /dev/null and b/Items/Weapons/TrueNightsStabber.png differ diff --git a/Items/Weapons/TruePaladinsHammer.cs b/Items/Weapons/TruePaladinsHammer.cs new file mode 100644 index 0000000000..52f0be1e19 --- /dev/null +++ b/Items/Weapons/TruePaladinsHammer.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TruePaladinsHammer.png b/Items/Weapons/TruePaladinsHammer.png new file mode 100644 index 0000000000..b527ef88b6 Binary files /dev/null and b/Items/Weapons/TruePaladinsHammer.png differ diff --git a/Items/Weapons/TruePaladinsHammerMelee.cs b/Items/Weapons/TruePaladinsHammerMelee.cs new file mode 100644 index 0000000000..32836ab0c8 --- /dev/null +++ b/Items/Weapons/TruePaladinsHammerMelee.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/TruePaladinsHammerMelee.png b/Items/Weapons/TruePaladinsHammerMelee.png new file mode 100644 index 0000000000..b527ef88b6 Binary files /dev/null and b/Items/Weapons/TruePaladinsHammerMelee.png differ diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.cs b/Items/Weapons/TrueTyrantYharimsUltisword.cs new file mode 100644 index 0000000000..52fa981ce7 --- /dev/null +++ b/Items/Weapons/TrueTyrantYharimsUltisword.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.png b/Items/Weapons/TrueTyrantYharimsUltisword.png new file mode 100644 index 0000000000..76e2714988 Binary files /dev/null and b/Items/Weapons/TrueTyrantYharimsUltisword.png differ diff --git a/Items/Weapons/TyrantYharimsUltisword.cs b/Items/Weapons/TyrantYharimsUltisword.cs new file mode 100644 index 0000000000..815f909f66 --- /dev/null +++ b/Items/Weapons/TyrantYharimsUltisword.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/TyrantYharimsUltisword.png b/Items/Weapons/TyrantYharimsUltisword.png new file mode 100644 index 0000000000..fbeea535c9 Binary files /dev/null and b/Items/Weapons/TyrantYharimsUltisword.png differ diff --git a/Items/Weapons/UHFMurasama.png b/Items/Weapons/UHFMurasama.png new file mode 100644 index 0000000000..f8054f7eaf Binary files /dev/null and b/Items/Weapons/UHFMurasama.png differ diff --git a/Items/Weapons/UltraLiquidator.cs b/Items/Weapons/UltraLiquidator.cs new file mode 100644 index 0000000000..33f8ca413a --- /dev/null +++ b/Items/Weapons/UltraLiquidator.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class UltraLiquidator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultra Liquidator"); + Tooltip.SetDefault("Summons liquidation blades\n" + + "The blades inflict ichor, cursed inferno, on fire, and frostburn"); + 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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/UltraLiquidator.png b/Items/Weapons/UltraLiquidator.png new file mode 100644 index 0000000000..1b177e9c56 Binary files /dev/null and b/Items/Weapons/UltraLiquidator.png differ diff --git a/Items/Weapons/UrchinSpear.cs b/Items/Weapons/UrchinSpear.cs new file mode 100644 index 0000000000..4b9e7c0a84 --- /dev/null +++ b/Items/Weapons/UrchinSpear.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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(); + } +}} diff --git a/Items/Weapons/UrchinSpear.png b/Items/Weapons/UrchinSpear.png new file mode 100644 index 0000000000..fd210ae426 Binary files /dev/null and b/Items/Weapons/UrchinSpear.png differ diff --git a/Items/Weapons/UrchinStinger.cs b/Items/Weapons/UrchinStinger.cs new file mode 100644 index 0000000000..c5f9122579 --- /dev/null +++ b/Items/Weapons/UrchinStinger.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } + } +} diff --git a/Items/Weapons/UrchinStinger.png b/Items/Weapons/UrchinStinger.png new file mode 100644 index 0000000000..a5c38c11b9 Binary files /dev/null and b/Items/Weapons/UrchinStinger.png differ diff --git a/Items/Weapons/VanquisherArrow.cs b/Items/Weapons/VanquisherArrow.cs new file mode 100644 index 0000000000..f0919eab9a --- /dev/null +++ b/Items/Weapons/VanquisherArrow.cs @@ -0,0 +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 + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vanquisher Arrow"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/VanquisherArrow.png b/Items/Weapons/VanquisherArrow.png new file mode 100644 index 0000000000..9ef16584e5 Binary files /dev/null and b/Items/Weapons/VanquisherArrow.png differ diff --git a/Items/Weapons/Vehemenc.cs b/Items/Weapons/Vehemenc.cs new file mode 100644 index 0000000000..45ebe2efc5 --- /dev/null +++ b/Items/Weapons/Vehemenc.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Vehemenc.png b/Items/Weapons/Vehemenc.png new file mode 100644 index 0000000000..20907b2bda Binary files /dev/null and b/Items/Weapons/Vehemenc.png differ diff --git a/Items/Weapons/VenusianTrident.cs b/Items/Weapons/VenusianTrident.cs new file mode 100644 index 0000000000..bad61334a5 --- /dev/null +++ b/Items/Weapons/VenusianTrident.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/VenusianTrident.png b/Items/Weapons/VenusianTrident.png new file mode 100644 index 0000000000..94ac16dcf8 Binary files /dev/null and b/Items/Weapons/VenusianTrident.png differ diff --git a/Items/Weapons/Verdant.cs b/Items/Weapons/Verdant.cs new file mode 100644 index 0000000000..635d64bf4e --- /dev/null +++ b/Items/Weapons/Verdant.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Verdant.png b/Items/Weapons/Verdant.png new file mode 100644 index 0000000000..f7a926b2c6 Binary files /dev/null and b/Items/Weapons/Verdant.png differ diff --git a/Items/Weapons/VeriumBullet.cs b/Items/Weapons/VeriumBullet.cs new file mode 100644 index 0000000000..4a94878856 --- /dev/null +++ b/Items/Weapons/VeriumBullet.cs @@ -0,0 +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 + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/VeriumBullet.png b/Items/Weapons/VeriumBullet.png new file mode 100644 index 0000000000..4019e0cf13 Binary files /dev/null and b/Items/Weapons/VeriumBullet.png differ diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs new file mode 100644 index 0000000000..75cfdbc422 --- /dev/null +++ b/Items/Weapons/Vesuvius.cs @@ -0,0 +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 + { + 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" + + "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; + } + } + } +} diff --git a/Items/Weapons/Vesuvius.png b/Items/Weapons/Vesuvius.png new file mode 100644 index 0000000000..3a537edec9 Binary files /dev/null and b/Items/Weapons/Vesuvius.png differ diff --git a/Items/Weapons/Viscera.cs b/Items/Weapons/Viscera.cs new file mode 100644 index 0000000000..3d58804085 --- /dev/null +++ b/Items/Weapons/Viscera.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Viscera.png b/Items/Weapons/Viscera.png new file mode 100644 index 0000000000..350b6cf88f Binary files /dev/null and b/Items/Weapons/Viscera.png differ diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs new file mode 100644 index 0000000000..29d9690c91 --- /dev/null +++ b/Items/Weapons/VividClarity.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class VividClarity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vivid Clarity"); + Tooltip.SetDefault("Fires 3 beams of elemental energy near the mouse cursor that bounce on tile hits\n" + + "These beams split into more beams when enemies are near\n" + + "The more enemies and tiles the beams hit/pierce the more damage they do"); + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/VividClarity.png b/Items/Weapons/VividClarity.png new file mode 100644 index 0000000000..a09e59afd7 Binary files /dev/null and b/Items/Weapons/VividClarity.png differ diff --git a/Items/Weapons/Vortexpopper.cs b/Items/Weapons/Vortexpopper.cs new file mode 100644 index 0000000000..356483b734 --- /dev/null +++ b/Items/Weapons/Vortexpopper.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Vortexpopper.png b/Items/Weapons/Vortexpopper.png new file mode 100644 index 0000000000..2b11e8c1a6 Binary files /dev/null and b/Items/Weapons/Vortexpopper.png differ diff --git a/Items/Weapons/Waraxe.cs b/Items/Weapons/Waraxe.cs new file mode 100644 index 0000000000..ebdc497da8 --- /dev/null +++ b/Items/Weapons/Waraxe.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Waraxe.png b/Items/Weapons/Waraxe.png new file mode 100644 index 0000000000..48a54ef6ed Binary files /dev/null and b/Items/Weapons/Waraxe.png differ diff --git a/Items/Weapons/Warblade.cs b/Items/Weapons/Warblade.cs new file mode 100644 index 0000000000..802abf6145 --- /dev/null +++ b/Items/Weapons/Warblade.cs @@ -0,0 +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 +{ + 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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Warblade.png b/Items/Weapons/Warblade.png new file mode 100644 index 0000000000..79092affc9 Binary files /dev/null and b/Items/Weapons/Warblade.png differ diff --git a/Items/Weapons/WindBlade.cs b/Items/Weapons/WindBlade.cs new file mode 100644 index 0000000000..28e9bcdc3e --- /dev/null +++ b/Items/Weapons/WindBlade.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +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/WindBlade.png b/Items/Weapons/WindBlade.png new file mode 100644 index 0000000000..b1a15e648d Binary files /dev/null and b/Items/Weapons/WindBlade.png differ diff --git a/Items/Weapons/Wingman.cs b/Items/Weapons/Wingman.cs new file mode 100644 index 0000000000..cb65677da9 --- /dev/null +++ b/Items/Weapons/Wingman.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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/Wingman.png b/Items/Weapons/Wingman.png new file mode 100644 index 0000000000..05e9fe8993 Binary files /dev/null and b/Items/Weapons/Wingman.png differ diff --git a/Items/Weapons/WrathoftheAncients.cs b/Items/Weapons/WrathoftheAncients.cs new file mode 100644 index 0000000000..f13c7cc0b2 --- /dev/null +++ b/Items/Weapons/WrathoftheAncients.cs @@ -0,0 +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 +{ + 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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/WrathoftheAncients.png b/Items/Weapons/WrathoftheAncients.png new file mode 100644 index 0000000000..e8eb08a7df Binary files /dev/null and b/Items/Weapons/WrathoftheAncients.png differ diff --git a/Items/Weapons/WulfrumBlade.cs b/Items/Weapons/WulfrumBlade.cs new file mode 100644 index 0000000000..1f2bf1fa2c --- /dev/null +++ b/Items/Weapons/WulfrumBlade.cs @@ -0,0 +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 +{ + 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(); + } +}} diff --git a/Items/Weapons/WulfrumBlade.png b/Items/Weapons/WulfrumBlade.png new file mode 100644 index 0000000000..d607dcf424 Binary files /dev/null and b/Items/Weapons/WulfrumBlade.png differ diff --git a/Items/Weapons/WulfrumBow.cs b/Items/Weapons/WulfrumBow.cs new file mode 100644 index 0000000000..8a7a171291 --- /dev/null +++ b/Items/Weapons/WulfrumBow.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +//using 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/WulfrumBow.png b/Items/Weapons/WulfrumBow.png new file mode 100644 index 0000000000..3cf54d70b3 Binary files /dev/null and b/Items/Weapons/WulfrumBow.png differ diff --git a/Items/Weapons/WulfrumKnife.cs b/Items/Weapons/WulfrumKnife.cs new file mode 100644 index 0000000000..14ec302569 --- /dev/null +++ b/Items/Weapons/WulfrumKnife.cs @@ -0,0 +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 + { + 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(); + } + } +} diff --git a/Items/Weapons/WulfrumKnife.png b/Items/Weapons/WulfrumKnife.png new file mode 100644 index 0000000000..aab1bf448c Binary files /dev/null and b/Items/Weapons/WulfrumKnife.png differ diff --git a/Items/Weapons/WulfrumStaff.cs b/Items/Weapons/WulfrumStaff.cs new file mode 100644 index 0000000000..4fd817efd0 --- /dev/null +++ b/Items/Weapons/WulfrumStaff.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/WulfrumStaff.png b/Items/Weapons/WulfrumStaff.png new file mode 100644 index 0000000000..6c20e25a5c Binary files /dev/null and b/Items/Weapons/WulfrumStaff.png differ diff --git a/Items/Weapons/XerocPitchfork.cs b/Items/Weapons/XerocPitchfork.cs new file mode 100644 index 0000000000..9a82f76875 --- /dev/null +++ b/Items/Weapons/XerocPitchfork.cs @@ -0,0 +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(); + } + } +} diff --git a/Items/Weapons/XerocPitchfork.png b/Items/Weapons/XerocPitchfork.png new file mode 100644 index 0000000000..6b1f401a25 Binary files /dev/null and b/Items/Weapons/XerocPitchfork.png differ diff --git a/Items/Weapons/XerocsGreatsword.cs b/Items/Weapons/XerocsGreatsword.cs new file mode 100644 index 0000000000..b491df3b16 --- /dev/null +++ b/Items/Weapons/XerocsGreatsword.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/XerocsGreatsword.png b/Items/Weapons/XerocsGreatsword.png new file mode 100644 index 0000000000..48fe75ebe6 Binary files /dev/null and b/Items/Weapons/XerocsGreatsword.png differ diff --git a/Items/Weapons/YharimsCrystal.cs b/Items/Weapons/YharimsCrystal.cs new file mode 100644 index 0000000000..c2fd2990d4 --- /dev/null +++ b/Items/Weapons/YharimsCrystal.cs @@ -0,0 +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 YharimsCrystal : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Crystal"); + Tooltip.SetDefault("Fires a beam of complete destruction\n" + + "Only those that are worthy can use this item before Yharon is defeated"); + } + + public override void SetDefaults() + { + item.damage = 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/YharimsCrystal.png b/Items/Weapons/YharimsCrystal.png new file mode 100644 index 0000000000..3267ca4d7f Binary files /dev/null and b/Items/Weapons/YharimsCrystal.png differ diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs new file mode 100644 index 0000000000..07208657a6 --- /dev/null +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Yharon/AngryChickenStaff.png b/Items/Weapons/Yharon/AngryChickenStaff.png new file mode 100644 index 0000000000..93facfacd8 Binary files /dev/null and b/Items/Weapons/Yharon/AngryChickenStaff.png differ diff --git a/Items/Weapons/Yharon/ChickenCannon.cs b/Items/Weapons/Yharon/ChickenCannon.cs new file mode 100644 index 0000000000..40240db26c --- /dev/null +++ b/Items/Weapons/Yharon/ChickenCannon.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.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/ChickenCannon.png b/Items/Weapons/Yharon/ChickenCannon.png new file mode 100644 index 0000000000..76a8968d15 Binary files /dev/null and b/Items/Weapons/Yharon/ChickenCannon.png differ diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs new file mode 100644 index 0000000000..729d3c28f0 --- /dev/null +++ b/Items/Weapons/Yharon/DragonRage.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/DragonRage.png b/Items/Weapons/Yharon/DragonRage.png new file mode 100644 index 0000000000..73581f3d6e Binary files /dev/null and b/Items/Weapons/Yharon/DragonRage.png differ diff --git a/Items/Weapons/Yharon/DragonsBreath.cs b/Items/Weapons/Yharon/DragonsBreath.cs new file mode 100644 index 0000000000..3ea0a939ae --- /dev/null +++ b/Items/Weapons/Yharon/DragonsBreath.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Yharon/DragonsBreath.png b/Items/Weapons/Yharon/DragonsBreath.png new file mode 100644 index 0000000000..4bd28036b5 Binary files /dev/null and b/Items/Weapons/Yharon/DragonsBreath.png differ diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs new file mode 100644 index 0000000000..83e0e8f848 --- /dev/null +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs @@ -0,0 +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 +{ + 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; + } +}} \ No newline at end of file diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.png b/Items/Weapons/Yharon/PhoenixFlameBarrage.png new file mode 100644 index 0000000000..e3cad4c614 Binary files /dev/null and b/Items/Weapons/Yharon/PhoenixFlameBarrage.png differ diff --git a/Items/Weapons/Yharon/ProfanedTrident.cs b/Items/Weapons/Yharon/ProfanedTrident.cs new file mode 100644 index 0000000000..2c0a00d1b2 --- /dev/null +++ b/Items/Weapons/Yharon/ProfanedTrident.cs @@ -0,0 +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); + } + } + } + } +} diff --git a/Items/Weapons/Yharon/ProfanedTrident.png b/Items/Weapons/Yharon/ProfanedTrident.png new file mode 100644 index 0000000000..77143ba0e5 Binary files /dev/null and b/Items/Weapons/Yharon/ProfanedTrident.png differ diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs new file mode 100644 index 0000000000..bc4c22d986 --- /dev/null +++ b/Items/Weapons/Yharon/TheBurningSky.cs @@ -0,0 +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); + } + } +} diff --git a/Items/Weapons/Yharon/TheBurningSky.png b/Items/Weapons/Yharon/TheBurningSky.png new file mode 100644 index 0000000000..06fe45b0e6 Binary files /dev/null and b/Items/Weapons/Yharon/TheBurningSky.png differ diff --git a/Items/Weapons/YinYo.cs b/Items/Weapons/YinYo.cs new file mode 100644 index 0000000000..18fff75021 --- /dev/null +++ b/Items/Weapons/YinYo.cs @@ -0,0 +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 +{ + 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(); + } +}} \ No newline at end of file diff --git a/Items/Weapons/YinYo.png b/Items/Weapons/YinYo.png new file mode 100644 index 0000000000..a00eb19a83 Binary files /dev/null and b/Items/Weapons/YinYo.png differ diff --git a/Items/Weapons/Zapper.cs b/Items/Weapons/Zapper.cs new file mode 100644 index 0000000000..1b8e9d24fb --- /dev/null +++ b/Items/Weapons/Zapper.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.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/Weapons/Zapper.png b/Items/Weapons/Zapper.png new file mode 100644 index 0000000000..a9b74337c7 Binary files /dev/null and b/Items/Weapons/Zapper.png differ diff --git a/Items/WulfrumAxe.cs b/Items/WulfrumAxe.cs new file mode 100644 index 0000000000..d0b18e7918 --- /dev/null +++ b/Items/WulfrumAxe.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/WulfrumAxe.png b/Items/WulfrumAxe.png new file mode 100644 index 0000000000..edac3515c0 Binary files /dev/null and b/Items/WulfrumAxe.png differ diff --git a/Items/WulfrumHammer.cs b/Items/WulfrumHammer.cs new file mode 100644 index 0000000000..b5ec4f5734 --- /dev/null +++ b/Items/WulfrumHammer.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/WulfrumHammer.png b/Items/WulfrumHammer.png new file mode 100644 index 0000000000..030ee2396b Binary files /dev/null and b/Items/WulfrumHammer.png differ diff --git a/Items/WulfrumPickaxe.cs b/Items/WulfrumPickaxe.cs new file mode 100644 index 0000000000..02dfe98e04 --- /dev/null +++ b/Items/WulfrumPickaxe.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + 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/WulfrumPickaxe.png b/Items/WulfrumPickaxe.png new file mode 100644 index 0000000000..dcb359dd90 Binary files /dev/null and b/Items/WulfrumPickaxe.png differ diff --git a/Items/WulfrumShard.cs b/Items/WulfrumShard.cs new file mode 100644 index 0000000000..3d67c4168b --- /dev/null +++ b/Items/WulfrumShard.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Items/WulfrumShard.png b/Items/WulfrumShard.png new file mode 100644 index 0000000000..ffe827c29e Binary files /dev/null and b/Items/WulfrumShard.png differ diff --git a/Items/YharimsStimulants.cs b/Items/YharimsStimulants.cs new file mode 100644 index 0000000000..7a5cb73b30 --- /dev/null +++ b/Items/YharimsStimulants.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/YharimsStimulants.png b/Items/YharimsStimulants.png new file mode 100644 index 0000000000..632fff4256 Binary files /dev/null and b/Items/YharimsStimulants.png differ diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs new file mode 100644 index 0000000000..1e6764b9a9 --- /dev/null +++ b/Items/Yharon/ChickenEgg.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/Yharon/ChickenEgg.png b/Items/Yharon/ChickenEgg.png new file mode 100644 index 0000000000..ab48454ce9 Binary files /dev/null and b/Items/Yharon/ChickenEgg.png differ diff --git a/Items/Yharon/HellcasterFragment.cs b/Items/Yharon/HellcasterFragment.cs new file mode 100644 index 0000000000..c9866f26fa --- /dev/null +++ b/Items/Yharon/HellcasterFragment.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Items/Yharon/HellcasterFragment.png b/Items/Yharon/HellcasterFragment.png new file mode 100644 index 0000000000..5fc98f2873 Binary files /dev/null and b/Items/Yharon/HellcasterFragment.png differ diff --git a/Items/Yharon/YharimsGift.cs b/Items/Yharon/YharimsGift.cs new file mode 100644 index 0000000000..91509ab89b --- /dev/null +++ b/Items/Yharon/YharimsGift.cs @@ -0,0 +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; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/Yharon/YharimsGift.png b/Items/Yharon/YharimsGift.png new file mode 100644 index 0000000000..2908d17e8a Binary files /dev/null and b/Items/Yharon/YharimsGift.png differ diff --git a/Items/Yharon/YharonBag.cs b/Items/Yharon/YharonBag.cs new file mode 100644 index 0000000000..36c55272d4 --- /dev/null +++ b/Items/Yharon/YharonBag.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Items/Yharon/YharonBag.png b/Items/Yharon/YharonBag.png new file mode 100644 index 0000000000..c6bce143eb Binary files /dev/null and b/Items/Yharon/YharonBag.png differ diff --git a/Items/ZenPotion.cs b/Items/ZenPotion.cs new file mode 100644 index 0000000000..4ebd41431f --- /dev/null +++ b/Items/ZenPotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/ZenPotion.png b/Items/ZenPotion.png new file mode 100644 index 0000000000..41e4e11d8f Binary files /dev/null and b/Items/ZenPotion.png differ diff --git a/Items/ZergPotion.cs b/Items/ZergPotion.cs new file mode 100644 index 0000000000..4433fa73bf --- /dev/null +++ b/Items/ZergPotion.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Items/ZergPotion.png b/Items/ZergPotion.png new file mode 100644 index 0000000000..fae8690dab Binary files /dev/null and b/Items/ZergPotion.png differ diff --git a/MiscImplementation/BezierCurve.cs b/MiscImplementation/BezierCurve.cs new file mode 100644 index 0000000000..313d2a817e --- /dev/null +++ b/MiscImplementation/BezierCurve.cs @@ -0,0 +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); + } + } + } +} diff --git a/MiscImplementation/Circle.cs b/MiscImplementation/Circle.cs new file mode 100644 index 0000000000..a029ffa93a --- /dev/null +++ b/MiscImplementation/Circle.cs @@ -0,0 +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; + } + } +} diff --git a/ModSupport.cs b/ModSupport.cs new file mode 100644 index 0000000000..31af871a21 --- /dev/null +++ b/ModSupport.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticParasite.cs b/NPCs/AbyssNPCs/AquaticParasite.cs new file mode 100644 index 0000000000..f48d8a78b7 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticParasite.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticParasite.png b/NPCs/AbyssNPCs/AquaticParasite.png new file mode 100644 index 0000000000..a7b43c6845 Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticParasite.png differ diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs new file mode 100644 index 0000000000..d0ff52c0a4 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.png b/NPCs/AbyssNPCs/AquaticScourgeBody.png new file mode 100644 index 0000000000..a26e032ff9 Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticScourgeBody.png differ diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs new file mode 100644 index 0000000000..36dc3e320f --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.png b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.png new file mode 100644 index 0000000000..7a048b7a6a Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.png differ diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs new file mode 100644 index 0000000000..5637012869 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.png b/NPCs/AbyssNPCs/AquaticScourgeHead.png new file mode 100644 index 0000000000..05dcf667a0 Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticScourgeHead.png differ diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead_Head_Boss.png b/NPCs/AbyssNPCs/AquaticScourgeHead_Head_Boss.png new file mode 100644 index 0000000000..720938fafa Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticScourgeHead_Head_Boss.png differ diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs new file mode 100644 index 0000000000..7269eb81c1 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.png b/NPCs/AbyssNPCs/AquaticScourgeTail.png new file mode 100644 index 0000000000..93fe7cd462 Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticScourgeTail.png differ diff --git a/NPCs/AbyssNPCs/AquaticSeekerBody.cs b/NPCs/AbyssNPCs/AquaticSeekerBody.cs new file mode 100644 index 0000000000..70b5761aba --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticSeekerBody.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticSeekerBody.png b/NPCs/AbyssNPCs/AquaticSeekerBody.png new file mode 100644 index 0000000000..fb6924d41a Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticSeekerBody.png differ diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs new file mode 100644 index 0000000000..a8e148d4b3 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.png b/NPCs/AbyssNPCs/AquaticSeekerHead.png new file mode 100644 index 0000000000..ed16485e57 Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticSeekerHead.png differ diff --git a/NPCs/AbyssNPCs/AquaticSeekerTail.cs b/NPCs/AbyssNPCs/AquaticSeekerTail.cs new file mode 100644 index 0000000000..caa4297927 --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticSeekerTail.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticSeekerTail.png b/NPCs/AbyssNPCs/AquaticSeekerTail.png new file mode 100644 index 0000000000..d5df0b206a Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticSeekerTail.png differ diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs new file mode 100644 index 0000000000..fa9c33315d --- /dev/null +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/AquaticUrchin.png b/NPCs/AbyssNPCs/AquaticUrchin.png new file mode 100644 index 0000000000..ccf814530b Binary files /dev/null and b/NPCs/AbyssNPCs/AquaticUrchin.png differ diff --git a/NPCs/AbyssNPCs/Bloatfish.cs b/NPCs/AbyssNPCs/Bloatfish.cs new file mode 100644 index 0000000000..644890b94b --- /dev/null +++ b/NPCs/AbyssNPCs/Bloatfish.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Bloatfish.png b/NPCs/AbyssNPCs/Bloatfish.png new file mode 100644 index 0000000000..dac4ff004e Binary files /dev/null and b/NPCs/AbyssNPCs/Bloatfish.png differ diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs new file mode 100644 index 0000000000..7356c8e43d --- /dev/null +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/BobbitWormHead.png b/NPCs/AbyssNPCs/BobbitWormHead.png new file mode 100644 index 0000000000..5109108e00 Binary files /dev/null and b/NPCs/AbyssNPCs/BobbitWormHead.png differ diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.cs b/NPCs/AbyssNPCs/BobbitWormSegment.cs new file mode 100644 index 0000000000..66eeecfc99 --- /dev/null +++ b/NPCs/AbyssNPCs/BobbitWormSegment.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.png b/NPCs/AbyssNPCs/BobbitWormSegment.png new file mode 100644 index 0000000000..8a07013302 Binary files /dev/null and b/NPCs/AbyssNPCs/BobbitWormSegment.png differ diff --git a/NPCs/AbyssNPCs/BoxJellyfish.cs b/NPCs/AbyssNPCs/BoxJellyfish.cs new file mode 100644 index 0000000000..a6dba1ff76 --- /dev/null +++ b/NPCs/AbyssNPCs/BoxJellyfish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/BoxJellyfish.png b/NPCs/AbyssNPCs/BoxJellyfish.png new file mode 100644 index 0000000000..857d40b0db Binary files /dev/null and b/NPCs/AbyssNPCs/BoxJellyfish.png differ diff --git a/NPCs/AbyssNPCs/Catfish.cs b/NPCs/AbyssNPCs/Catfish.cs new file mode 100644 index 0000000000..eed9529df3 --- /dev/null +++ b/NPCs/AbyssNPCs/Catfish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Catfish.png b/NPCs/AbyssNPCs/Catfish.png new file mode 100644 index 0000000000..f54a966671 Binary files /dev/null and b/NPCs/AbyssNPCs/Catfish.png differ diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs new file mode 100644 index 0000000000..43d8b9d177 --- /dev/null +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/ColossalSquid.png b/NPCs/AbyssNPCs/ColossalSquid.png new file mode 100644 index 0000000000..19cd0d9cd9 Binary files /dev/null and b/NPCs/AbyssNPCs/ColossalSquid.png differ diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs new file mode 100644 index 0000000000..3ff805ba64 --- /dev/null +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Cuttlefish.png b/NPCs/AbyssNPCs/Cuttlefish.png new file mode 100644 index 0000000000..a7aace459c Binary files /dev/null and b/NPCs/AbyssNPCs/Cuttlefish.png differ diff --git a/NPCs/AbyssNPCs/CuttlefishGlow.png b/NPCs/AbyssNPCs/CuttlefishGlow.png new file mode 100644 index 0000000000..bc1570b0e7 Binary files /dev/null and b/NPCs/AbyssNPCs/CuttlefishGlow.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBody.cs b/NPCs/AbyssNPCs/EidolonWyrmBody.cs new file mode 100644 index 0000000000..164205eade --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmBody.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmBody.png b/NPCs/AbyssNPCs/EidolonWyrmBody.png new file mode 100644 index 0000000000..cbf4889e6b Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBody.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs new file mode 100644 index 0000000000..be42913678 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.png b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.png new file mode 100644 index 0000000000..cf218144b8 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltGlowHuge.png b/NPCs/AbyssNPCs/EidolonWyrmBodyAltGlowHuge.png new file mode 100644 index 0000000000..823fdf06dc Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBodyAltGlowHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs new file mode 100644 index 0000000000..387ffdbb91 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.png b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.png new file mode 100644 index 0000000000..526d8d1b5e Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyGlowHuge.png b/NPCs/AbyssNPCs/EidolonWyrmBodyGlowHuge.png new file mode 100644 index 0000000000..e6d02b2695 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBodyGlowHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs new file mode 100644 index 0000000000..1641d3cf54 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.png b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.png new file mode 100644 index 0000000000..12535f0096 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs new file mode 100644 index 0000000000..7883a565e4 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.png b/NPCs/AbyssNPCs/EidolonWyrmHead.png new file mode 100644 index 0000000000..83650110c5 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmHead.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadGlow.png b/NPCs/AbyssNPCs/EidolonWyrmHeadGlow.png new file mode 100644 index 0000000000..bdd0d41b39 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmHeadGlow.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge.png b/NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge.png new file mode 100644 index 0000000000..dec1bd0465 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs new file mode 100644 index 0000000000..f19704bad6 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.png b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.png new file mode 100644 index 0000000000..3f6f3005fe Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmTail.cs b/NPCs/AbyssNPCs/EidolonWyrmTail.cs new file mode 100644 index 0000000000..c6471db0e0 --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmTail.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmTail.png b/NPCs/AbyssNPCs/EidolonWyrmTail.png new file mode 100644 index 0000000000..04f8f26638 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmTail.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailGlowHuge.png b/NPCs/AbyssNPCs/EidolonWyrmTailGlowHuge.png new file mode 100644 index 0000000000..7de2777e6d Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmTailGlowHuge.png differ diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs new file mode 100644 index 0000000000..11301d83ce --- /dev/null +++ b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.png b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.png new file mode 100644 index 0000000000..a13e9eebb0 Binary files /dev/null and b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.png differ diff --git a/NPCs/AbyssNPCs/Flounder.cs b/NPCs/AbyssNPCs/Flounder.cs new file mode 100644 index 0000000000..3deaffe9f7 --- /dev/null +++ b/NPCs/AbyssNPCs/Flounder.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Flounder.png b/NPCs/AbyssNPCs/Flounder.png new file mode 100644 index 0000000000..cb19a4ffb9 Binary files /dev/null and b/NPCs/AbyssNPCs/Flounder.png differ diff --git a/NPCs/AbyssNPCs/Frogfish.cs b/NPCs/AbyssNPCs/Frogfish.cs new file mode 100644 index 0000000000..adf8bf64fc --- /dev/null +++ b/NPCs/AbyssNPCs/Frogfish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Frogfish.png b/NPCs/AbyssNPCs/Frogfish.png new file mode 100644 index 0000000000..ad203ad598 Binary files /dev/null and b/NPCs/AbyssNPCs/Frogfish.png differ diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs new file mode 100644 index 0000000000..cfbf7a419f --- /dev/null +++ b/NPCs/AbyssNPCs/GiantSquid.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GiantSquid.png b/NPCs/AbyssNPCs/GiantSquid.png new file mode 100644 index 0000000000..9f94d8ebb3 Binary files /dev/null and b/NPCs/AbyssNPCs/GiantSquid.png differ diff --git a/NPCs/AbyssNPCs/GiantSquidGlow.png b/NPCs/AbyssNPCs/GiantSquidGlow.png new file mode 100644 index 0000000000..2eebc3b884 Binary files /dev/null and b/NPCs/AbyssNPCs/GiantSquidGlow.png differ diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs new file mode 100644 index 0000000000..5e48fd2a77 --- /dev/null +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Gnasher.png b/NPCs/AbyssNPCs/Gnasher.png new file mode 100644 index 0000000000..547a3255c0 Binary files /dev/null and b/NPCs/AbyssNPCs/Gnasher.png differ diff --git a/NPCs/AbyssNPCs/GulperEelBody.cs b/NPCs/AbyssNPCs/GulperEelBody.cs new file mode 100644 index 0000000000..c28ace7d37 --- /dev/null +++ b/NPCs/AbyssNPCs/GulperEelBody.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelBody.png b/NPCs/AbyssNPCs/GulperEelBody.png new file mode 100644 index 0000000000..02a0ee98da Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelBody.png differ diff --git a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs new file mode 100644 index 0000000000..7d619c69d5 --- /dev/null +++ b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelBodyAlt.png b/NPCs/AbyssNPCs/GulperEelBodyAlt.png new file mode 100644 index 0000000000..1b715e703f Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelBodyAlt.png differ diff --git a/NPCs/AbyssNPCs/GulperEelBodyAltGlow.png b/NPCs/AbyssNPCs/GulperEelBodyAltGlow.png new file mode 100644 index 0000000000..106da36968 Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelBodyAltGlow.png differ diff --git a/NPCs/AbyssNPCs/GulperEelBodyGlow.png b/NPCs/AbyssNPCs/GulperEelBodyGlow.png new file mode 100644 index 0000000000..32fdd42499 Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelBodyGlow.png differ diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs new file mode 100644 index 0000000000..3185d33426 --- /dev/null +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelHead.png b/NPCs/AbyssNPCs/GulperEelHead.png new file mode 100644 index 0000000000..00e25c1d75 Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelHead.png differ diff --git a/NPCs/AbyssNPCs/GulperEelHeadGlow.png b/NPCs/AbyssNPCs/GulperEelHeadGlow.png new file mode 100644 index 0000000000..10b965122b Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelHeadGlow.png differ diff --git a/NPCs/AbyssNPCs/GulperEelTail.cs b/NPCs/AbyssNPCs/GulperEelTail.cs new file mode 100644 index 0000000000..b55a0e045f --- /dev/null +++ b/NPCs/AbyssNPCs/GulperEelTail.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/GulperEelTail.png b/NPCs/AbyssNPCs/GulperEelTail.png new file mode 100644 index 0000000000..5ad140ba0a Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelTail.png differ diff --git a/NPCs/AbyssNPCs/GulperEelTailGlow.png b/NPCs/AbyssNPCs/GulperEelTailGlow.png new file mode 100644 index 0000000000..b7a15e8890 Binary files /dev/null and b/NPCs/AbyssNPCs/GulperEelTailGlow.png differ diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs new file mode 100644 index 0000000000..e04b7987eb --- /dev/null +++ b/NPCs/AbyssNPCs/Laserfish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Laserfish.png b/NPCs/AbyssNPCs/Laserfish.png new file mode 100644 index 0000000000..8793bbca56 Binary files /dev/null and b/NPCs/AbyssNPCs/Laserfish.png differ diff --git a/NPCs/AbyssNPCs/LaserfishGlow.png b/NPCs/AbyssNPCs/LaserfishGlow.png new file mode 100644 index 0000000000..c82666ae14 Binary files /dev/null and b/NPCs/AbyssNPCs/LaserfishGlow.png differ diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs new file mode 100644 index 0000000000..1c7d03df4f --- /dev/null +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/LuminousCorvina.png b/NPCs/AbyssNPCs/LuminousCorvina.png new file mode 100644 index 0000000000..c0ccf48697 Binary files /dev/null and b/NPCs/AbyssNPCs/LuminousCorvina.png differ diff --git a/NPCs/AbyssNPCs/LuminousCorvinaGlow.png b/NPCs/AbyssNPCs/LuminousCorvinaGlow.png new file mode 100644 index 0000000000..24e5bc93d5 Binary files /dev/null and b/NPCs/AbyssNPCs/LuminousCorvinaGlow.png differ diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs new file mode 100644 index 0000000000..85c09a1ff4 --- /dev/null +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/MantisShrimp.png b/NPCs/AbyssNPCs/MantisShrimp.png new file mode 100644 index 0000000000..4765f49de9 Binary files /dev/null and b/NPCs/AbyssNPCs/MantisShrimp.png differ diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs new file mode 100644 index 0000000000..b22b73ce64 --- /dev/null +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Mauler.png b/NPCs/AbyssNPCs/Mauler.png new file mode 100644 index 0000000000..82f0d8d771 Binary files /dev/null and b/NPCs/AbyssNPCs/Mauler.png differ diff --git a/NPCs/AbyssNPCs/MirageJelly.cs b/NPCs/AbyssNPCs/MirageJelly.cs new file mode 100644 index 0000000000..1ac0555ad8 --- /dev/null +++ b/NPCs/AbyssNPCs/MirageJelly.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/MirageJelly.png b/NPCs/AbyssNPCs/MirageJelly.png new file mode 100644 index 0000000000..9f9f9c6abf Binary files /dev/null and b/NPCs/AbyssNPCs/MirageJelly.png differ diff --git a/NPCs/AbyssNPCs/MirageJellyGlow.png b/NPCs/AbyssNPCs/MirageJellyGlow.png new file mode 100644 index 0000000000..f747588b36 Binary files /dev/null and b/NPCs/AbyssNPCs/MirageJellyGlow.png differ diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs new file mode 100644 index 0000000000..aaf3806c33 --- /dev/null +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/MorayEel.png b/NPCs/AbyssNPCs/MorayEel.png new file mode 100644 index 0000000000..e510a9cec2 Binary files /dev/null and b/NPCs/AbyssNPCs/MorayEel.png differ diff --git a/NPCs/AbyssNPCs/MorayEelGlow.png b/NPCs/AbyssNPCs/MorayEelGlow.png new file mode 100644 index 0000000000..57690ac74d Binary files /dev/null and b/NPCs/AbyssNPCs/MorayEelGlow.png differ diff --git a/NPCs/AbyssNPCs/OarfishBody.cs b/NPCs/AbyssNPCs/OarfishBody.cs new file mode 100644 index 0000000000..caa6c4555c --- /dev/null +++ b/NPCs/AbyssNPCs/OarfishBody.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/OarfishBody.png b/NPCs/AbyssNPCs/OarfishBody.png new file mode 100644 index 0000000000..f9a26728f1 Binary files /dev/null and b/NPCs/AbyssNPCs/OarfishBody.png differ diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs new file mode 100644 index 0000000000..c481cafedc --- /dev/null +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/OarfishHead.png b/NPCs/AbyssNPCs/OarfishHead.png new file mode 100644 index 0000000000..7b84864422 Binary files /dev/null and b/NPCs/AbyssNPCs/OarfishHead.png differ diff --git a/NPCs/AbyssNPCs/OarfishTail.cs b/NPCs/AbyssNPCs/OarfishTail.cs new file mode 100644 index 0000000000..dde2fa37a3 --- /dev/null +++ b/NPCs/AbyssNPCs/OarfishTail.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/OarfishTail.png b/NPCs/AbyssNPCs/OarfishTail.png new file mode 100644 index 0000000000..ae3f7d6e6e Binary files /dev/null and b/NPCs/AbyssNPCs/OarfishTail.png differ diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs new file mode 100644 index 0000000000..ea50d39575 --- /dev/null +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Reaper.png b/NPCs/AbyssNPCs/Reaper.png new file mode 100644 index 0000000000..3940a94380 Binary files /dev/null and b/NPCs/AbyssNPCs/Reaper.png differ diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs new file mode 100644 index 0000000000..52fbba09c2 --- /dev/null +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/SeaUrchin.png b/NPCs/AbyssNPCs/SeaUrchin.png new file mode 100644 index 0000000000..5123ef7337 Binary files /dev/null and b/NPCs/AbyssNPCs/SeaUrchin.png differ diff --git a/NPCs/AbyssNPCs/ToxicMinnow.cs b/NPCs/AbyssNPCs/ToxicMinnow.cs new file mode 100644 index 0000000000..9235aacdc5 --- /dev/null +++ b/NPCs/AbyssNPCs/ToxicMinnow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/ToxicMinnow.png b/NPCs/AbyssNPCs/ToxicMinnow.png new file mode 100644 index 0000000000..d073debf83 Binary files /dev/null and b/NPCs/AbyssNPCs/ToxicMinnow.png differ diff --git a/NPCs/AbyssNPCs/ToxicMinnowGlow.png b/NPCs/AbyssNPCs/ToxicMinnowGlow.png new file mode 100644 index 0000000000..1e56a9f309 Binary files /dev/null and b/NPCs/AbyssNPCs/ToxicMinnowGlow.png differ diff --git a/NPCs/AbyssNPCs/Trasher.cs b/NPCs/AbyssNPCs/Trasher.cs new file mode 100644 index 0000000000..5376ba9b66 --- /dev/null +++ b/NPCs/AbyssNPCs/Trasher.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Trasher.png b/NPCs/AbyssNPCs/Trasher.png new file mode 100644 index 0000000000..3b482dd2fb Binary files /dev/null and b/NPCs/AbyssNPCs/Trasher.png differ diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs new file mode 100644 index 0000000000..cf7b74d870 --- /dev/null +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/AbyssNPCs/Viperfish.png b/NPCs/AbyssNPCs/Viperfish.png new file mode 100644 index 0000000000..fbd1a610cf Binary files /dev/null and b/NPCs/AbyssNPCs/Viperfish.png differ diff --git a/NPCs/AbyssNPCs/ViperfishGlow.png b/NPCs/AbyssNPCs/ViperfishGlow.png new file mode 100644 index 0000000000..6f97e08cb9 Binary files /dev/null and b/NPCs/AbyssNPCs/ViperfishGlow.png differ diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs new file mode 100644 index 0000000000..a6c96beb88 --- /dev/null +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Astrageldon/Astrageldon.png b/NPCs/Astrageldon/Astrageldon.png new file mode 100644 index 0000000000..c368c12a85 Binary files /dev/null and b/NPCs/Astrageldon/Astrageldon.png differ diff --git a/NPCs/Astrageldon/AstrageldonGlow.png b/NPCs/Astrageldon/AstrageldonGlow.png new file mode 100644 index 0000000000..8cc03e4c11 Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonGlow.png differ diff --git a/NPCs/Astrageldon/AstrageldonJump.png b/NPCs/Astrageldon/AstrageldonJump.png new file mode 100644 index 0000000000..1fc6b4b90c Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonJump.png differ diff --git a/NPCs/Astrageldon/AstrageldonJumpGlow.png b/NPCs/Astrageldon/AstrageldonJumpGlow.png new file mode 100644 index 0000000000..664056a399 Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonJumpGlow.png differ diff --git a/NPCs/Astrageldon/AstrageldonRecharge.png b/NPCs/Astrageldon/AstrageldonRecharge.png new file mode 100644 index 0000000000..f4e6e76d4b Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonRecharge.png differ diff --git a/NPCs/Astrageldon/AstrageldonSlime.cs b/NPCs/Astrageldon/AstrageldonSlime.cs new file mode 100644 index 0000000000..b0ac58f0c3 --- /dev/null +++ b/NPCs/Astrageldon/AstrageldonSlime.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Astrageldon/AstrageldonSlime.png b/NPCs/Astrageldon/AstrageldonSlime.png new file mode 100644 index 0000000000..802f806c0e Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonSlime.png differ diff --git a/NPCs/Astrageldon/AstrageldonStomp.png b/NPCs/Astrageldon/AstrageldonStomp.png new file mode 100644 index 0000000000..741eff66d5 Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonStomp.png differ diff --git a/NPCs/Astrageldon/AstrageldonStompGlow.png b/NPCs/Astrageldon/AstrageldonStompGlow.png new file mode 100644 index 0000000000..2fa8a05961 Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonStompGlow.png differ diff --git a/NPCs/Astrageldon/AstrageldonWalk.png b/NPCs/Astrageldon/AstrageldonWalk.png new file mode 100644 index 0000000000..3d27148b8b Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonWalk.png differ diff --git a/NPCs/Astrageldon/AstrageldonWalkGlow.png b/NPCs/Astrageldon/AstrageldonWalkGlow.png new file mode 100644 index 0000000000..f4223a6315 Binary files /dev/null and b/NPCs/Astrageldon/AstrageldonWalkGlow.png differ diff --git a/NPCs/Astrageldon/Astrageldon_Head_Boss.png b/NPCs/Astrageldon/Astrageldon_Head_Boss.png new file mode 100644 index 0000000000..b194b9cacd Binary files /dev/null and b/NPCs/Astrageldon/Astrageldon_Head_Boss.png differ diff --git a/NPCs/AstralBiomeNPCs/AstralHead.cs b/NPCs/AstralBiomeNPCs/AstralHead.cs new file mode 100644 index 0000000000..627e365173 --- /dev/null +++ b/NPCs/AstralBiomeNPCs/AstralHead.cs @@ -0,0 +1,197 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.AstralBiomeNPCs +{ + public class AstralHead : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Head"); + } + + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.damage = 50; + npc.width = 22; //324 + npc.height = 22; //216 + npc.defense = 5; + npc.lifeMax = 60; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.4f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit3; + npc.DeathSound = SoundID.NPCDeath3; + npc.buffImmune[20] = true; + npc.buffImmune[24] = true; + npc.buffImmune[39] = true; + } + + public override void AI() + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 2f; + float num2 = 0.04f; + 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, 173, 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 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; + } + } + } + + 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")); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + 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) ? 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/AstralHead.png b/NPCs/AstralBiomeNPCs/AstralHead.png new file mode 100644 index 0000000000..3d27e39165 Binary files /dev/null and b/NPCs/AstralBiomeNPCs/AstralHead.png differ diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs new file mode 100644 index 0000000000..cff9cab2ee --- /dev/null +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -0,0 +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.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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.png b/NPCs/AstralBiomeNPCs/AstralProbe.png new file mode 100644 index 0000000000..5946aced1b Binary files /dev/null and b/NPCs/AstralBiomeNPCs/AstralProbe.png differ diff --git a/NPCs/AstralBiomeNPCs/AstralSlime.cs b/NPCs/AstralBiomeNPCs/AstralSlime.cs new file mode 100644 index 0000000000..0cf6f54966 --- /dev/null +++ b/NPCs/AstralBiomeNPCs/AstralSlime.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.AstralBiomeNPCs +{ + public class AstralSlime : ModNPC + { + public float spikeTimer = 60f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral 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 = 90; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 5, 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 && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; + 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("AstralShot"), 15, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } + } + } + else if (num16 < 200f && 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 = 4.5f / num16; + num14 *= num16; + num15 *= num16; + spikeTimer = 50f; + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("AstralShot"), 13, 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, 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 void NPCLoot() + { + if (npc.localAI[3] != 1f) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + 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) ? 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/AstralSlime.png b/NPCs/AstralBiomeNPCs/AstralSlime.png new file mode 100644 index 0000000000..bec7b9968c Binary files /dev/null and b/NPCs/AstralBiomeNPCs/AstralSlime.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs new file mode 100644 index 0000000000..7f18a48394 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusBody.png b/NPCs/AstrumDeus/AstrumDeusBody.png new file mode 100644 index 0000000000..0e5a7a10a6 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBody.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyAlt.png b/NPCs/AstrumDeus/AstrumDeusBodyAlt.png new file mode 100644 index 0000000000..d64a12033d Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyAlt.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs new file mode 100644 index 0000000000..68957b5abe --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -0,0 +1,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.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; + } + } + } + } + + 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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.png b/NPCs/AstrumDeus/AstrumDeusBodySpectral.png new file mode 100644 index 0000000000..0e5a7a10a6 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodySpectral.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs new file mode 100644 index 0000000000..89e9fd45df --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusHead.png b/NPCs/AstrumDeus/AstrumDeusHead.png new file mode 100644 index 0000000000..4d85c5f4ca Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHead.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs new file mode 100644 index 0000000000..aed19a4eb1 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -0,0 +1,460 @@ +using System; +using System.Collections.Generic; +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); + } + 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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.png b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.png new file mode 100644 index 0000000000..4d85c5f4ca Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral_Head_Boss.png b/NPCs/AstrumDeus/AstrumDeusHeadSpectral_Head_Boss.png new file mode 100644 index 0000000000..5ee888a4bb Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHeadSpectral_Head_Boss.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHead_Head_Boss.png b/NPCs/AstrumDeus/AstrumDeusHead_Head_Boss.png new file mode 100644 index 0000000000..5ee888a4bb Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHead_Head_Boss.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.cs b/NPCs/AstrumDeus/AstrumDeusProbe.cs new file mode 100644 index 0000000000..4e787f6005 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusProbe.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.png b/NPCs/AstrumDeus/AstrumDeusProbe.png new file mode 100644 index 0000000000..5946aced1b Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusProbe.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.cs b/NPCs/AstrumDeus/AstrumDeusProbe2.cs new file mode 100644 index 0000000000..352c0d2731 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusProbe2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.png b/NPCs/AstrumDeus/AstrumDeusProbe2.png new file mode 100644 index 0000000000..5946aced1b Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusProbe2.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs new file mode 100644 index 0000000000..e89a67f3e7 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.png b/NPCs/AstrumDeus/AstrumDeusProbe3.png new file mode 100644 index 0000000000..5946aced1b Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusProbe3.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs new file mode 100644 index 0000000000..26fc80a7a5 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusTail.png b/NPCs/AstrumDeus/AstrumDeusTail.png new file mode 100644 index 0000000000..720aca4a03 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusTail.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs new file mode 100644 index 0000000000..d95a02c9b4 --- /dev/null +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.png b/NPCs/AstrumDeus/AstrumDeusTailSpectral.png new file mode 100644 index 0000000000..720aca4a03 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusTailSpectral.png differ diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs new file mode 100644 index 0000000000..a430600888 --- /dev/null +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/BrimstoneWaifu/Brimling.png b/NPCs/BrimstoneWaifu/Brimling.png new file mode 100644 index 0000000000..5d278eb8a0 Binary files /dev/null and b/NPCs/BrimstoneWaifu/Brimling.png differ diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs new file mode 100644 index 0000000000..19d9af66e5 --- /dev/null +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.png b/NPCs/BrimstoneWaifu/BrimstoneElemental.png new file mode 100644 index 0000000000..ca32232ed1 Binary files /dev/null and b/NPCs/BrimstoneWaifu/BrimstoneElemental.png differ diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental_Head_Boss.png b/NPCs/BrimstoneWaifu/BrimstoneElemental_Head_Boss.png new file mode 100644 index 0000000000..d10a1d190a Binary files /dev/null and b/NPCs/BrimstoneWaifu/BrimstoneElemental_Head_Boss.png differ diff --git a/NPCs/Bumblefuck/Bumblefuck.cs b/NPCs/Bumblefuck/Bumblefuck.cs new file mode 100644 index 0000000000..872838c5e3 --- /dev/null +++ b/NPCs/Bumblefuck/Bumblefuck.cs @@ -0,0 +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")); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck.png b/NPCs/Bumblefuck/Bumblefuck.png new file mode 100644 index 0000000000..4b1e72a257 Binary files /dev/null and b/NPCs/Bumblefuck/Bumblefuck.png differ diff --git a/NPCs/Bumblefuck/Bumblefuck2.cs b/NPCs/Bumblefuck/Bumblefuck2.cs new file mode 100644 index 0000000000..75ce286f8a --- /dev/null +++ b/NPCs/Bumblefuck/Bumblefuck2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck2.png b/NPCs/Bumblefuck/Bumblefuck2.png new file mode 100644 index 0000000000..4b1e72a257 Binary files /dev/null and b/NPCs/Bumblefuck/Bumblefuck2.png differ diff --git a/NPCs/Bumblefuck/Bumblefuck3.cs b/NPCs/Bumblefuck/Bumblefuck3.cs new file mode 100644 index 0000000000..00d6dfa9d0 --- /dev/null +++ b/NPCs/Bumblefuck/Bumblefuck3.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck3.png b/NPCs/Bumblefuck/Bumblefuck3.png new file mode 100644 index 0000000000..4b1e72a257 Binary files /dev/null and b/NPCs/Bumblefuck/Bumblefuck3.png differ diff --git a/NPCs/Bumblefuck/Bumblefuck_Head_Boss.png b/NPCs/Bumblefuck/Bumblefuck_Head_Boss.png new file mode 100644 index 0000000000..f12a5f35cf Binary files /dev/null and b/NPCs/Bumblefuck/Bumblefuck_Head_Boss.png differ diff --git a/NPCs/Calamitas/CalScreenShaderData.cs b/NPCs/Calamitas/CalScreenShaderData.cs new file mode 100644 index 0000000000..1ef421e0d0 --- /dev/null +++ b/NPCs/Calamitas/CalScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Calamitas +{ + public class CalScreenShaderData : ScreenShaderData + { + private int CalIndex; + + public CalScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateCalIndex(); + if (CalIndex != -1) + { + UseTargetPosition(Main.npc[CalIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/Calamitas/CalSky.cs new file mode 100644 index 0000000000..96ecbad42b --- /dev/null +++ b/NPCs/Calamitas/CalSky.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Calamitas +{ + public class CalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int CalIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateCalIndex()) + { + float x = 0f; + if (this.CalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return true; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return CalIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs new file mode 100644 index 0000000000..7b9845ca27 --- /dev/null +++ b/NPCs/Calamitas/Calamitas.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/Calamitas.png b/NPCs/Calamitas/Calamitas.png new file mode 100644 index 0000000000..1d6119c608 Binary files /dev/null and b/NPCs/Calamitas/Calamitas.png differ diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs new file mode 100644 index 0000000000..6d40d55290 --- /dev/null +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun.png b/NPCs/Calamitas/CalamitasRun.png new file mode 100644 index 0000000000..3244969703 Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun.png differ diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs new file mode 100644 index 0000000000..9806223fdc --- /dev/null +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun2.png b/NPCs/Calamitas/CalamitasRun2.png new file mode 100644 index 0000000000..c55dd7ffeb Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun2.png differ diff --git a/NPCs/Calamitas/CalamitasRun2_Head_Boss.png b/NPCs/Calamitas/CalamitasRun2_Head_Boss.png new file mode 100644 index 0000000000..ebdcbbf6d1 Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun2_Head_Boss.png differ diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs new file mode 100644 index 0000000000..dabfeaa9f6 --- /dev/null +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/CalamitasRun3.png b/NPCs/Calamitas/CalamitasRun3.png new file mode 100644 index 0000000000..547d7c3509 Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun3.png differ diff --git a/NPCs/Calamitas/CalamitasRun3_Head_Boss.png b/NPCs/Calamitas/CalamitasRun3_Head_Boss.png new file mode 100644 index 0000000000..cca69088f8 Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun3_Head_Boss.png differ diff --git a/NPCs/Calamitas/CalamitasRun_Head_Boss.png b/NPCs/Calamitas/CalamitasRun_Head_Boss.png new file mode 100644 index 0000000000..d16f74ad46 Binary files /dev/null and b/NPCs/Calamitas/CalamitasRun_Head_Boss.png differ diff --git a/NPCs/Calamitas/Calamitas_Head_Boss.png b/NPCs/Calamitas/Calamitas_Head_Boss.png new file mode 100644 index 0000000000..cca69088f8 Binary files /dev/null and b/NPCs/Calamitas/Calamitas_Head_Boss.png differ diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs new file mode 100644 index 0000000000..554bf17b92 --- /dev/null +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/LifeSeeker.png b/NPCs/Calamitas/LifeSeeker.png new file mode 100644 index 0000000000..ced67f60ae Binary files /dev/null and b/NPCs/Calamitas/LifeSeeker.png differ diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs new file mode 100644 index 0000000000..53a9c55f43 --- /dev/null +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Calamitas/SoulSeeker.png b/NPCs/Calamitas/SoulSeeker.png new file mode 100644 index 0000000000..93b13e9d0b Binary files /dev/null and b/NPCs/Calamitas/SoulSeeker.png differ diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs new file mode 100644 index 0000000000..a139af9df2 --- /dev/null +++ b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs @@ -0,0 +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)); + } + } + } +} \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.png b/NPCs/CalamityBiomeNPCs/CultistAssassin.png new file mode 100644 index 0000000000..ca5484bf70 Binary files /dev/null and b/NPCs/CalamityBiomeNPCs/CultistAssassin.png differ diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs new file mode 100644 index 0000000000..bd2e973723 --- /dev/null +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.png b/NPCs/CalamityBiomeNPCs/DespairStone.png new file mode 100644 index 0000000000..e7ab63c022 Binary files /dev/null and b/NPCs/CalamityBiomeNPCs/DespairStone.png differ diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.cs b/NPCs/CalamityBiomeNPCs/Scryllar.cs new file mode 100644 index 0000000000..78e4ab0b96 --- /dev/null +++ b/NPCs/CalamityBiomeNPCs/Scryllar.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.png b/NPCs/CalamityBiomeNPCs/Scryllar.png new file mode 100644 index 0000000000..7313450d36 Binary files /dev/null and b/NPCs/CalamityBiomeNPCs/Scryllar.png differ diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs new file mode 100644 index 0000000000..927717d277 --- /dev/null +++ b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.png b/NPCs/CalamityBiomeNPCs/ScryllarRage.png new file mode 100644 index 0000000000..56ca9fc99e Binary files /dev/null and b/NPCs/CalamityBiomeNPCs/ScryllarRage.png differ diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs new file mode 100644 index 0000000000..d09b357872 --- /dev/null +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.png b/NPCs/CalamityBiomeNPCs/SoulSlurper.png new file mode 100644 index 0000000000..09e547d2b4 Binary files /dev/null and b/NPCs/CalamityBiomeNPCs/SoulSlurper.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs new file mode 100644 index 0000000000..ec715c178d --- /dev/null +++ b/NPCs/CalamityGlobalNPC.cs @@ -0,0 +1,11943 @@ +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.4); + maxSpawns = (int)((float)maxSpawns * 1.1f); + } + if (CalamityWorld.revenge) + { + spawnRate = (int)((double)spawnRate * 0.85); + } + if (CalamityWorld.death) + { + spawnRate = (int)((double)spawnRate * 0.75); + } + if (CalamityWorld.demonMode) + { + spawnRate = (int)((double)spawnRate * 0.75); + } + if (player.GetModPlayer(mod).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) + { + 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 + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs new file mode 100644 index 0000000000..b3d43ae28c --- /dev/null +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/CeaselessVoid.png b/NPCs/CeaselessVoid/CeaselessVoid.png new file mode 100644 index 0000000000..50a0123cce Binary files /dev/null and b/NPCs/CeaselessVoid/CeaselessVoid.png differ diff --git a/NPCs/CeaselessVoid/CeaselessVoid_Head_Boss.png b/NPCs/CeaselessVoid/CeaselessVoid_Head_Boss.png new file mode 100644 index 0000000000..19ed5a63f4 Binary files /dev/null and b/NPCs/CeaselessVoid/CeaselessVoid_Head_Boss.png differ diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs new file mode 100644 index 0000000000..ad56933f95 --- /dev/null +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/DarkEnergy.png b/NPCs/CeaselessVoid/DarkEnergy.png new file mode 100644 index 0000000000..ad834020e5 Binary files /dev/null and b/NPCs/CeaselessVoid/DarkEnergy.png differ diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs new file mode 100644 index 0000000000..2afbbdbe0d --- /dev/null +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/DarkEnergy2.png b/NPCs/CeaselessVoid/DarkEnergy2.png new file mode 100644 index 0000000000..ad834020e5 Binary files /dev/null and b/NPCs/CeaselessVoid/DarkEnergy2.png differ diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs new file mode 100644 index 0000000000..d3deb72f36 --- /dev/null +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/DarkEnergy3.png b/NPCs/CeaselessVoid/DarkEnergy3.png new file mode 100644 index 0000000000..ad834020e5 Binary files /dev/null and b/NPCs/CeaselessVoid/DarkEnergy3.png differ diff --git a/NPCs/CosmicWraith/CosmicLantern.cs b/NPCs/CosmicWraith/CosmicLantern.cs new file mode 100644 index 0000000000..f3ca952ae5 --- /dev/null +++ b/NPCs/CosmicWraith/CosmicLantern.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/CosmicWraith/CosmicLantern.png b/NPCs/CosmicWraith/CosmicLantern.png new file mode 100644 index 0000000000..ccc256bac8 Binary files /dev/null and b/NPCs/CosmicWraith/CosmicLantern.png differ diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs new file mode 100644 index 0000000000..d1d9e82d36 --- /dev/null +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/CosmicWraith/CosmicWraith.png b/NPCs/CosmicWraith/CosmicWraith.png new file mode 100644 index 0000000000..a3b1030f32 Binary files /dev/null and b/NPCs/CosmicWraith/CosmicWraith.png differ diff --git a/NPCs/CosmicWraith/CosmicWraithAlt.png b/NPCs/CosmicWraith/CosmicWraithAlt.png new file mode 100644 index 0000000000..01b5c737a3 Binary files /dev/null and b/NPCs/CosmicWraith/CosmicWraithAlt.png differ diff --git a/NPCs/CosmicWraith/CosmicWraithAlt2.png b/NPCs/CosmicWraith/CosmicWraithAlt2.png new file mode 100644 index 0000000000..c72f9a4456 Binary files /dev/null and b/NPCs/CosmicWraith/CosmicWraithAlt2.png differ diff --git a/NPCs/CosmicWraith/CosmicWraith_Head_Boss.png b/NPCs/CosmicWraith/CosmicWraith_Head_Boss.png new file mode 100644 index 0000000000..e54e77dd5a Binary files /dev/null and b/NPCs/CosmicWraith/CosmicWraith_Head_Boss.png differ diff --git a/NPCs/CosmicWraith/SignusBomb.cs b/NPCs/CosmicWraith/SignusBomb.cs new file mode 100644 index 0000000000..81e678d329 --- /dev/null +++ b/NPCs/CosmicWraith/SignusBomb.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/CosmicWraith/SignusBomb.png b/NPCs/CosmicWraith/SignusBomb.png new file mode 100644 index 0000000000..be454ce6ca Binary files /dev/null and b/NPCs/CosmicWraith/SignusBomb.png differ diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs new file mode 100644 index 0000000000..fcc4c75985 --- /dev/null +++ b/NPCs/Crabulon/CrabShroom.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Crabulon/CrabShroom.png b/NPCs/Crabulon/CrabShroom.png new file mode 100644 index 0000000000..279f8aa2b9 Binary files /dev/null and b/NPCs/Crabulon/CrabShroom.png differ diff --git a/NPCs/Crabulon/CrabulonAttack.png b/NPCs/Crabulon/CrabulonAttack.png new file mode 100644 index 0000000000..dfe35810cf Binary files /dev/null and b/NPCs/Crabulon/CrabulonAttack.png differ diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs new file mode 100644 index 0000000000..c2f2555e2b --- /dev/null +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Crabulon/CrabulonIdle.png b/NPCs/Crabulon/CrabulonIdle.png new file mode 100644 index 0000000000..de8760bb78 Binary files /dev/null and b/NPCs/Crabulon/CrabulonIdle.png differ diff --git a/NPCs/Crabulon/CrabulonIdleAlt.png b/NPCs/Crabulon/CrabulonIdleAlt.png new file mode 100644 index 0000000000..d8955a3930 Binary files /dev/null and b/NPCs/Crabulon/CrabulonIdleAlt.png differ diff --git a/NPCs/Crabulon/CrabulonIdle_Head_Boss.png b/NPCs/Crabulon/CrabulonIdle_Head_Boss.png new file mode 100644 index 0000000000..feb76e2263 Binary files /dev/null and b/NPCs/Crabulon/CrabulonIdle_Head_Boss.png differ diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs new file mode 100644 index 0000000000..3faa3baae5 --- /dev/null +++ b/NPCs/Cryogen/Cryocore.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Cryogen/Cryocore.png b/NPCs/Cryogen/Cryocore.png new file mode 100644 index 0000000000..996686a0cb Binary files /dev/null and b/NPCs/Cryogen/Cryocore.png differ diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs new file mode 100644 index 0000000000..76a103c645 --- /dev/null +++ b/NPCs/Cryogen/Cryocore2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Cryogen/Cryocore2.png b/NPCs/Cryogen/Cryocore2.png new file mode 100644 index 0000000000..3924a99cc4 Binary files /dev/null and b/NPCs/Cryogen/Cryocore2.png differ diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs new file mode 100644 index 0000000000..2cd28baf80 --- /dev/null +++ b/NPCs/Cryogen/Cryogen.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Cryogen/Cryogen.png b/NPCs/Cryogen/Cryogen.png new file mode 100644 index 0000000000..877504d4d2 Binary files /dev/null and b/NPCs/Cryogen/Cryogen.png differ diff --git a/NPCs/Cryogen/Cryogen2.png b/NPCs/Cryogen/Cryogen2.png new file mode 100644 index 0000000000..37b23b9dcd Binary files /dev/null and b/NPCs/Cryogen/Cryogen2.png differ diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs new file mode 100644 index 0000000000..511ffd00d8 --- /dev/null +++ b/NPCs/Cryogen/CryogenIce.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Cryogen/CryogenIce.png b/NPCs/Cryogen/CryogenIce.png new file mode 100644 index 0000000000..ec6e31c4c5 Binary files /dev/null and b/NPCs/Cryogen/CryogenIce.png differ diff --git a/NPCs/Cryogen/Cryogen_Head_Boss.png b/NPCs/Cryogen/Cryogen_Head_Boss.png new file mode 100644 index 0000000000..b6882e3da3 Binary files /dev/null and b/NPCs/Cryogen/Cryogen_Head_Boss.png differ diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs new file mode 100644 index 0000000000..d8ca2cac85 --- /dev/null +++ b/NPCs/Cryogen/IceMass.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Cryogen/IceMass.png b/NPCs/Cryogen/IceMass.png new file mode 100644 index 0000000000..894d997568 Binary files /dev/null and b/NPCs/Cryogen/IceMass.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs new file mode 100644 index 0000000000..8a5d81ac70 --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeBody.png b/NPCs/DesertScourge/DesertScourgeBody.png new file mode 100644 index 0000000000..c7a054844c Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeBody.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs new file mode 100644 index 0000000000..c80241481e --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.png b/NPCs/DesertScourge/DesertScourgeBodySmall.png new file mode 100644 index 0000000000..c7a054844c Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeBodySmall.png differ diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs new file mode 100644 index 0000000000..4700fa0a5b --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeHead.png b/NPCs/DesertScourge/DesertScourgeHead.png new file mode 100644 index 0000000000..196d7a6133 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeHead.png differ diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs new file mode 100644 index 0000000000..4211fa18c5 --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.png b/NPCs/DesertScourge/DesertScourgeHeadSmall.png new file mode 100644 index 0000000000..196d7a6133 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeHeadSmall.png differ diff --git a/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png b/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png new file mode 100644 index 0000000000..a211f7a892 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs new file mode 100644 index 0000000000..88ae5126aa --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeTail.png b/NPCs/DesertScourge/DesertScourgeTail.png new file mode 100644 index 0000000000..b2ca84df81 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeTail.png differ diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs new file mode 100644 index 0000000000..fa923c444b --- /dev/null +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.png b/NPCs/DesertScourge/DesertScourgeTailSmall.png new file mode 100644 index 0000000000..b2ca84df81 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeTailSmall.png differ diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs new file mode 100644 index 0000000000..1eea7045b1 --- /dev/null +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerBody.png b/NPCs/DesertScourge/DriedSeekerBody.png new file mode 100644 index 0000000000..3200712638 Binary files /dev/null and b/NPCs/DesertScourge/DriedSeekerBody.png differ diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs new file mode 100644 index 0000000000..9270088fad --- /dev/null +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerHead.png b/NPCs/DesertScourge/DriedSeekerHead.png new file mode 100644 index 0000000000..72af38a008 Binary files /dev/null and b/NPCs/DesertScourge/DriedSeekerHead.png differ diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs new file mode 100644 index 0000000000..52a43977bd --- /dev/null +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/DesertScourge/DriedSeekerTail.png b/NPCs/DesertScourge/DriedSeekerTail.png new file mode 100644 index 0000000000..7c5fd5c5e8 Binary files /dev/null and b/NPCs/DesertScourge/DriedSeekerTail.png differ diff --git a/NPCs/Goozma/Goozma.png b/NPCs/Goozma/Goozma.png new file mode 100644 index 0000000000..95ec42e62c Binary files /dev/null and b/NPCs/Goozma/Goozma.png differ diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs new file mode 100644 index 0000000000..79b3fcf9ba --- /dev/null +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/GreatSandShark/GreatSandShark.png b/NPCs/GreatSandShark/GreatSandShark.png new file mode 100644 index 0000000000..edfa89dbba Binary files /dev/null and b/NPCs/GreatSandShark/GreatSandShark.png differ diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs new file mode 100644 index 0000000000..92e28e4c5f --- /dev/null +++ b/NPCs/HiveMind/DankCreeper.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/DankCreeper.png b/NPCs/HiveMind/DankCreeper.png new file mode 100644 index 0000000000..d71993c057 Binary files /dev/null and b/NPCs/HiveMind/DankCreeper.png differ diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs new file mode 100644 index 0000000000..cdfce79599 --- /dev/null +++ b/NPCs/HiveMind/DarkHeart.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/DarkHeart.png b/NPCs/HiveMind/DarkHeart.png new file mode 100644 index 0000000000..b0a01bfad3 Binary files /dev/null and b/NPCs/HiveMind/DarkHeart.png differ diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs new file mode 100644 index 0000000000..35528e6673 --- /dev/null +++ b/NPCs/HiveMind/HiveBlob.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/HiveBlob.png b/NPCs/HiveMind/HiveBlob.png new file mode 100644 index 0000000000..55f1f3cc83 Binary files /dev/null and b/NPCs/HiveMind/HiveBlob.png differ diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs new file mode 100644 index 0000000000..ae440ab9fb --- /dev/null +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/HiveBlob2.png b/NPCs/HiveMind/HiveBlob2.png new file mode 100644 index 0000000000..a4518873c0 Binary files /dev/null and b/NPCs/HiveMind/HiveBlob2.png differ diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs new file mode 100644 index 0000000000..5fa9c2d393 --- /dev/null +++ b/NPCs/HiveMind/HiveCyst.cs @@ -0,0 +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")); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/HiveCyst.png b/NPCs/HiveMind/HiveCyst.png new file mode 100644 index 0000000000..c6a1b4d33b Binary files /dev/null and b/NPCs/HiveMind/HiveCyst.png differ diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs new file mode 100644 index 0000000000..7fed56689c --- /dev/null +++ b/NPCs/HiveMind/HiveMind.cs @@ -0,0 +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) + { + 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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/HiveMind/HiveMind.png b/NPCs/HiveMind/HiveMind.png new file mode 100644 index 0000000000..5fbba4ef76 Binary files /dev/null and b/NPCs/HiveMind/HiveMind.png differ diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs new file mode 100644 index 0000000000..44aa188cab --- /dev/null +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -0,0 +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); + } + } + } +} diff --git a/NPCs/HiveMind/HiveMindP2.png b/NPCs/HiveMind/HiveMindP2.png new file mode 100644 index 0000000000..36e3053d57 Binary files /dev/null and b/NPCs/HiveMind/HiveMindP2.png differ diff --git a/NPCs/HiveMind/HiveMindP2_Head_Boss.png b/NPCs/HiveMind/HiveMindP2_Head_Boss.png new file mode 100644 index 0000000000..8f358b7a8c Binary files /dev/null and b/NPCs/HiveMind/HiveMindP2_Head_Boss.png differ diff --git a/NPCs/HiveMind/HiveMind_Head_Boss.png b/NPCs/HiveMind/HiveMind_Head_Boss.png new file mode 100644 index 0000000000..2b3939c1bf Binary files /dev/null and b/NPCs/HiveMind/HiveMind_Head_Boss.png differ diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs new file mode 100644 index 0000000000..7854e643e5 --- /dev/null +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/AquaticAberration.png b/NPCs/Leviathan/AquaticAberration.png new file mode 100644 index 0000000000..a32453b61f Binary files /dev/null and b/NPCs/Leviathan/AquaticAberration.png differ diff --git a/NPCs/Leviathan/LevScreenShaderData.cs b/NPCs/Leviathan/LevScreenShaderData.cs new file mode 100644 index 0000000000..c7137998d0 --- /dev/null +++ b/NPCs/Leviathan/LevScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Leviathan +{ + public class LevScreenShaderData : ScreenShaderData + { + private int LevIndex; + + public LevScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateLIndex(); + if (LevIndex != -1) + { + UseTargetPosition(Main.npc[LevIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs new file mode 100644 index 0000000000..5022fb4a60 --- /dev/null +++ b/NPCs/Leviathan/LevSky.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Leviathan +{ + public class LevSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int LevIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateLIndex()) + { + float x = 0f; + if (this.LevIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return true; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return LevIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs new file mode 100644 index 0000000000..40abd7bb57 --- /dev/null +++ b/NPCs/Leviathan/Leviathan.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/Leviathan.png b/NPCs/Leviathan/Leviathan.png new file mode 100644 index 0000000000..5bd4cf58e8 Binary files /dev/null and b/NPCs/Leviathan/Leviathan.png differ diff --git a/NPCs/Leviathan/LeviathanAltTexOne.png b/NPCs/Leviathan/LeviathanAltTexOne.png new file mode 100644 index 0000000000..9f98f74ae9 Binary files /dev/null and b/NPCs/Leviathan/LeviathanAltTexOne.png differ diff --git a/NPCs/Leviathan/LeviathanAltTexTwo.png b/NPCs/Leviathan/LeviathanAltTexTwo.png new file mode 100644 index 0000000000..1c8019853c Binary files /dev/null and b/NPCs/Leviathan/LeviathanAltTexTwo.png differ diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs new file mode 100644 index 0000000000..4798b22cbd --- /dev/null +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/LeviathanStart.png b/NPCs/Leviathan/LeviathanStart.png new file mode 100644 index 0000000000..42602cccfe Binary files /dev/null and b/NPCs/Leviathan/LeviathanStart.png differ diff --git a/NPCs/Leviathan/LeviathanTexTwo.png b/NPCs/Leviathan/LeviathanTexTwo.png new file mode 100644 index 0000000000..23779c9d83 Binary files /dev/null and b/NPCs/Leviathan/LeviathanTexTwo.png differ diff --git a/NPCs/Leviathan/Leviathan_Head_Boss.png b/NPCs/Leviathan/Leviathan_Head_Boss.png new file mode 100644 index 0000000000..f8b1338143 Binary files /dev/null and b/NPCs/Leviathan/Leviathan_Head_Boss.png differ diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs new file mode 100644 index 0000000000..ba3bdbc15c --- /dev/null +++ b/NPCs/Leviathan/Parasea.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/Parasea.png b/NPCs/Leviathan/Parasea.png new file mode 100644 index 0000000000..b370939612 Binary files /dev/null and b/NPCs/Leviathan/Parasea.png differ diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs new file mode 100644 index 0000000000..a00af3d6fb --- /dev/null +++ b/NPCs/Leviathan/Siren.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/Siren.png b/NPCs/Leviathan/Siren.png new file mode 100644 index 0000000000..e523497ed1 Binary files /dev/null and b/NPCs/Leviathan/Siren.png differ diff --git a/NPCs/Leviathan/SirenAlt.png b/NPCs/Leviathan/SirenAlt.png new file mode 100644 index 0000000000..26b616ef20 Binary files /dev/null and b/NPCs/Leviathan/SirenAlt.png differ diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs new file mode 100644 index 0000000000..11d8914386 --- /dev/null +++ b/NPCs/Leviathan/SirenClone.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/SirenClone.png b/NPCs/Leviathan/SirenClone.png new file mode 100644 index 0000000000..7564564883 Binary files /dev/null and b/NPCs/Leviathan/SirenClone.png differ diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs new file mode 100644 index 0000000000..a7fe492323 --- /dev/null +++ b/NPCs/Leviathan/SirenIce.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Leviathan/SirenIce.png b/NPCs/Leviathan/SirenIce.png new file mode 100644 index 0000000000..9f2547d65a Binary files /dev/null and b/NPCs/Leviathan/SirenIce.png differ diff --git a/NPCs/Leviathan/Siren_Head_Boss.png b/NPCs/Leviathan/Siren_Head_Boss.png new file mode 100644 index 0000000000..4fff5b294d Binary files /dev/null and b/NPCs/Leviathan/Siren_Head_Boss.png differ diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs new file mode 100644 index 0000000000..3e5d02f884 --- /dev/null +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/AeroSlime.png b/NPCs/NormalNPCs/AeroSlime.png new file mode 100644 index 0000000000..62589b496d Binary files /dev/null and b/NPCs/NormalNPCs/AeroSlime.png differ diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs new file mode 100644 index 0000000000..e5d5e55d1a --- /dev/null +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -0,0 +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)); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/AngryDog.png b/NPCs/NormalNPCs/AngryDog.png new file mode 100644 index 0000000000..dfb62b2b28 Binary files /dev/null and b/NPCs/NormalNPCs/AngryDog.png differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs new file mode 100644 index 0000000000..fc1e8bc55c --- /dev/null +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.png b/NPCs/NormalNPCs/ArmoredDiggerBody.png new file mode 100644 index 0000000000..751d9df83e Binary files /dev/null and b/NPCs/NormalNPCs/ArmoredDiggerBody.png differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs new file mode 100644 index 0000000000..91bdd0bb5c --- /dev/null +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -0,0 +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)); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.png b/NPCs/NormalNPCs/ArmoredDiggerHead.png new file mode 100644 index 0000000000..1e15cbfd48 Binary files /dev/null and b/NPCs/NormalNPCs/ArmoredDiggerHead.png differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs new file mode 100644 index 0000000000..93c944dc7f --- /dev/null +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.png b/NPCs/NormalNPCs/ArmoredDiggerTail.png new file mode 100644 index 0000000000..b27be183f3 Binary files /dev/null and b/NPCs/NormalNPCs/ArmoredDiggerTail.png differ diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs new file mode 100644 index 0000000000..3c42e0c6f8 --- /dev/null +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/BlightedEye.png b/NPCs/NormalNPCs/BlightedEye.png new file mode 100644 index 0000000000..72dfb62fe4 Binary files /dev/null and b/NPCs/NormalNPCs/BlightedEye.png differ diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs new file mode 100644 index 0000000000..b82bd9e496 --- /dev/null +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/BloomSlime.png b/NPCs/NormalNPCs/BloomSlime.png new file mode 100644 index 0000000000..7d6669da1d Binary files /dev/null and b/NPCs/NormalNPCs/BloomSlime.png differ diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs new file mode 100644 index 0000000000..fbd135db4c --- /dev/null +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Bohldohr.png b/NPCs/NormalNPCs/Bohldohr.png new file mode 100644 index 0000000000..7269c0c06f Binary files /dev/null and b/NPCs/NormalNPCs/Bohldohr.png differ diff --git a/NPCs/NormalNPCs/CalamityEye.cs b/NPCs/NormalNPCs/CalamityEye.cs new file mode 100644 index 0000000000..c47fbe7d20 --- /dev/null +++ b/NPCs/NormalNPCs/CalamityEye.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CalamityEye.png b/NPCs/NormalNPCs/CalamityEye.png new file mode 100644 index 0000000000..3a5fdc30c5 Binary files /dev/null and b/NPCs/NormalNPCs/CalamityEye.png differ diff --git a/NPCs/NormalNPCs/ChaosSlime.cs b/NPCs/NormalNPCs/ChaosSlime.cs new file mode 100644 index 0000000000..be5d1e62fb --- /dev/null +++ b/NPCs/NormalNPCs/ChaosSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ChaosSlime.png b/NPCs/NormalNPCs/ChaosSlime.png new file mode 100644 index 0000000000..412911992c Binary files /dev/null and b/NPCs/NormalNPCs/ChaosSlime.png differ diff --git a/NPCs/NormalNPCs/CharredSlime.cs b/NPCs/NormalNPCs/CharredSlime.cs new file mode 100644 index 0000000000..973a202170 --- /dev/null +++ b/NPCs/NormalNPCs/CharredSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CharredSlime.png b/NPCs/NormalNPCs/CharredSlime.png new file mode 100644 index 0000000000..8a527d014c Binary files /dev/null and b/NPCs/NormalNPCs/CharredSlime.png differ diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs new file mode 100644 index 0000000000..1f6ac236be --- /dev/null +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Cnidrion.png b/NPCs/NormalNPCs/Cnidrion.png new file mode 100644 index 0000000000..2c02a75b96 Binary files /dev/null and b/NPCs/NormalNPCs/Cnidrion.png differ diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs new file mode 100644 index 0000000000..7edd908cf2 --- /dev/null +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CosmicElemental.png b/NPCs/NormalNPCs/CosmicElemental.png new file mode 100644 index 0000000000..8612372af5 Binary files /dev/null and b/NPCs/NormalNPCs/CosmicElemental.png differ diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs new file mode 100644 index 0000000000..99493b1017 --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerAmber.png b/NPCs/NormalNPCs/CrawlerAmber.png new file mode 100644 index 0000000000..bba6d9d222 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerAmber.png differ diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs new file mode 100644 index 0000000000..68ba5ad9e5 --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.png b/NPCs/NormalNPCs/CrawlerAmethyst.png new file mode 100644 index 0000000000..7d8ccb316e Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerAmethyst.png differ diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs new file mode 100644 index 0000000000..11caf352ac --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerCrystal.png b/NPCs/NormalNPCs/CrawlerCrystal.png new file mode 100644 index 0000000000..a52cec199e Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerCrystal.png differ diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs new file mode 100644 index 0000000000..4083cb200b --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerDiamond.png b/NPCs/NormalNPCs/CrawlerDiamond.png new file mode 100644 index 0000000000..559879b9e2 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerDiamond.png differ diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs new file mode 100644 index 0000000000..a52479d6cf --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerEmerald.png b/NPCs/NormalNPCs/CrawlerEmerald.png new file mode 100644 index 0000000000..6d4fd6ad59 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerEmerald.png differ diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs new file mode 100644 index 0000000000..2491e532b5 --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerRuby.png b/NPCs/NormalNPCs/CrawlerRuby.png new file mode 100644 index 0000000000..6fddbc1ec6 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerRuby.png differ diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs new file mode 100644 index 0000000000..77900c6f98 --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerSapphire.png b/NPCs/NormalNPCs/CrawlerSapphire.png new file mode 100644 index 0000000000..8f166fb689 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerSapphire.png differ diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs new file mode 100644 index 0000000000..a71ec8dbd5 --- /dev/null +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrawlerTopaz.png b/NPCs/NormalNPCs/CrawlerTopaz.png new file mode 100644 index 0000000000..575ef1a638 Binary files /dev/null and b/NPCs/NormalNPCs/CrawlerTopaz.png differ diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs new file mode 100644 index 0000000000..6f2e28ca54 --- /dev/null +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.png b/NPCs/NormalNPCs/CrimulanBlightSlime.png new file mode 100644 index 0000000000..45b01c5333 Binary files /dev/null and b/NPCs/NormalNPCs/CrimulanBlightSlime.png differ diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs new file mode 100644 index 0000000000..1c458fabec --- /dev/null +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/CryoSlime.png b/NPCs/NormalNPCs/CryoSlime.png new file mode 100644 index 0000000000..3d2da2dea7 Binary files /dev/null and b/NPCs/NormalNPCs/CryoSlime.png differ diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs new file mode 100644 index 0000000000..98962d8b16 --- /dev/null +++ b/NPCs/NormalNPCs/Cryon.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Cryon.png b/NPCs/NormalNPCs/Cryon.png new file mode 100644 index 0000000000..850a6bb7ab Binary files /dev/null and b/NPCs/NormalNPCs/Cryon.png differ diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs new file mode 100644 index 0000000000..b7fc4215da --- /dev/null +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.png b/NPCs/NormalNPCs/EbonianBlightSlime.png new file mode 100644 index 0000000000..172c80ca4c Binary files /dev/null and b/NPCs/NormalNPCs/EbonianBlightSlime.png differ diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs new file mode 100644 index 0000000000..2099a4669e --- /dev/null +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -0,0 +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)); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Eidolist.png b/NPCs/NormalNPCs/Eidolist.png new file mode 100644 index 0000000000..9d340f56ce Binary files /dev/null and b/NPCs/NormalNPCs/Eidolist.png differ diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/NormalNPCs/HeatSpirit.cs new file mode 100644 index 0000000000..93fd7ffe10 --- /dev/null +++ b/NPCs/NormalNPCs/HeatSpirit.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/HeatSpirit.png b/NPCs/NormalNPCs/HeatSpirit.png new file mode 100644 index 0000000000..2f96087763 Binary files /dev/null and b/NPCs/NormalNPCs/HeatSpirit.png differ diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs new file mode 100644 index 0000000000..12700fc726 --- /dev/null +++ b/NPCs/NormalNPCs/Horse.cs @@ -0,0 +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; + + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Horse.png b/NPCs/NormalNPCs/Horse.png new file mode 100644 index 0000000000..10122916fe Binary files /dev/null and b/NPCs/NormalNPCs/Horse.png differ diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs new file mode 100644 index 0000000000..eb8032f988 --- /dev/null +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/IceClasper.png b/NPCs/NormalNPCs/IceClasper.png new file mode 100644 index 0000000000..eab4fb729c Binary files /dev/null and b/NPCs/NormalNPCs/IceClasper.png differ diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs new file mode 100644 index 0000000000..bf23aa1da7 --- /dev/null +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ImpiousImmolator.png b/NPCs/NormalNPCs/ImpiousImmolator.png new file mode 100644 index 0000000000..1e858a1399 Binary files /dev/null and b/NPCs/NormalNPCs/ImpiousImmolator.png differ diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs new file mode 100644 index 0000000000..468ff5c6e9 --- /dev/null +++ b/NPCs/NormalNPCs/IrradiatedSlime.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/IrradiatedSlime.png b/NPCs/NormalNPCs/IrradiatedSlime.png new file mode 100644 index 0000000000..9618a3c255 Binary files /dev/null and b/NPCs/NormalNPCs/IrradiatedSlime.png differ diff --git a/NPCs/NormalNPCs/IrradiatedSlimeGlow.png b/NPCs/NormalNPCs/IrradiatedSlimeGlow.png new file mode 100644 index 0000000000..6eaad05486 Binary files /dev/null and b/NPCs/NormalNPCs/IrradiatedSlimeGlow.png differ diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs new file mode 100644 index 0000000000..d595900d6d --- /dev/null +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/OverloadedSoldier.png b/NPCs/NormalNPCs/OverloadedSoldier.png new file mode 100644 index 0000000000..9f3cb5ef18 Binary files /dev/null and b/NPCs/NormalNPCs/OverloadedSoldier.png differ diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs new file mode 100644 index 0000000000..2a0a6964d2 --- /dev/null +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PerennialSlime.png b/NPCs/NormalNPCs/PerennialSlime.png new file mode 100644 index 0000000000..d6ed2df934 Binary files /dev/null and b/NPCs/NormalNPCs/PerennialSlime.png differ diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs new file mode 100644 index 0000000000..4d439208f3 --- /dev/null +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PhantomDebris.png b/NPCs/NormalNPCs/PhantomDebris.png new file mode 100644 index 0000000000..b4ce242758 Binary files /dev/null and b/NPCs/NormalNPCs/PhantomDebris.png differ diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs new file mode 100644 index 0000000000..2e5f14f2e4 --- /dev/null +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PhantomSpirit.png b/NPCs/NormalNPCs/PhantomSpirit.png new file mode 100644 index 0000000000..d1c9953248 Binary files /dev/null and b/NPCs/NormalNPCs/PhantomSpirit.png differ diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs new file mode 100644 index 0000000000..8051c80458 --- /dev/null +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PhantomSpiritL.png b/NPCs/NormalNPCs/PhantomSpiritL.png new file mode 100644 index 0000000000..df00ab41d5 Binary files /dev/null and b/NPCs/NormalNPCs/PhantomSpiritL.png differ diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs new file mode 100644 index 0000000000..97e1a5a97f --- /dev/null +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PhantomSpiritM.png b/NPCs/NormalNPCs/PhantomSpiritM.png new file mode 100644 index 0000000000..5cc4bc94c4 Binary files /dev/null and b/NPCs/NormalNPCs/PhantomSpiritM.png differ diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs new file mode 100644 index 0000000000..95c8f4fd2f --- /dev/null +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PhantomSpiritS.png b/NPCs/NormalNPCs/PhantomSpiritS.png new file mode 100644 index 0000000000..264f7ddde9 Binary files /dev/null and b/NPCs/NormalNPCs/PhantomSpiritS.png differ diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs new file mode 100644 index 0000000000..f90b703feb --- /dev/null +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Pitbull.png b/NPCs/NormalNPCs/Pitbull.png new file mode 100644 index 0000000000..9db2e197cd Binary files /dev/null and b/NPCs/NormalNPCs/Pitbull.png differ diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs new file mode 100644 index 0000000000..34193f5f99 --- /dev/null +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlagueBee.png b/NPCs/NormalNPCs/PlagueBee.png new file mode 100644 index 0000000000..8b018e6e78 Binary files /dev/null and b/NPCs/NormalNPCs/PlagueBee.png differ diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs new file mode 100644 index 0000000000..510553ebdd --- /dev/null +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.png b/NPCs/NormalNPCs/PlagueBeeLarge.png new file mode 100644 index 0000000000..8b018e6e78 Binary files /dev/null and b/NPCs/NormalNPCs/PlagueBeeLarge.png differ diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs new file mode 100644 index 0000000000..a7136c585c --- /dev/null +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlaguedDerpling.png b/NPCs/NormalNPCs/PlaguedDerpling.png new file mode 100644 index 0000000000..b957950f4b Binary files /dev/null and b/NPCs/NormalNPCs/PlaguedDerpling.png differ diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs new file mode 100644 index 0000000000..a10eb5af45 --- /dev/null +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.png b/NPCs/NormalNPCs/PlaguedFlyingFox.png new file mode 100644 index 0000000000..4d03834ff9 Binary files /dev/null and b/NPCs/NormalNPCs/PlaguedFlyingFox.png differ diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs new file mode 100644 index 0000000000..d97a7f0a85 --- /dev/null +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.png b/NPCs/NormalNPCs/PlaguedJungleSlime.png new file mode 100644 index 0000000000..d481b5bb39 Binary files /dev/null and b/NPCs/NormalNPCs/PlaguedJungleSlime.png differ diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs new file mode 100644 index 0000000000..061623275b --- /dev/null +++ b/NPCs/NormalNPCs/PlaguedTortoise.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/PlaguedTortoise.png b/NPCs/NormalNPCs/PlaguedTortoise.png new file mode 100644 index 0000000000..e0e0cb40d4 Binary files /dev/null and b/NPCs/NormalNPCs/PlaguedTortoise.png differ diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs new file mode 100644 index 0000000000..7815d1e523 --- /dev/null +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.png b/NPCs/NormalNPCs/ProfanedEnergyBody.png new file mode 100644 index 0000000000..62b1f81f17 Binary files /dev/null and b/NPCs/NormalNPCs/ProfanedEnergyBody.png differ diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs new file mode 100644 index 0000000000..942bd54e68 --- /dev/null +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.png b/NPCs/NormalNPCs/ProfanedEnergyLantern.png new file mode 100644 index 0000000000..fc03b8f9a9 Binary files /dev/null and b/NPCs/NormalNPCs/ProfanedEnergyLantern.png differ diff --git a/NPCs/NormalNPCs/ProfanedEnergySegment.png b/NPCs/NormalNPCs/ProfanedEnergySegment.png new file mode 100644 index 0000000000..814e0de3d0 Binary files /dev/null and b/NPCs/NormalNPCs/ProfanedEnergySegment.png differ diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs new file mode 100644 index 0000000000..52622520da --- /dev/null +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/SandTortoise.png b/NPCs/NormalNPCs/SandTortoise.png new file mode 100644 index 0000000000..9813d65dfd Binary files /dev/null and b/NPCs/NormalNPCs/SandTortoise.png differ diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs new file mode 100644 index 0000000000..d8b0b4bbfa --- /dev/null +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ScornEater.png b/NPCs/NormalNPCs/ScornEater.png new file mode 100644 index 0000000000..a7154b40d2 Binary files /dev/null and b/NPCs/NormalNPCs/ScornEater.png differ diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs new file mode 100644 index 0000000000..973d7b68ef --- /dev/null +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ShockstormShuttle.png b/NPCs/NormalNPCs/ShockstormShuttle.png new file mode 100644 index 0000000000..6f56a972bf Binary files /dev/null and b/NPCs/NormalNPCs/ShockstormShuttle.png differ diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs new file mode 100644 index 0000000000..2f774caf87 --- /dev/null +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/StormlionCharger.png b/NPCs/NormalNPCs/StormlionCharger.png new file mode 100644 index 0000000000..0911669972 Binary files /dev/null and b/NPCs/NormalNPCs/StormlionCharger.png differ diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs new file mode 100644 index 0000000000..6c62e110a1 --- /dev/null +++ b/NPCs/NormalNPCs/SunBat.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/SunBat.png b/NPCs/NormalNPCs/SunBat.png new file mode 100644 index 0000000000..da2aaee53d Binary files /dev/null and b/NPCs/NormalNPCs/SunBat.png differ diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs new file mode 100644 index 0000000000..8cd31ce10e --- /dev/null +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Sunskater.png b/NPCs/NormalNPCs/Sunskater.png new file mode 100644 index 0000000000..a1ac90a518 Binary files /dev/null and b/NPCs/NormalNPCs/Sunskater.png differ diff --git a/NPCs/NormalNPCs/SuperDummy.cs b/NPCs/NormalNPCs/SuperDummy.cs new file mode 100644 index 0000000000..dcc632b923 --- /dev/null +++ b/NPCs/NormalNPCs/SuperDummy.cs @@ -0,0 +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; + } + } +} diff --git a/NPCs/NormalNPCs/SuperDummy.png b/NPCs/NormalNPCs/SuperDummy.png new file mode 100644 index 0000000000..d09be4791b Binary files /dev/null and b/NPCs/NormalNPCs/SuperDummy.png differ diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs new file mode 100644 index 0000000000..b13ef48d7e --- /dev/null +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/ThiccWaifu.png b/NPCs/NormalNPCs/ThiccWaifu.png new file mode 100644 index 0000000000..765844b956 Binary files /dev/null and b/NPCs/NormalNPCs/ThiccWaifu.png differ diff --git a/NPCs/NormalNPCs/ThiccWaifuAttack.png b/NPCs/NormalNPCs/ThiccWaifuAttack.png new file mode 100644 index 0000000000..5b4eb809a0 Binary files /dev/null and b/NPCs/NormalNPCs/ThiccWaifuAttack.png differ diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs new file mode 100644 index 0000000000..498871b5a0 --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/WulfrumDrone.png b/NPCs/NormalNPCs/WulfrumDrone.png new file mode 100644 index 0000000000..63a3927889 Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumDrone.png differ diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs new file mode 100644 index 0000000000..b661ab689d --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/WulfrumSlime.png b/NPCs/NormalNPCs/WulfrumSlime.png new file mode 100644 index 0000000000..e7d001a6fb Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumSlime.png differ diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs new file mode 100644 index 0000000000..7db5d6b605 --- /dev/null +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorBodyLarge.png b/NPCs/Perforator/PerforatorBodyLarge.png new file mode 100644 index 0000000000..7f42ffd714 Binary files /dev/null and b/NPCs/Perforator/PerforatorBodyLarge.png differ diff --git a/NPCs/Perforator/PerforatorBodyLargeAlt.png b/NPCs/Perforator/PerforatorBodyLargeAlt.png new file mode 100644 index 0000000000..8c479a3038 Binary files /dev/null and b/NPCs/Perforator/PerforatorBodyLargeAlt.png differ diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs new file mode 100644 index 0000000000..1ab6b3b50b --- /dev/null +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorBodyMedium.png b/NPCs/Perforator/PerforatorBodyMedium.png new file mode 100644 index 0000000000..dada342c70 Binary files /dev/null and b/NPCs/Perforator/PerforatorBodyMedium.png differ diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs new file mode 100644 index 0000000000..f42a3165b1 --- /dev/null +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorBodySmall.png b/NPCs/Perforator/PerforatorBodySmall.png new file mode 100644 index 0000000000..eee091f3e1 Binary files /dev/null and b/NPCs/Perforator/PerforatorBodySmall.png differ diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs new file mode 100644 index 0000000000..2f12a63716 --- /dev/null +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -0,0 +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")); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorCyst.png b/NPCs/Perforator/PerforatorCyst.png new file mode 100644 index 0000000000..8a619c8c2c Binary files /dev/null and b/NPCs/Perforator/PerforatorCyst.png differ diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs new file mode 100644 index 0000000000..823c0443ca --- /dev/null +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHeadLarge.png b/NPCs/Perforator/PerforatorHeadLarge.png new file mode 100644 index 0000000000..e01bef031f Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadLarge.png differ diff --git a/NPCs/Perforator/PerforatorHeadLarge_Head_Boss.png b/NPCs/Perforator/PerforatorHeadLarge_Head_Boss.png new file mode 100644 index 0000000000..ab2b8fd36e Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadLarge_Head_Boss.png differ diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs new file mode 100644 index 0000000000..c0269caad9 --- /dev/null +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHeadMedium.png b/NPCs/Perforator/PerforatorHeadMedium.png new file mode 100644 index 0000000000..9873921378 Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadMedium.png differ diff --git a/NPCs/Perforator/PerforatorHeadMedium_Head_Boss.png b/NPCs/Perforator/PerforatorHeadMedium_Head_Boss.png new file mode 100644 index 0000000000..abb4d5099f Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadMedium_Head_Boss.png differ diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs new file mode 100644 index 0000000000..fad57a8acb --- /dev/null +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHeadSmall.png b/NPCs/Perforator/PerforatorHeadSmall.png new file mode 100644 index 0000000000..137219e92e Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadSmall.png differ diff --git a/NPCs/Perforator/PerforatorHeadSmall_Head_Boss.png b/NPCs/Perforator/PerforatorHeadSmall_Head_Boss.png new file mode 100644 index 0000000000..b5ad1e4157 Binary files /dev/null and b/NPCs/Perforator/PerforatorHeadSmall_Head_Boss.png differ diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs new file mode 100644 index 0000000000..ee255cf64a --- /dev/null +++ b/NPCs/Perforator/PerforatorHive.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorHive.png b/NPCs/Perforator/PerforatorHive.png new file mode 100644 index 0000000000..150019539a Binary files /dev/null and b/NPCs/Perforator/PerforatorHive.png differ diff --git a/NPCs/Perforator/PerforatorHive_Head_Boss.png b/NPCs/Perforator/PerforatorHive_Head_Boss.png new file mode 100644 index 0000000000..adb805f7cd Binary files /dev/null and b/NPCs/Perforator/PerforatorHive_Head_Boss.png differ diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs new file mode 100644 index 0000000000..accdf916d5 --- /dev/null +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorTailLarge.png b/NPCs/Perforator/PerforatorTailLarge.png new file mode 100644 index 0000000000..21d97f0118 Binary files /dev/null and b/NPCs/Perforator/PerforatorTailLarge.png differ diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs new file mode 100644 index 0000000000..38699bb686 --- /dev/null +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorTailMedium.png b/NPCs/Perforator/PerforatorTailMedium.png new file mode 100644 index 0000000000..de62e949f8 Binary files /dev/null and b/NPCs/Perforator/PerforatorTailMedium.png differ diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs new file mode 100644 index 0000000000..6769ac49c3 --- /dev/null +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Perforator/PerforatorTailSmall.png b/NPCs/Perforator/PerforatorTailSmall.png new file mode 100644 index 0000000000..b4e1c56928 Binary files /dev/null and b/NPCs/Perforator/PerforatorTailSmall.png differ diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs new file mode 100644 index 0000000000..e811384a72 --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PbGScreenShaderData : ScreenShaderData + { + private int PbGIndex; + + public PbGScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdatePbGIndex(); + if (PbGIndex != -1) + { + UseTargetPosition(Main.npc[PbGIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs new file mode 100644 index 0000000000..c82783b12d --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PbGSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int PbGIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdatePbGIndex()) + { + float x = 0f; + if (this.PbGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("PlaguebringerGoliath"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return true; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return PbGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs new file mode 100644 index 0000000000..3f9de08a80 --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.png b/NPCs/PlaguebringerGoliath/PlagueBeeG.png new file mode 100644 index 0000000000..8b018e6e78 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlagueBeeG.png differ diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs new file mode 100644 index 0000000000..21c2c8060c --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.png b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.png new file mode 100644 index 0000000000..ceb44da1c8 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.png differ diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs new file mode 100644 index 0000000000..becb86b795 --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png new file mode 100644 index 0000000000..3d288c7cdf Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png differ diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs new file mode 100644 index 0000000000..4123c2b3c5 --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.png b/NPCs/PlaguebringerGoliath/PlagueMine.png new file mode 100644 index 0000000000..722fb1b01b Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlagueMine.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs new file mode 100644 index 0000000000..32dd1d6c9a --- /dev/null +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.png b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.png new file mode 100644 index 0000000000..62cacd8288 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex.png b/NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex.png new file mode 100644 index 0000000000..40d0fbdc95 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex.png b/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex.png new file mode 100644 index 0000000000..71aa02a085 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_Head_Boss.png b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_Head_Boss.png new file mode 100644 index 0000000000..692c3a47d7 Binary files /dev/null and b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_Head_Boss.png differ diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs new file mode 100644 index 0000000000..0d60adffb8 --- /dev/null +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.png b/NPCs/PlaguebringerShade/PlaguebringerShade.png new file mode 100644 index 0000000000..bd0d9a568d Binary files /dev/null and b/NPCs/PlaguebringerShade/PlaguebringerShade.png differ diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs new file mode 100644 index 0000000000..992087737d --- /dev/null +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Polterghast/PhantomFuckYou.png b/NPCs/Polterghast/PhantomFuckYou.png new file mode 100644 index 0000000000..d2262e4e81 Binary files /dev/null and b/NPCs/Polterghast/PhantomFuckYou.png differ diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs new file mode 100644 index 0000000000..c76cd84a6a --- /dev/null +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Polterghast/PolterPhantom.png b/NPCs/Polterghast/PolterPhantom.png new file mode 100644 index 0000000000..0037804453 Binary files /dev/null and b/NPCs/Polterghast/PolterPhantom.png differ diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs new file mode 100644 index 0000000000..1365c91375 --- /dev/null +++ b/NPCs/Polterghast/Polterghast.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Polterghast/Polterghast.png b/NPCs/Polterghast/Polterghast.png new file mode 100644 index 0000000000..0f5d462383 Binary files /dev/null and b/NPCs/Polterghast/Polterghast.png differ diff --git a/NPCs/Polterghast/PolterghastChain.png b/NPCs/Polterghast/PolterghastChain.png new file mode 100644 index 0000000000..ecb2fcfab6 Binary files /dev/null and b/NPCs/Polterghast/PolterghastChain.png differ diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs new file mode 100644 index 0000000000..1ec2f0534d --- /dev/null +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Polterghast/PolterghastHook.png b/NPCs/Polterghast/PolterghastHook.png new file mode 100644 index 0000000000..7147f50791 Binary files /dev/null and b/NPCs/Polterghast/PolterghastHook.png differ diff --git a/NPCs/Polterghast/Polterghast_Head_Boss.png b/NPCs/Polterghast/Polterghast_Head_Boss.png new file mode 100644 index 0000000000..8abaaddba7 Binary files /dev/null and b/NPCs/Polterghast/Polterghast_Head_Boss.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs new file mode 100644 index 0000000000..f11e601925 --- /dev/null +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.png new file mode 100644 index 0000000000..d0559ae990 Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs new file mode 100644 index 0000000000..65cbae4bb8 --- /dev/null +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.png new file mode 100644 index 0000000000..55f5b7ec1c Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2_Head_Boss.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2_Head_Boss.png new file mode 100644 index 0000000000..1d1bd55b02 Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2_Head_Boss.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs new file mode 100644 index 0000000000..6fe613eddb --- /dev/null +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.png new file mode 100644 index 0000000000..7f02f8ab4b Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3_Head_Boss.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3_Head_Boss.png new file mode 100644 index 0000000000..c22f6c1bec Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3_Head_Boss.png differ diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss_Head_Boss.png b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss_Head_Boss.png new file mode 100644 index 0000000000..613695110c Binary files /dev/null and b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss_Head_Boss.png differ diff --git a/NPCs/Providence/ProvScreenShaderData.cs b/NPCs/Providence/ProvScreenShaderData.cs new file mode 100644 index 0000000000..a749902918 --- /dev/null +++ b/NPCs/Providence/ProvScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvScreenShaderData : ScreenShaderData + { + private int ProvIndex; + + public ProvScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdatePIndex() + { + int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); + if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) + { + return; + } + ProvIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ProvType) + { + ProvIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdatePIndex(); + if (ProvIndex != -1) + { + UseTargetPosition(Main.npc[ProvIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs new file mode 100644 index 0000000000..bffe66f049 --- /dev/null +++ b/NPCs/Providence/ProvSky.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs new file mode 100644 index 0000000000..514fd33a33 --- /dev/null +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/ProvSpawnDefense.png b/NPCs/Providence/ProvSpawnDefense.png new file mode 100644 index 0000000000..55f5b7ec1c Binary files /dev/null and b/NPCs/Providence/ProvSpawnDefense.png differ diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs new file mode 100644 index 0000000000..c2ffab16fb --- /dev/null +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/ProvSpawnHealer.png b/NPCs/Providence/ProvSpawnHealer.png new file mode 100644 index 0000000000..7f02f8ab4b Binary files /dev/null and b/NPCs/Providence/ProvSpawnHealer.png differ diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs new file mode 100644 index 0000000000..3831655336 --- /dev/null +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/ProvSpawnOffense.png b/NPCs/Providence/ProvSpawnOffense.png new file mode 100644 index 0000000000..d0559ae990 Binary files /dev/null and b/NPCs/Providence/ProvSpawnOffense.png differ diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs new file mode 100644 index 0000000000..f618391090 --- /dev/null +++ b/NPCs/Providence/Providence.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Providence/Providence.png b/NPCs/Providence/Providence.png new file mode 100644 index 0000000000..78d9e24a29 Binary files /dev/null and b/NPCs/Providence/Providence.png differ diff --git a/NPCs/Providence/ProvidenceAlt.png b/NPCs/Providence/ProvidenceAlt.png new file mode 100644 index 0000000000..967c031428 Binary files /dev/null and b/NPCs/Providence/ProvidenceAlt.png differ diff --git a/NPCs/Providence/ProvidenceAttack.png b/NPCs/Providence/ProvidenceAttack.png new file mode 100644 index 0000000000..f4886b1a47 Binary files /dev/null and b/NPCs/Providence/ProvidenceAttack.png differ diff --git a/NPCs/Providence/ProvidenceAttackAlt.png b/NPCs/Providence/ProvidenceAttackAlt.png new file mode 100644 index 0000000000..12a45fb050 Binary files /dev/null and b/NPCs/Providence/ProvidenceAttackAlt.png differ diff --git a/NPCs/Providence/ProvidenceDefense.png b/NPCs/Providence/ProvidenceDefense.png new file mode 100644 index 0000000000..4f7cacf054 Binary files /dev/null and b/NPCs/Providence/ProvidenceDefense.png differ diff --git a/NPCs/Providence/ProvidenceDefenseAlt.png b/NPCs/Providence/ProvidenceDefenseAlt.png new file mode 100644 index 0000000000..8c4186844a Binary files /dev/null and b/NPCs/Providence/ProvidenceDefenseAlt.png differ diff --git a/NPCs/Providence/Providence_Head_Boss.png b/NPCs/Providence/Providence_Head_Boss.png new file mode 100644 index 0000000000..00e2af96c2 Binary files /dev/null and b/NPCs/Providence/Providence_Head_Boss.png differ diff --git a/NPCs/Scavenger/FlamePillar.cs b/NPCs/Scavenger/FlamePillar.cs new file mode 100644 index 0000000000..932e682b2d --- /dev/null +++ b/NPCs/Scavenger/FlamePillar.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/FlamePillar.png b/NPCs/Scavenger/FlamePillar.png new file mode 100644 index 0000000000..4931e8e21c Binary files /dev/null and b/NPCs/Scavenger/FlamePillar.png differ diff --git a/NPCs/Scavenger/RockPillar.cs b/NPCs/Scavenger/RockPillar.cs new file mode 100644 index 0000000000..06d95ce9a4 --- /dev/null +++ b/NPCs/Scavenger/RockPillar.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/RockPillar.png b/NPCs/Scavenger/RockPillar.png new file mode 100644 index 0000000000..328ca88c5e Binary files /dev/null and b/NPCs/Scavenger/RockPillar.png differ diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs new file mode 100644 index 0000000000..9d2ed15e5c --- /dev/null +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -0,0 +1,605 @@ +using System; +using System.Collections.Generic; +using System.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 (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")); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerBody.png b/NPCs/Scavenger/ScavengerBody.png new file mode 100644 index 0000000000..eab0b3cdb2 Binary files /dev/null and b/NPCs/Scavenger/ScavengerBody.png differ diff --git a/NPCs/Scavenger/ScavengerBodyGlow.png b/NPCs/Scavenger/ScavengerBodyGlow.png new file mode 100644 index 0000000000..a8d32f3c91 Binary files /dev/null and b/NPCs/Scavenger/ScavengerBodyGlow.png differ diff --git a/NPCs/Scavenger/ScavengerBody_Head_Boss.png b/NPCs/Scavenger/ScavengerBody_Head_Boss.png new file mode 100644 index 0000000000..6d2f2d8800 Binary files /dev/null and b/NPCs/Scavenger/ScavengerBody_Head_Boss.png differ diff --git a/NPCs/Scavenger/ScavengerChain.png b/NPCs/Scavenger/ScavengerChain.png new file mode 100644 index 0000000000..8ba3e07252 Binary files /dev/null and b/NPCs/Scavenger/ScavengerChain.png differ diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs new file mode 100644 index 0000000000..6b703fd80b --- /dev/null +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -0,0 +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++; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawLeft.png b/NPCs/Scavenger/ScavengerClawLeft.png new file mode 100644 index 0000000000..78efbe35d2 Binary files /dev/null and b/NPCs/Scavenger/ScavengerClawLeft.png differ diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs new file mode 100644 index 0000000000..d70e18cc75 --- /dev/null +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -0,0 +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++; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawRight.png b/NPCs/Scavenger/ScavengerClawRight.png new file mode 100644 index 0000000000..116a48d6ea Binary files /dev/null and b/NPCs/Scavenger/ScavengerClawRight.png differ diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs new file mode 100644 index 0000000000..777f333a3a --- /dev/null +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerHead.png b/NPCs/Scavenger/ScavengerHead.png new file mode 100644 index 0000000000..fe5b9a8c0f Binary files /dev/null and b/NPCs/Scavenger/ScavengerHead.png differ diff --git a/NPCs/Scavenger/ScavengerHead2.cs b/NPCs/Scavenger/ScavengerHead2.cs new file mode 100644 index 0000000000..382184bf5f --- /dev/null +++ b/NPCs/Scavenger/ScavengerHead2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerHead2.png b/NPCs/Scavenger/ScavengerHead2.png new file mode 100644 index 0000000000..36ad4f6af2 Binary files /dev/null and b/NPCs/Scavenger/ScavengerHead2.png differ diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs new file mode 100644 index 0000000000..bbc29556a9 --- /dev/null +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerLegLeft.png b/NPCs/Scavenger/ScavengerLegLeft.png new file mode 100644 index 0000000000..b54bf2b2d4 Binary files /dev/null and b/NPCs/Scavenger/ScavengerLegLeft.png differ diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs new file mode 100644 index 0000000000..4a23f03399 --- /dev/null +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerLegRight.png b/NPCs/Scavenger/ScavengerLegRight.png new file mode 100644 index 0000000000..06eaa03b1c Binary files /dev/null and b/NPCs/Scavenger/ScavengerLegRight.png differ diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs new file mode 100644 index 0000000000..124eea0888 --- /dev/null +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGod.png b/NPCs/SlimeGod/SlimeGod.png new file mode 100644 index 0000000000..0f900812f0 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGod.png differ diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs new file mode 100644 index 0000000000..2bc1dd7f47 --- /dev/null +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodCore.png b/NPCs/SlimeGod/SlimeGodCore.png new file mode 100644 index 0000000000..f472dd75e4 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodCore.png differ diff --git a/NPCs/SlimeGod/SlimeGodCore_Head_Boss.png b/NPCs/SlimeGod/SlimeGodCore_Head_Boss.png new file mode 100644 index 0000000000..cc915bc6c4 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodCore_Head_Boss.png differ diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs new file mode 100644 index 0000000000..a6dbbb5884 --- /dev/null +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodRun.png b/NPCs/SlimeGod/SlimeGodRun.png new file mode 100644 index 0000000000..59d2f42a96 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodRun.png differ diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs new file mode 100644 index 0000000000..04f55fa1c8 --- /dev/null +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.png b/NPCs/SlimeGod/SlimeGodRunSplit.png new file mode 100644 index 0000000000..59d2f42a96 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodRunSplit.png differ diff --git a/NPCs/SlimeGod/SlimeGodRunSplit_Head_Boss.png b/NPCs/SlimeGod/SlimeGodRunSplit_Head_Boss.png new file mode 100644 index 0000000000..b7b04074b5 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodRunSplit_Head_Boss.png differ diff --git a/NPCs/SlimeGod/SlimeGodRun_Head_Boss.png b/NPCs/SlimeGod/SlimeGodRun_Head_Boss.png new file mode 100644 index 0000000000..b7b04074b5 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodRun_Head_Boss.png differ diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs new file mode 100644 index 0000000000..0016e74d51 --- /dev/null +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeGodSplit.png b/NPCs/SlimeGod/SlimeGodSplit.png new file mode 100644 index 0000000000..0f900812f0 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodSplit.png differ diff --git a/NPCs/SlimeGod/SlimeGodSplit_Head_Boss.png b/NPCs/SlimeGod/SlimeGodSplit_Head_Boss.png new file mode 100644 index 0000000000..a873d6cc02 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodSplit_Head_Boss.png differ diff --git a/NPCs/SlimeGod/SlimeGod_Head_Boss.png b/NPCs/SlimeGod/SlimeGod_Head_Boss.png new file mode 100644 index 0000000000..a873d6cc02 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGod_Head_Boss.png differ diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs new file mode 100644 index 0000000000..ec78327d27 --- /dev/null +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.png b/NPCs/SlimeGod/SlimeSpawnCorrupt.png new file mode 100644 index 0000000000..2e121e5961 Binary files /dev/null and b/NPCs/SlimeGod/SlimeSpawnCorrupt.png differ diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs new file mode 100644 index 0000000000..7af402f6d0 --- /dev/null +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.png b/NPCs/SlimeGod/SlimeSpawnCorrupt2.png new file mode 100644 index 0000000000..8f4cd7ad9c Binary files /dev/null and b/NPCs/SlimeGod/SlimeSpawnCorrupt2.png differ diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs new file mode 100644 index 0000000000..c9a520839f --- /dev/null +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.png b/NPCs/SlimeGod/SlimeSpawnCrimson.png new file mode 100644 index 0000000000..c66b3cff19 Binary files /dev/null and b/NPCs/SlimeGod/SlimeSpawnCrimson.png differ diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs new file mode 100644 index 0000000000..6a6c0212e2 --- /dev/null +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.png b/NPCs/SlimeGod/SlimeSpawnCrimson2.png new file mode 100644 index 0000000000..4bab57d4f3 Binary files /dev/null and b/NPCs/SlimeGod/SlimeSpawnCrimson2.png differ diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs new file mode 100644 index 0000000000..8efc253e89 --- /dev/null +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StasisProbe.png b/NPCs/StormWeaver/StasisProbe.png new file mode 100644 index 0000000000..3eb94d3501 Binary files /dev/null and b/NPCs/StormWeaver/StasisProbe.png differ diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs new file mode 100644 index 0000000000..18bfb11e4e --- /dev/null +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StasisProbeNaked.png b/NPCs/StormWeaver/StasisProbeNaked.png new file mode 100644 index 0000000000..c8e00d2e22 Binary files /dev/null and b/NPCs/StormWeaver/StasisProbeNaked.png differ diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs new file mode 100644 index 0000000000..a1895c9d1f --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverBody.png b/NPCs/StormWeaver/StormWeaverBody.png new file mode 100644 index 0000000000..17edfe50cd Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverBody.png differ diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs new file mode 100644 index 0000000000..cf7b5013c8 --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.png b/NPCs/StormWeaver/StormWeaverBodyNaked.png new file mode 100644 index 0000000000..2b23f660e8 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverBodyNaked.png differ diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs new file mode 100644 index 0000000000..9641dfbd1c --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverHead.png b/NPCs/StormWeaver/StormWeaverHead.png new file mode 100644 index 0000000000..4f86ebc42f Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverHead.png differ diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs new file mode 100644 index 0000000000..8a7ac00294 --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.png b/NPCs/StormWeaver/StormWeaverHeadNaked.png new file mode 100644 index 0000000000..8d23d7b0d5 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverHeadNaked.png differ diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss.png b/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss.png new file mode 100644 index 0000000000..8714adbe55 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss.png differ diff --git a/NPCs/StormWeaver/StormWeaverHead_Head_Boss.png b/NPCs/StormWeaver/StormWeaverHead_Head_Boss.png new file mode 100644 index 0000000000..8714adbe55 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverHead_Head_Boss.png differ diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs new file mode 100644 index 0000000000..0a8195c6e9 --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverTail.png b/NPCs/StormWeaver/StormWeaverTail.png new file mode 100644 index 0000000000..3be96ced3e Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverTail.png differ diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs new file mode 100644 index 0000000000..b89d18ae3c --- /dev/null +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.png b/NPCs/StormWeaver/StormWeaverTailNaked.png new file mode 100644 index 0000000000..276b6fda77 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverTailNaked.png differ diff --git a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs new file mode 100644 index 0000000000..bbb08ac602 --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalScreenShaderData : ScreenShaderData + { + private int SCalIndex; + + public SCalScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateSCalIndex(); + if (SCalIndex != -1) + { + UseTargetPosition(Main.npc[SCalIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/SupremeCalamitas/SCalSky.cs new file mode 100644 index 0000000000..159ee149cc --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalSky.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int SCalIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateSCalIndex()) + { + float x = 0f; + if (this.SCalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return true; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return SCalIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs new file mode 100644 index 0000000000..458d7d9559 --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormBody.png b/NPCs/SupremeCalamitas/SCalWormBody.png new file mode 100644 index 0000000000..5a37855ad8 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormBody.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBodyAlt.png b/NPCs/SupremeCalamitas/SCalWormBodyAlt.png new file mode 100644 index 0000000000..35971e8491 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormBodyAlt.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs new file mode 100644 index 0000000000..a9f5bf1602 --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.png b/NPCs/SupremeCalamitas/SCalWormBodyWeak.png new file mode 100644 index 0000000000..8bc8635d1b Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormBodyWeak.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs new file mode 100644 index 0000000000..a65b93ed8b --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormHead.png b/NPCs/SupremeCalamitas/SCalWormHead.png new file mode 100644 index 0000000000..8bd5ba6d26 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormHead.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs new file mode 100644 index 0000000000..355988156b --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.png b/NPCs/SupremeCalamitas/SCalWormHeart.png new file mode 100644 index 0000000000..8bc8635d1b Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormHeart.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs new file mode 100644 index 0000000000..bd50ba2a3c --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SCalWormTail.png b/NPCs/SupremeCalamitas/SCalWormTail.png new file mode 100644 index 0000000000..a8e1ab41e1 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormTail.png differ diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs new file mode 100644 index 0000000000..2546aea9fe --- /dev/null +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -0,0 +1,152 @@ +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; + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.png b/NPCs/SupremeCalamitas/SoulSeekerSupreme.png new file mode 100644 index 0000000000..6de0d63977 Binary files /dev/null and b/NPCs/SupremeCalamitas/SoulSeekerSupreme.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs new file mode 100644 index 0000000000..518e925d6f --- /dev/null +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png new file mode 100644 index 0000000000..2b98df718a Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png new file mode 100644 index 0000000000..cca69088f8 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs new file mode 100644 index 0000000000..a2ca4c1032 --- /dev/null +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.png b/NPCs/SupremeCalamitas/SupremeCataclysm.png new file mode 100644 index 0000000000..37798ec6d8 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCataclysm.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCataclysm_Head_Boss.png new file mode 100644 index 0000000000..ca5f787888 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCataclysm_Head_Boss.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs new file mode 100644 index 0000000000..bd53832a78 --- /dev/null +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.png b/NPCs/SupremeCalamitas/SupremeCatastrophe.png new file mode 100644 index 0000000000..50acb888fe Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCatastrophe.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png new file mode 100644 index 0000000000..16061784b8 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs new file mode 100644 index 0000000000..52313f4c39 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.png b/NPCs/TheDevourerofGods/DevourerofGodsBody.png new file mode 100644 index 0000000000..1152fd0f8d Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsBody.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs new file mode 100644 index 0000000000..0f100dfdf4 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.png b/NPCs/TheDevourerofGods/DevourerofGodsBody2.png new file mode 100644 index 0000000000..7d8067ae34 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsBody2.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs new file mode 100644 index 0000000000..308fea2f2a --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.png b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.png new file mode 100644 index 0000000000..8e9797d2c2 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS_Head_Boss.png b/NPCs/TheDevourerofGods/DevourerofGodsBodyS_Head_Boss.png new file mode 100644 index 0000000000..b6f7d9aaf9 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsBodyS_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs new file mode 100644 index 0000000000..a6540a3ebe --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.png b/NPCs/TheDevourerofGods/DevourerofGodsHead.png new file mode 100644 index 0000000000..cd1fda59fc Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsHead.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs new file mode 100644 index 0000000000..95adeeed84 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.png b/NPCs/TheDevourerofGods/DevourerofGodsHead2.png new file mode 100644 index 0000000000..a11d630fb1 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsHead2.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs new file mode 100644 index 0000000000..0d6272f44a --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.png b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.png new file mode 100644 index 0000000000..d10502a77c Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS_Head_Boss.png b/NPCs/TheDevourerofGods/DevourerofGodsHeadS_Head_Boss.png new file mode 100644 index 0000000000..8388060080 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsHeadS_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead_Head_Boss.png b/NPCs/TheDevourerofGods/DevourerofGodsHead_Head_Boss.png new file mode 100644 index 0000000000..9aac401b13 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsHead_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs new file mode 100644 index 0000000000..8357880724 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.png b/NPCs/TheDevourerofGods/DevourerofGodsTail.png new file mode 100644 index 0000000000..1046a2d157 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsTail.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs new file mode 100644 index 0000000000..ac1baec7d2 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.png b/NPCs/TheDevourerofGods/DevourerofGodsTail2.png new file mode 100644 index 0000000000..f04084a4ca Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsTail2.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs new file mode 100644 index 0000000000..28885e37c4 --- /dev/null +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.png b/NPCs/TheDevourerofGods/DevourerofGodsTailS.png new file mode 100644 index 0000000000..c1255c9323 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsTailS.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS_Head_Boss.png b/NPCs/TheDevourerofGods/DevourerofGodsTailS_Head_Boss.png new file mode 100644 index 0000000000..ed3dc857f2 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsTailS_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail_Head_Boss.png b/NPCs/TheDevourerofGods/DevourerofGodsTail_Head_Boss.png new file mode 100644 index 0000000000..7b5fc8ae71 Binary files /dev/null and b/NPCs/TheDevourerofGods/DevourerofGodsTail_Head_Boss.png differ diff --git a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs new file mode 100644 index 0000000000..6a07a86a4f --- /dev/null +++ b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGScreenShaderDataS : ScreenShaderData + { + private int DoGIndex; + + public DoGScreenShaderDataS(string passName) + : base(passName) + { + } + + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs new file mode 100644 index 0000000000..e5390f15b0 --- /dev/null +++ b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGScreenShaderData : ScreenShaderData + { + private int DoGIndex; + + public DoGScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DoGSky.cs b/NPCs/TheDevourerofGods/DoGSky.cs new file mode 100644 index 0000000000..63fc005159 --- /dev/null +++ b/NPCs/TheDevourerofGods/DoGSky.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DoGSkyS.cs b/NPCs/TheDevourerofGods/DoGSkyS.cs new file mode 100644 index 0000000000..c34130ca30 --- /dev/null +++ b/NPCs/TheDevourerofGods/DoGSkyS.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs new file mode 100644 index 0000000000..6cc818fdc6 --- /dev/null +++ b/NPCs/TownNPCs/DILF.cs @@ -0,0 +1,182 @@ +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; + } + } +} diff --git a/NPCs/TownNPCs/DILF.png b/NPCs/TownNPCs/DILF.png new file mode 100644 index 0000000000..62d5a0b102 Binary files /dev/null and b/NPCs/TownNPCs/DILF.png differ diff --git a/NPCs/TownNPCs/DILF_Head.png b/NPCs/TownNPCs/DILF_Head.png new file mode 100644 index 0000000000..1d00ede777 Binary files /dev/null and b/NPCs/TownNPCs/DILF_Head.png differ diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/FAP.png new file mode 100644 index 0000000000..e178949063 Binary files /dev/null and b/NPCs/TownNPCs/FAP.png differ diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs new file mode 100644 index 0000000000..99f422b89a --- /dev/null +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Yharon/DetonatingFlare.png b/NPCs/Yharon/DetonatingFlare.png new file mode 100644 index 0000000000..15404236f2 Binary files /dev/null and b/NPCs/Yharon/DetonatingFlare.png differ diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs new file mode 100644 index 0000000000..6c7c623770 --- /dev/null +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Yharon/DetonatingFlare2.png b/NPCs/Yharon/DetonatingFlare2.png new file mode 100644 index 0000000000..12f2c84bac Binary files /dev/null and b/NPCs/Yharon/DetonatingFlare2.png differ diff --git a/NPCs/Yharon/DetonatingFlare3.cs b/NPCs/Yharon/DetonatingFlare3.cs new file mode 100644 index 0000000000..41c0a7193d --- /dev/null +++ b/NPCs/Yharon/DetonatingFlare3.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/NPCs/Yharon/DetonatingFlare3.png b/NPCs/Yharon/DetonatingFlare3.png new file mode 100644 index 0000000000..15996588e9 Binary files /dev/null and b/NPCs/Yharon/DetonatingFlare3.png differ diff --git a/NPCs/Yharon/YScreenShader.cs b/NPCs/Yharon/YScreenShader.cs new file mode 100644 index 0000000000..2e5c8a81c8 --- /dev/null +++ b/NPCs/Yharon/YScreenShader.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Yharon +{ + public class YScreenShaderData : ScreenShaderData + { + private int YIndex; + + public YScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateYIndex(); + if (YIndex != -1) + { + UseTargetPosition(Main.npc[YIndex].Center); + } + base.Apply(); + } + } +} \ No newline at end of file diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs new file mode 100644 index 0000000000..14c32de928 --- /dev/null +++ b/NPCs/Yharon/YSky.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Yharon +{ + public class YSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int YIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateYIndex()) + { + float x = 0f; + if (this.YIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f; + } + return 0.66f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return true; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return YIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} \ No newline at end of file diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs new file mode 100644 index 0000000000..9b7c56d9e0 --- /dev/null +++ b/NPCs/Yharon/Yharon.cs @@ -0,0 +1,2820 @@ +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 + } +} \ No newline at end of file diff --git a/NPCs/Yharon/Yharon.png b/NPCs/Yharon/Yharon.png new file mode 100644 index 0000000000..4e090257d2 Binary files /dev/null and b/NPCs/Yharon/Yharon.png differ diff --git a/NPCs/Yharon/Yharon_Head_Boss.png b/NPCs/Yharon/Yharon_Head_Boss.png new file mode 100644 index 0000000000..5f06b6069a Binary files /dev/null and b/NPCs/Yharon/Yharon_Head_Boss.png differ diff --git a/Projectiles/AMR.cs b/Projectiles/AMR.cs new file mode 100644 index 0000000000..6e78a0a50a --- /dev/null +++ b/Projectiles/AMR.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AMR.png b/Projectiles/AMR.png new file mode 100644 index 0000000000..3f761a0306 Binary files /dev/null and b/Projectiles/AMR.png differ diff --git a/Projectiles/AMR2.cs b/Projectiles/AMR2.cs new file mode 100644 index 0000000000..e9b652b6b6 --- /dev/null +++ b/Projectiles/AMR2.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/AMR2.png b/Projectiles/AMR2.png new file mode 100644 index 0000000000..3f761a0306 Binary files /dev/null and b/Projectiles/AMR2.png differ diff --git a/Projectiles/AbyssBall.cs b/Projectiles/AbyssBall.cs new file mode 100644 index 0000000000..d1833467d2 --- /dev/null +++ b/Projectiles/AbyssBall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AbyssBall.png b/Projectiles/AbyssBall.png new file mode 100644 index 0000000000..fb4efb0594 Binary files /dev/null and b/Projectiles/AbyssBall.png differ diff --git a/Projectiles/AccelerationBullet.cs b/Projectiles/AccelerationBullet.cs new file mode 100644 index 0000000000..74c35a80d8 --- /dev/null +++ b/Projectiles/AccelerationBullet.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AccelerationBullet.png b/Projectiles/AccelerationBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/AccelerationBullet.png differ diff --git a/Projectiles/AccretionDisk.cs b/Projectiles/AccretionDisk.cs new file mode 100644 index 0000000000..fa891c4d6a --- /dev/null +++ b/Projectiles/AccretionDisk.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AccretionDisk.png b/Projectiles/AccretionDisk.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Projectiles/AccretionDisk.png differ diff --git a/Projectiles/AccretionDisk2.cs b/Projectiles/AccretionDisk2.cs new file mode 100644 index 0000000000..89c9ea4184 --- /dev/null +++ b/Projectiles/AccretionDisk2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AccretionDisk2.png b/Projectiles/AccretionDisk2.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Projectiles/AccretionDisk2.png differ diff --git a/Projectiles/AccretionDisk2Melee.cs b/Projectiles/AccretionDisk2Melee.cs new file mode 100644 index 0000000000..b9e35f1868 --- /dev/null +++ b/Projectiles/AccretionDisk2Melee.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AccretionDisk2Melee.png b/Projectiles/AccretionDisk2Melee.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Projectiles/AccretionDisk2Melee.png differ diff --git a/Projectiles/AccretionDiskMelee.cs b/Projectiles/AccretionDiskMelee.cs new file mode 100644 index 0000000000..0865b4d49b --- /dev/null +++ b/Projectiles/AccretionDiskMelee.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AccretionDiskMelee.png b/Projectiles/AccretionDiskMelee.png new file mode 100644 index 0000000000..e131c1a252 Binary files /dev/null and b/Projectiles/AccretionDiskMelee.png differ diff --git a/Projectiles/AcidBullet.cs b/Projectiles/AcidBullet.cs new file mode 100644 index 0000000000..5a5bd096d9 --- /dev/null +++ b/Projectiles/AcidBullet.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AcidBullet.png b/Projectiles/AcidBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/AcidBullet.png differ diff --git a/Projectiles/AdamantiteThrowingAxeProjectile.cs b/Projectiles/AdamantiteThrowingAxeProjectile.cs new file mode 100644 index 0000000000..9ef100c2d2 --- /dev/null +++ b/Projectiles/AdamantiteThrowingAxeProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AdamantiteThrowingAxeProjectile.png b/Projectiles/AdamantiteThrowingAxeProjectile.png new file mode 100644 index 0000000000..e11702e145 Binary files /dev/null and b/Projectiles/AdamantiteThrowingAxeProjectile.png differ diff --git a/Projectiles/AegisBeam.cs b/Projectiles/AegisBeam.cs new file mode 100644 index 0000000000..cd3c772110 --- /dev/null +++ b/Projectiles/AegisBeam.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AegisBeam.png b/Projectiles/AegisBeam.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/AegisBeam.png differ diff --git a/Projectiles/AegisBlast.cs b/Projectiles/AegisBlast.cs new file mode 100644 index 0000000000..987fe5e2b7 --- /dev/null +++ b/Projectiles/AegisBlast.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/AegisBlast.png b/Projectiles/AegisBlast.png new file mode 100644 index 0000000000..6330fa4b05 Binary files /dev/null and b/Projectiles/AegisBlast.png differ diff --git a/Projectiles/AegisBlast2.cs b/Projectiles/AegisBlast2.cs new file mode 100644 index 0000000000..5656253811 --- /dev/null +++ b/Projectiles/AegisBlast2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AegisBlast2.png b/Projectiles/AegisBlast2.png new file mode 100644 index 0000000000..872a2b413d Binary files /dev/null and b/Projectiles/AegisBlast2.png differ diff --git a/Projectiles/AegisFlame.cs b/Projectiles/AegisFlame.cs new file mode 100644 index 0000000000..ab0092725f --- /dev/null +++ b/Projectiles/AegisFlame.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AegisFlame.png b/Projectiles/AegisFlame.png new file mode 100644 index 0000000000..ee4239cbf9 Binary files /dev/null and b/Projectiles/AegisFlame.png differ diff --git a/Projectiles/AetherBeam.cs b/Projectiles/AetherBeam.cs new file mode 100644 index 0000000000..d66e256083 --- /dev/null +++ b/Projectiles/AetherBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AetherBeam.png b/Projectiles/AetherBeam.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/AetherBeam.png differ diff --git a/Projectiles/AirSpinnerProjectile.cs b/Projectiles/AirSpinnerProjectile.cs new file mode 100644 index 0000000000..e726bf6de8 --- /dev/null +++ b/Projectiles/AirSpinnerProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AirSpinnerProjectile.png b/Projectiles/AirSpinnerProjectile.png new file mode 100644 index 0000000000..136e511bd3 Binary files /dev/null and b/Projectiles/AirSpinnerProjectile.png differ diff --git a/Projectiles/Ancient.cs b/Projectiles/Ancient.cs new file mode 100644 index 0000000000..549fc0b0cc --- /dev/null +++ b/Projectiles/Ancient.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 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/Ancient.png b/Projectiles/Ancient.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/Ancient.png differ diff --git a/Projectiles/Ancient2.cs b/Projectiles/Ancient2.cs new file mode 100644 index 0000000000..2e2c630fca --- /dev/null +++ b/Projectiles/Ancient2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Ancient2.png b/Projectiles/Ancient2.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/Ancient2.png differ diff --git a/Projectiles/AngryChicken.cs b/Projectiles/AngryChicken.cs new file mode 100644 index 0000000000..4ac443b48f --- /dev/null +++ b/Projectiles/AngryChicken.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AngryChicken.png b/Projectiles/AngryChicken.png new file mode 100644 index 0000000000..dcb8dd272c Binary files /dev/null and b/Projectiles/AngryChicken.png differ diff --git a/Projectiles/AortaProjectile.cs b/Projectiles/AortaProjectile.cs new file mode 100644 index 0000000000..929fb46569 --- /dev/null +++ b/Projectiles/AortaProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AortaProjectile.png b/Projectiles/AortaProjectile.png new file mode 100644 index 0000000000..553df87b2e Binary files /dev/null and b/Projectiles/AortaProjectile.png differ diff --git a/Projectiles/ApothChloro.cs b/Projectiles/ApothChloro.cs new file mode 100644 index 0000000000..a42b6623e8 --- /dev/null +++ b/Projectiles/ApothChloro.cs @@ -0,0 +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); + } + } +} diff --git a/Projectiles/ApothChloro.png b/Projectiles/ApothChloro.png new file mode 100644 index 0000000000..a17ddc8d5d Binary files /dev/null and b/Projectiles/ApothChloro.png differ diff --git a/Projectiles/ApothJaws.cs b/Projectiles/ApothJaws.cs new file mode 100644 index 0000000000..732395a533 --- /dev/null +++ b/Projectiles/ApothJaws.cs @@ -0,0 +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); + } + } + } +} diff --git a/Projectiles/ApothJaws.png b/Projectiles/ApothJaws.png new file mode 100644 index 0000000000..4341582399 Binary files /dev/null and b/Projectiles/ApothJaws.png differ diff --git a/Projectiles/ApothMark.cs b/Projectiles/ApothMark.cs new file mode 100644 index 0000000000..40c5c73b73 --- /dev/null +++ b/Projectiles/ApothMark.cs @@ -0,0 +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); + } + } + } +} diff --git a/Projectiles/ApothMark.png b/Projectiles/ApothMark.png new file mode 100644 index 0000000000..e729eeddfe Binary files /dev/null and b/Projectiles/ApothMark.png differ diff --git a/Projectiles/AquaBlast.cs b/Projectiles/AquaBlast.cs new file mode 100644 index 0000000000..bf6e2893fd --- /dev/null +++ b/Projectiles/AquaBlast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AquaBlast.png b/Projectiles/AquaBlast.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/AquaBlast.png differ diff --git a/Projectiles/AquaBlastToxic.cs b/Projectiles/AquaBlastToxic.cs new file mode 100644 index 0000000000..99abdc52d1 --- /dev/null +++ b/Projectiles/AquaBlastToxic.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/AquaBlastToxic.png b/Projectiles/AquaBlastToxic.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/AquaBlastToxic.png differ diff --git a/Projectiles/AquaticStar.cs b/Projectiles/AquaticStar.cs new file mode 100644 index 0000000000..8ec5d3db95 --- /dev/null +++ b/Projectiles/AquaticStar.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AquaticStar.png b/Projectiles/AquaticStar.png new file mode 100644 index 0000000000..aa1ec4c4c2 Binary files /dev/null and b/Projectiles/AquaticStar.png differ diff --git a/Projectiles/Archerfish.cs b/Projectiles/Archerfish.cs new file mode 100644 index 0000000000..f9130e3fea --- /dev/null +++ b/Projectiles/Archerfish.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Archerfish.png b/Projectiles/Archerfish.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Archerfish.png differ diff --git a/Projectiles/ArcticArrow.cs b/Projectiles/ArcticArrow.cs new file mode 100644 index 0000000000..67433d37e7 --- /dev/null +++ b/Projectiles/ArcticArrow.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ArcticArrow.png b/Projectiles/ArcticArrow.png new file mode 100644 index 0000000000..d545b77daf Binary files /dev/null and b/Projectiles/ArcticArrow.png differ diff --git a/Projectiles/Asteroid.cs b/Projectiles/Asteroid.cs new file mode 100644 index 0000000000..6da080a3a7 --- /dev/null +++ b/Projectiles/Asteroid.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Asteroid.png b/Projectiles/Asteroid.png new file mode 100644 index 0000000000..85ede611fc Binary files /dev/null and b/Projectiles/Asteroid.png differ diff --git a/Projectiles/AsteroidMolten.cs b/Projectiles/AsteroidMolten.cs new file mode 100644 index 0000000000..8b3bbf2309 --- /dev/null +++ b/Projectiles/AsteroidMolten.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AsteroidMolten.png b/Projectiles/AsteroidMolten.png new file mode 100644 index 0000000000..fb8c90197e Binary files /dev/null and b/Projectiles/AsteroidMolten.png differ diff --git a/Projectiles/AstralPike.cs b/Projectiles/AstralPike.cs new file mode 100644 index 0000000000..061ab590e3 --- /dev/null +++ b/Projectiles/AstralPike.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AstralPike.png b/Projectiles/AstralPike.png new file mode 100644 index 0000000000..8fabd45206 Binary files /dev/null and b/Projectiles/AstralPike.png differ diff --git a/Projectiles/AstralRound.cs b/Projectiles/AstralRound.cs new file mode 100644 index 0000000000..10d642f91e --- /dev/null +++ b/Projectiles/AstralRound.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AstralRound.png b/Projectiles/AstralRound.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/AstralRound.png differ diff --git a/Projectiles/AstralShot.cs b/Projectiles/AstralShot.cs new file mode 100644 index 0000000000..9dcf4231aa --- /dev/null +++ b/Projectiles/AstralShot.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/AstralShot.png b/Projectiles/AstralShot.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/AstralShot.png differ diff --git a/Projectiles/AstralStar.cs b/Projectiles/AstralStar.cs new file mode 100644 index 0000000000..22f2a1bc92 --- /dev/null +++ b/Projectiles/AstralStar.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AstralStar.png b/Projectiles/AstralStar.png new file mode 100644 index 0000000000..bcd3ed059d Binary files /dev/null and b/Projectiles/AstralStar.png differ diff --git a/Projectiles/AstrealArrow.cs b/Projectiles/AstrealArrow.cs new file mode 100644 index 0000000000..e3546a97db --- /dev/null +++ b/Projectiles/AstrealArrow.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 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/AstrealArrow.png b/Projectiles/AstrealArrow.png new file mode 100644 index 0000000000..d267aab942 Binary files /dev/null and b/Projectiles/AstrealArrow.png differ diff --git a/Projectiles/AtaxiaHealOrb.cs b/Projectiles/AtaxiaHealOrb.cs new file mode 100644 index 0000000000..84dfb69180 --- /dev/null +++ b/Projectiles/AtaxiaHealOrb.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/AtaxiaHealOrb.png b/Projectiles/AtaxiaHealOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/AtaxiaHealOrb.png differ diff --git a/Projectiles/AtaxiaOrb.cs b/Projectiles/AtaxiaOrb.cs new file mode 100644 index 0000000000..cd510eef07 --- /dev/null +++ b/Projectiles/AtaxiaOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/AtaxiaOrb.png b/Projectiles/AtaxiaOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/AtaxiaOrb.png differ diff --git a/Projectiles/AtlantisSpear.cs b/Projectiles/AtlantisSpear.cs new file mode 100644 index 0000000000..9e00a93e8e --- /dev/null +++ b/Projectiles/AtlantisSpear.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AtlantisSpear.png b/Projectiles/AtlantisSpear.png new file mode 100644 index 0000000000..9ac770b5b5 Binary files /dev/null and b/Projectiles/AtlantisSpear.png differ diff --git a/Projectiles/AtlantisSpear2.cs b/Projectiles/AtlantisSpear2.cs new file mode 100644 index 0000000000..e8b23abdb7 --- /dev/null +++ b/Projectiles/AtlantisSpear2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AtlantisSpear2.png b/Projectiles/AtlantisSpear2.png new file mode 100644 index 0000000000..9ac770b5b5 Binary files /dev/null and b/Projectiles/AtlantisSpear2.png differ diff --git a/Projectiles/AuraRain.cs b/Projectiles/AuraRain.cs new file mode 100644 index 0000000000..f73802c415 --- /dev/null +++ b/Projectiles/AuraRain.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AuraRain.png b/Projectiles/AuraRain.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/AuraRain.png differ diff --git a/Projectiles/AuricOrb.cs b/Projectiles/AuricOrb.cs new file mode 100644 index 0000000000..08c10204e2 --- /dev/null +++ b/Projectiles/AuricOrb.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AuricOrb.png b/Projectiles/AuricOrb.png new file mode 100644 index 0000000000..f47982519d Binary files /dev/null and b/Projectiles/AuricOrb.png differ diff --git a/Projectiles/AzathothProjectile.cs b/Projectiles/AzathothProjectile.cs new file mode 100644 index 0000000000..8794c490af --- /dev/null +++ b/Projectiles/AzathothProjectile.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/AzathothProjectile.png b/Projectiles/AzathothProjectile.png new file mode 100644 index 0000000000..d59b355713 Binary files /dev/null and b/Projectiles/AzathothProjectile.png differ diff --git a/Projectiles/BabyPlaguebringer.png b/Projectiles/BabyPlaguebringer.png new file mode 100644 index 0000000000..9103613fa4 Binary files /dev/null and b/Projectiles/BabyPlaguebringer.png differ diff --git a/Projectiles/BalefulHarvesterProjectile.cs b/Projectiles/BalefulHarvesterProjectile.cs new file mode 100644 index 0000000000..2659811c01 --- /dev/null +++ b/Projectiles/BalefulHarvesterProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BalefulHarvesterProjectile.png b/Projectiles/BalefulHarvesterProjectile.png new file mode 100644 index 0000000000..55fa05c28b Binary files /dev/null and b/Projectiles/BalefulHarvesterProjectile.png differ diff --git a/Projectiles/BallOFugu.cs b/Projectiles/BallOFugu.cs new file mode 100644 index 0000000000..65388b5f98 --- /dev/null +++ b/Projectiles/BallOFugu.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BallOFugu.png b/Projectiles/BallOFugu.png new file mode 100644 index 0000000000..f4673a0825 Binary files /dev/null and b/Projectiles/BallOFugu.png differ diff --git a/Projectiles/BallistaGreatArrow.cs b/Projectiles/BallistaGreatArrow.cs new file mode 100644 index 0000000000..002bd5b36e --- /dev/null +++ b/Projectiles/BallistaGreatArrow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BallistaGreatArrow.png b/Projectiles/BallistaGreatArrow.png new file mode 100644 index 0000000000..afeea0b8fc Binary files /dev/null and b/Projectiles/BallistaGreatArrow.png differ diff --git a/Projectiles/BallisticPoisonBomb.cs b/Projectiles/BallisticPoisonBomb.cs new file mode 100644 index 0000000000..4ad3ecafec --- /dev/null +++ b/Projectiles/BallisticPoisonBomb.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/BallisticPoisonBomb.png b/Projectiles/BallisticPoisonBomb.png new file mode 100644 index 0000000000..4a42eba001 Binary files /dev/null and b/Projectiles/BallisticPoisonBomb.png differ diff --git a/Projectiles/BallisticPoisonBombSpike.cs b/Projectiles/BallisticPoisonBombSpike.cs new file mode 100644 index 0000000000..0a549288a7 --- /dev/null +++ b/Projectiles/BallisticPoisonBombSpike.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 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/BallisticPoisonBombSpike.png b/Projectiles/BallisticPoisonBombSpike.png new file mode 100644 index 0000000000..91b655fe47 Binary files /dev/null and b/Projectiles/BallisticPoisonBombSpike.png differ diff --git a/Projectiles/BallisticPoisonCloud.cs b/Projectiles/BallisticPoisonCloud.cs new file mode 100644 index 0000000000..a92d5d580e --- /dev/null +++ b/Projectiles/BallisticPoisonCloud.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BallisticPoisonCloud.png b/Projectiles/BallisticPoisonCloud.png new file mode 100644 index 0000000000..65fcbd400d Binary files /dev/null and b/Projectiles/BallisticPoisonCloud.png differ diff --git a/Projectiles/BallisticPoisonCloud2.cs b/Projectiles/BallisticPoisonCloud2.cs new file mode 100644 index 0000000000..f511c32af0 --- /dev/null +++ b/Projectiles/BallisticPoisonCloud2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BallisticPoisonCloud2.png b/Projectiles/BallisticPoisonCloud2.png new file mode 100644 index 0000000000..9c040a1165 Binary files /dev/null and b/Projectiles/BallisticPoisonCloud2.png differ diff --git a/Projectiles/BallisticPoisonCloud3.cs b/Projectiles/BallisticPoisonCloud3.cs new file mode 100644 index 0000000000..e3c03278ed --- /dev/null +++ b/Projectiles/BallisticPoisonCloud3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BallisticPoisonCloud3.png b/Projectiles/BallisticPoisonCloud3.png new file mode 100644 index 0000000000..49ca5a9c3e Binary files /dev/null and b/Projectiles/BallisticPoisonCloud3.png differ diff --git a/Projectiles/BansheeHook.cs b/Projectiles/BansheeHook.cs new file mode 100644 index 0000000000..5870c27db6 --- /dev/null +++ b/Projectiles/BansheeHook.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BansheeHook.png b/Projectiles/BansheeHook.png new file mode 100644 index 0000000000..175e147b92 Binary files /dev/null and b/Projectiles/BansheeHook.png differ diff --git a/Projectiles/BansheeHookAlt.png b/Projectiles/BansheeHookAlt.png new file mode 100644 index 0000000000..d117ac966e Binary files /dev/null and b/Projectiles/BansheeHookAlt.png differ diff --git a/Projectiles/BansheeHookBoom.cs b/Projectiles/BansheeHookBoom.cs new file mode 100644 index 0000000000..3ca6355504 --- /dev/null +++ b/Projectiles/BansheeHookBoom.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BansheeHookBoom.png b/Projectiles/BansheeHookBoom.png new file mode 100644 index 0000000000..59a8c48354 Binary files /dev/null and b/Projectiles/BansheeHookBoom.png differ diff --git a/Projectiles/BansheeHookScythe.cs b/Projectiles/BansheeHookScythe.cs new file mode 100644 index 0000000000..6b897c1bb6 --- /dev/null +++ b/Projectiles/BansheeHookScythe.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BansheeHookScythe.png b/Projectiles/BansheeHookScythe.png new file mode 100644 index 0000000000..c1c6f23d01 Binary files /dev/null and b/Projectiles/BansheeHookScythe.png differ diff --git a/Projectiles/BeamingBolt.cs b/Projectiles/BeamingBolt.cs new file mode 100644 index 0000000000..5dc39606f2 --- /dev/null +++ b/Projectiles/BeamingBolt.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/BeamingBolt.png b/Projectiles/BeamingBolt.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/BeamingBolt.png differ diff --git a/Projectiles/BeamingBolt2.cs b/Projectiles/BeamingBolt2.cs new file mode 100644 index 0000000000..5e33fc771c --- /dev/null +++ b/Projectiles/BeamingBolt2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BeamingBolt2.png b/Projectiles/BeamingBolt2.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/BeamingBolt2.png differ diff --git a/Projectiles/BeeRPG.cs b/Projectiles/BeeRPG.cs new file mode 100644 index 0000000000..5432126533 --- /dev/null +++ b/Projectiles/BeeRPG.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BeeRPG.png b/Projectiles/BeeRPG.png new file mode 100644 index 0000000000..8991dcf5ea Binary files /dev/null and b/Projectiles/BeeRPG.png differ diff --git a/Projectiles/BeeRPGExplosion.cs b/Projectiles/BeeRPGExplosion.cs new file mode 100644 index 0000000000..c97c593b9d --- /dev/null +++ b/Projectiles/BeeRPGExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BeeRPGExplosion.png b/Projectiles/BeeRPGExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BeeRPGExplosion.png differ diff --git a/Projectiles/BigBeamofDeath.cs b/Projectiles/BigBeamofDeath.cs new file mode 100644 index 0000000000..49ed73d568 --- /dev/null +++ b/Projectiles/BigBeamofDeath.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BigBeamofDeath.png b/Projectiles/BigBeamofDeath.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/BigBeamofDeath.png differ diff --git a/Projectiles/BigBeamofDeath2.cs b/Projectiles/BigBeamofDeath2.cs new file mode 100644 index 0000000000..2894e478f5 --- /dev/null +++ b/Projectiles/BigBeamofDeath2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BigBeamofDeath2.png b/Projectiles/BigBeamofDeath2.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/BigBeamofDeath2.png differ diff --git a/Projectiles/BigBustyRose.cs b/Projectiles/BigBustyRose.cs new file mode 100644 index 0000000000..0cc227048d --- /dev/null +++ b/Projectiles/BigBustyRose.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BigBustyRose.png b/Projectiles/BigBustyRose.png new file mode 100644 index 0000000000..2a813e3c9b Binary files /dev/null and b/Projectiles/BigBustyRose.png differ diff --git a/Projectiles/BigNuke.cs b/Projectiles/BigNuke.cs new file mode 100644 index 0000000000..8efa272467 --- /dev/null +++ b/Projectiles/BigNuke.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BigNuke.png b/Projectiles/BigNuke.png new file mode 100644 index 0000000000..b6fbd0efbb Binary files /dev/null and b/Projectiles/BigNuke.png differ diff --git a/Projectiles/BigNukeExplosion.cs b/Projectiles/BigNukeExplosion.cs new file mode 100644 index 0000000000..6a0fd2e20f --- /dev/null +++ b/Projectiles/BigNukeExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BigNukeExplosion.png b/Projectiles/BigNukeExplosion.png new file mode 100644 index 0000000000..30e25310b2 Binary files /dev/null and b/Projectiles/BigNukeExplosion.png differ diff --git a/Projectiles/BiomeOrb.cs b/Projectiles/BiomeOrb.cs new file mode 100644 index 0000000000..6cf7d5eff9 --- /dev/null +++ b/Projectiles/BiomeOrb.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BiomeOrb.png b/Projectiles/BiomeOrb.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/BiomeOrb.png differ diff --git a/Projectiles/BlackAnurian.cs b/Projectiles/BlackAnurian.cs new file mode 100644 index 0000000000..67a706d447 --- /dev/null +++ b/Projectiles/BlackAnurian.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BlackAnurian.png b/Projectiles/BlackAnurian.png new file mode 100644 index 0000000000..afc1463b5d Binary files /dev/null and b/Projectiles/BlackAnurian.png differ diff --git a/Projectiles/BlackAnurianPlankton.cs b/Projectiles/BlackAnurianPlankton.cs new file mode 100644 index 0000000000..65dd920df0 --- /dev/null +++ b/Projectiles/BlackAnurianPlankton.cs @@ -0,0 +1,121 @@ +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BlackAnurianPlankton.png b/Projectiles/BlackAnurianPlankton.png new file mode 100644 index 0000000000..6ae200c22a Binary files /dev/null and b/Projectiles/BlackAnurianPlankton.png differ diff --git a/Projectiles/BlazingPhantomBlade.cs b/Projectiles/BlazingPhantomBlade.cs new file mode 100644 index 0000000000..99b69371f0 --- /dev/null +++ b/Projectiles/BlazingPhantomBlade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BlazingPhantomBlade.png b/Projectiles/BlazingPhantomBlade.png new file mode 100644 index 0000000000..2041e18546 Binary files /dev/null and b/Projectiles/BlazingPhantomBlade.png differ diff --git a/Projectiles/Blood.cs b/Projectiles/Blood.cs new file mode 100644 index 0000000000..0f51f628b0 --- /dev/null +++ b/Projectiles/Blood.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Blood.png b/Projectiles/Blood.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Blood.png differ diff --git a/Projectiles/BloodBall.cs b/Projectiles/BloodBall.cs new file mode 100644 index 0000000000..f376be4a9b --- /dev/null +++ b/Projectiles/BloodBall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodBall.png b/Projectiles/BloodBall.png new file mode 100644 index 0000000000..51cdbf9443 Binary files /dev/null and b/Projectiles/BloodBall.png differ diff --git a/Projectiles/BloodBeam.cs b/Projectiles/BloodBeam.cs new file mode 100644 index 0000000000..61badee875 --- /dev/null +++ b/Projectiles/BloodBeam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodBeam.png b/Projectiles/BloodBeam.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/BloodBeam.png differ diff --git a/Projectiles/BloodBlast.cs b/Projectiles/BloodBlast.cs new file mode 100644 index 0000000000..52e4b77ae8 --- /dev/null +++ b/Projectiles/BloodBlast.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodBlast.png b/Projectiles/BloodBlast.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/BloodBlast.png differ diff --git a/Projectiles/BloodBolt.cs b/Projectiles/BloodBolt.cs new file mode 100644 index 0000000000..c04d7eadce --- /dev/null +++ b/Projectiles/BloodBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodBolt.png b/Projectiles/BloodBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/BloodBolt.png differ diff --git a/Projectiles/BloodBomb.cs b/Projectiles/BloodBomb.cs new file mode 100644 index 0000000000..2b500e99ba --- /dev/null +++ b/Projectiles/BloodBomb.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodBomb.png b/Projectiles/BloodBomb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BloodBomb.png differ diff --git a/Projectiles/BloodBombExplosion.cs b/Projectiles/BloodBombExplosion.cs new file mode 100644 index 0000000000..681fd2b78d --- /dev/null +++ b/Projectiles/BloodBombExplosion.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/BloodBombExplosion.png b/Projectiles/BloodBombExplosion.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/BloodBombExplosion.png differ diff --git a/Projectiles/BloodClotFriendly.cs b/Projectiles/BloodClotFriendly.cs new file mode 100644 index 0000000000..8c08703e2c --- /dev/null +++ b/Projectiles/BloodClotFriendly.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodClotFriendly.png b/Projectiles/BloodClotFriendly.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/BloodClotFriendly.png differ diff --git a/Projectiles/BloodClotMinion.cs b/Projectiles/BloodClotMinion.cs new file mode 100644 index 0000000000..ae268729d0 --- /dev/null +++ b/Projectiles/BloodClotMinion.cs @@ -0,0 +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; + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodClotMinion.png b/Projectiles/BloodClotMinion.png new file mode 100644 index 0000000000..d31947d5bb Binary files /dev/null and b/Projectiles/BloodClotMinion.png differ diff --git a/Projectiles/BloodOrb.cs b/Projectiles/BloodOrb.cs new file mode 100644 index 0000000000..433e591e2c --- /dev/null +++ b/Projectiles/BloodOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodOrb.png b/Projectiles/BloodOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BloodOrb.png differ diff --git a/Projectiles/BloodRay.cs b/Projectiles/BloodRay.cs new file mode 100644 index 0000000000..ad2910042c --- /dev/null +++ b/Projectiles/BloodRay.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodRay.png b/Projectiles/BloodRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/BloodRay.png differ diff --git a/Projectiles/BloodScythe.cs b/Projectiles/BloodScythe.cs new file mode 100644 index 0000000000..2ea1a46862 --- /dev/null +++ b/Projectiles/BloodScythe.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodScythe.png b/Projectiles/BloodScythe.png new file mode 100644 index 0000000000..0b53daf2ba Binary files /dev/null and b/Projectiles/BloodScythe.png differ diff --git a/Projectiles/BloodfireArrow.cs b/Projectiles/BloodfireArrow.cs new file mode 100644 index 0000000000..c2566aa607 --- /dev/null +++ b/Projectiles/BloodfireArrow.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodfireArrow.png b/Projectiles/BloodfireArrow.png new file mode 100644 index 0000000000..27358b7594 Binary files /dev/null and b/Projectiles/BloodfireArrow.png differ diff --git a/Projectiles/BloodfireBullet.cs b/Projectiles/BloodfireBullet.cs new file mode 100644 index 0000000000..8de5f837ce --- /dev/null +++ b/Projectiles/BloodfireBullet.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodfireBullet.png b/Projectiles/BloodfireBullet.png new file mode 100644 index 0000000000..8bf58f71c3 Binary files /dev/null and b/Projectiles/BloodfireBullet.png differ diff --git a/Projectiles/BloodflareSoul.cs b/Projectiles/BloodflareSoul.cs new file mode 100644 index 0000000000..c849438690 --- /dev/null +++ b/Projectiles/BloodflareSoul.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodflareSoul.png b/Projectiles/BloodflareSoul.png new file mode 100644 index 0000000000..df00ab41d5 Binary files /dev/null and b/Projectiles/BloodflareSoul.png differ diff --git a/Projectiles/BloodyBlade.cs b/Projectiles/BloodyBlade.cs new file mode 100644 index 0000000000..49038caed3 --- /dev/null +++ b/Projectiles/BloodyBlade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BloodyBlade.png b/Projectiles/BloodyBlade.png new file mode 100644 index 0000000000..1c3f739d78 Binary files /dev/null and b/Projectiles/BloodyBlade.png differ diff --git a/Projectiles/BlueAura.cs b/Projectiles/BlueAura.cs new file mode 100644 index 0000000000..0f82be1711 --- /dev/null +++ b/Projectiles/BlueAura.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BlueAura.png b/Projectiles/BlueAura.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BlueAura.png differ diff --git a/Projectiles/BlueBubble.cs b/Projectiles/BlueBubble.cs new file mode 100644 index 0000000000..ce7acf5be6 --- /dev/null +++ b/Projectiles/BlueBubble.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 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/BlueBubble.png b/Projectiles/BlueBubble.png new file mode 100644 index 0000000000..479a56ea6c Binary files /dev/null and b/Projectiles/BlueBubble.png differ diff --git a/Projectiles/BlueExoArrow.cs b/Projectiles/BlueExoArrow.cs new file mode 100644 index 0000000000..a07ec91d3e --- /dev/null +++ b/Projectiles/BlueExoArrow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BlueExoArrow.png b/Projectiles/BlueExoArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/BlueExoArrow.png differ diff --git a/Projectiles/BlueExoArrow2.cs b/Projectiles/BlueExoArrow2.cs new file mode 100644 index 0000000000..02b84de8fb --- /dev/null +++ b/Projectiles/BlueExoArrow2.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 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/BlueExoArrow2.png b/Projectiles/BlueExoArrow2.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/BlueExoArrow2.png differ diff --git a/Projectiles/BlushieStaffProj.cs b/Projectiles/BlushieStaffProj.cs new file mode 100644 index 0000000000..47d1c2dad0 --- /dev/null +++ b/Projectiles/BlushieStaffProj.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BlushieStaffProj.png b/Projectiles/BlushieStaffProj.png new file mode 100644 index 0000000000..c6616b4227 Binary files /dev/null and b/Projectiles/BlushieStaffProj.png differ diff --git a/Projectiles/Bolt.cs b/Projectiles/Bolt.cs new file mode 100644 index 0000000000..1eaf7e32cf --- /dev/null +++ b/Projectiles/Bolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Bolt.png b/Projectiles/Bolt.png new file mode 100644 index 0000000000..aafe8e3624 Binary files /dev/null and b/Projectiles/Bolt.png differ diff --git a/Projectiles/BoltArrow.cs b/Projectiles/BoltArrow.cs new file mode 100644 index 0000000000..636ee588aa --- /dev/null +++ b/Projectiles/BoltArrow.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BoltArrow.png b/Projectiles/BoltArrow.png new file mode 100644 index 0000000000..05fef8838e Binary files /dev/null and b/Projectiles/BoltArrow.png differ diff --git a/Projectiles/BoltExplosion.cs b/Projectiles/BoltExplosion.cs new file mode 100644 index 0000000000..96f8bed000 --- /dev/null +++ b/Projectiles/BoltExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BoltExplosion.png b/Projectiles/BoltExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BoltExplosion.png differ diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs new file mode 100644 index 0000000000..f4cafc7c22 --- /dev/null +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/AbyssBallVolley.png b/Projectiles/Boss/AbyssBallVolley.png new file mode 100644 index 0000000000..fb4efb0594 Binary files /dev/null and b/Projectiles/Boss/AbyssBallVolley.png differ diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs new file mode 100644 index 0000000000..5199070113 --- /dev/null +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/AbyssBallVolley2.png b/Projectiles/Boss/AbyssBallVolley2.png new file mode 100644 index 0000000000..cd627fab02 Binary files /dev/null and b/Projectiles/Boss/AbyssBallVolley2.png differ diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs new file mode 100644 index 0000000000..d1557fa181 --- /dev/null +++ b/Projectiles/Boss/AbyssMine.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/AbyssMine.png b/Projectiles/Boss/AbyssMine.png new file mode 100644 index 0000000000..fb4efb0594 Binary files /dev/null and b/Projectiles/Boss/AbyssMine.png differ diff --git a/Projectiles/Boss/AbyssMine2.cs b/Projectiles/Boss/AbyssMine2.cs new file mode 100644 index 0000000000..b61528e689 --- /dev/null +++ b/Projectiles/Boss/AbyssMine2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/AbyssMine2.png b/Projectiles/Boss/AbyssMine2.png new file mode 100644 index 0000000000..cd627fab02 Binary files /dev/null and b/Projectiles/Boss/AbyssMine2.png differ diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs new file mode 100644 index 0000000000..5564b2b6b1 --- /dev/null +++ b/Projectiles/Boss/AstralFlame.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/AstralFlame.png b/Projectiles/Boss/AstralFlame.png new file mode 100644 index 0000000000..22b01c0608 Binary files /dev/null and b/Projectiles/Boss/AstralFlame.png differ diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs new file mode 100644 index 0000000000..0129c36177 --- /dev/null +++ b/Projectiles/Boss/AstralLaser.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/AstralLaser.png b/Projectiles/Boss/AstralLaser.png new file mode 100644 index 0000000000..2849a09e02 Binary files /dev/null and b/Projectiles/Boss/AstralLaser.png differ diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs new file mode 100644 index 0000000000..ddfa50a428 --- /dev/null +++ b/Projectiles/Boss/AstralShot2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/AstralShot2.png b/Projectiles/Boss/AstralShot2.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Boss/AstralShot2.png differ diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs new file mode 100644 index 0000000000..76190d262d --- /dev/null +++ b/Projectiles/Boss/BigFlare.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BigFlare.png b/Projectiles/Boss/BigFlare.png new file mode 100644 index 0000000000..e95a91ba0e Binary files /dev/null and b/Projectiles/Boss/BigFlare.png differ diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs new file mode 100644 index 0000000000..e3ec666525 --- /dev/null +++ b/Projectiles/Boss/BloodClot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BloodClot.png b/Projectiles/Boss/BloodClot.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Boss/BloodClot.png differ diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs new file mode 100644 index 0000000000..222c77e519 --- /dev/null +++ b/Projectiles/Boss/BloodGeyser.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BloodGeyser.png b/Projectiles/Boss/BloodGeyser.png new file mode 100644 index 0000000000..6d1457c84e Binary files /dev/null and b/Projectiles/Boss/BloodGeyser.png differ diff --git a/Projectiles/Boss/BrimDust.cs b/Projectiles/Boss/BrimDust.cs new file mode 100644 index 0000000000..a3400649b3 --- /dev/null +++ b/Projectiles/Boss/BrimDust.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimDust.png b/Projectiles/Boss/BrimDust.png new file mode 100644 index 0000000000..59a8c48354 Binary files /dev/null and b/Projectiles/Boss/BrimDust.png differ diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs new file mode 100644 index 0000000000..c9418ca783 --- /dev/null +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/BrimstoneBall.png b/Projectiles/Boss/BrimstoneBall.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Boss/BrimstoneBall.png differ diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs new file mode 100644 index 0000000000..062ba342f8 --- /dev/null +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneBarrage.png b/Projectiles/Boss/BrimstoneBarrage.png new file mode 100644 index 0000000000..ed87c1d91e Binary files /dev/null and b/Projectiles/Boss/BrimstoneBarrage.png differ diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs new file mode 100644 index 0000000000..c85a0728e4 --- /dev/null +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneFire.png b/Projectiles/Boss/BrimstoneFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Boss/BrimstoneFire.png differ diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs new file mode 100644 index 0000000000..87c2ce6ff2 --- /dev/null +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/BrimstoneFireblast.png b/Projectiles/Boss/BrimstoneFireblast.png new file mode 100644 index 0000000000..4a3744b8ce Binary files /dev/null and b/Projectiles/Boss/BrimstoneFireblast.png differ diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs new file mode 100644 index 0000000000..0863c43715 --- /dev/null +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneGigaBlast.png b/Projectiles/Boss/BrimstoneGigaBlast.png new file mode 100644 index 0000000000..335d36e530 Binary files /dev/null and b/Projectiles/Boss/BrimstoneGigaBlast.png differ diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs new file mode 100644 index 0000000000..7db0e5fcab --- /dev/null +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneHellblast.png b/Projectiles/Boss/BrimstoneHellblast.png new file mode 100644 index 0000000000..f9de3e2ae9 Binary files /dev/null and b/Projectiles/Boss/BrimstoneHellblast.png differ diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs new file mode 100644 index 0000000000..12d7902850 --- /dev/null +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneHellblast2.png b/Projectiles/Boss/BrimstoneHellblast2.png new file mode 100644 index 0000000000..f9de3e2ae9 Binary files /dev/null and b/Projectiles/Boss/BrimstoneHellblast2.png differ diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs new file mode 100644 index 0000000000..7ab697eafa --- /dev/null +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneHellfireball.png b/Projectiles/Boss/BrimstoneHellfireball.png new file mode 100644 index 0000000000..1b1583927e Binary files /dev/null and b/Projectiles/Boss/BrimstoneHellfireball.png differ diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs new file mode 100644 index 0000000000..044c288a27 --- /dev/null +++ b/Projectiles/Boss/BrimstoneLaser.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneLaser.png b/Projectiles/Boss/BrimstoneLaser.png new file mode 100644 index 0000000000..fc59a4cd75 Binary files /dev/null and b/Projectiles/Boss/BrimstoneLaser.png differ diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs new file mode 100644 index 0000000000..8e9b69b88e --- /dev/null +++ b/Projectiles/Boss/BrimstoneLaserSplit.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneLaserSplit.png b/Projectiles/Boss/BrimstoneLaserSplit.png new file mode 100644 index 0000000000..fc59a4cd75 Binary files /dev/null and b/Projectiles/Boss/BrimstoneLaserSplit.png differ diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs new file mode 100644 index 0000000000..d624f70061 --- /dev/null +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneMonster.png b/Projectiles/Boss/BrimstoneMonster.png new file mode 100644 index 0000000000..395e451b28 Binary files /dev/null and b/Projectiles/Boss/BrimstoneMonster.png differ diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs new file mode 100644 index 0000000000..fb57371e28 --- /dev/null +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/BrimstoneWave.png b/Projectiles/Boss/BrimstoneWave.png new file mode 100644 index 0000000000..1c15b325e6 Binary files /dev/null and b/Projectiles/Boss/BrimstoneWave.png differ diff --git a/Projectiles/Boss/CosmicFlameBurst.cs b/Projectiles/Boss/CosmicFlameBurst.cs new file mode 100644 index 0000000000..f4b4d7898d --- /dev/null +++ b/Projectiles/Boss/CosmicFlameBurst.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/CosmicFlameBurst.png b/Projectiles/Boss/CosmicFlameBurst.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Boss/CosmicFlameBurst.png differ diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs new file mode 100644 index 0000000000..829b4614ee --- /dev/null +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DarkEnergyBall.png b/Projectiles/Boss/DarkEnergyBall.png new file mode 100644 index 0000000000..813ebf8eb0 Binary files /dev/null and b/Projectiles/Boss/DarkEnergyBall.png differ diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs new file mode 100644 index 0000000000..c2001d680e --- /dev/null +++ b/Projectiles/Boss/DeusMine.cs @@ -0,0 +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 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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DeusMine.png b/Projectiles/Boss/DeusMine.png new file mode 100644 index 0000000000..923ab25c0d Binary files /dev/null and b/Projectiles/Boss/DeusMine.png differ diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs new file mode 100644 index 0000000000..c4244a9cb4 --- /dev/null +++ b/Projectiles/Boss/DoGBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DoGBeam.png b/Projectiles/Boss/DoGBeam.png new file mode 100644 index 0000000000..0d096a8625 Binary files /dev/null and b/Projectiles/Boss/DoGBeam.png differ diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs new file mode 100644 index 0000000000..42638e2fba --- /dev/null +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DoGBeamPortal.png b/Projectiles/Boss/DoGBeamPortal.png new file mode 100644 index 0000000000..3696d79bbb Binary files /dev/null and b/Projectiles/Boss/DoGBeamPortal.png differ diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs new file mode 100644 index 0000000000..7cc68e968b --- /dev/null +++ b/Projectiles/Boss/DoGDeath.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DoGDeath.png b/Projectiles/Boss/DoGDeath.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Boss/DoGDeath.png differ diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs new file mode 100644 index 0000000000..839d7ed67d --- /dev/null +++ b/Projectiles/Boss/DoGFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DoGFire.png b/Projectiles/Boss/DoGFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Boss/DoGFire.png differ diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs new file mode 100644 index 0000000000..c1b513cee3 --- /dev/null +++ b/Projectiles/Boss/DoGNebulaShot.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/DoGNebulaShot.png b/Projectiles/Boss/DoGNebulaShot.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Boss/DoGNebulaShot.png differ diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs new file mode 100644 index 0000000000..f5ca21f2a8 --- /dev/null +++ b/Projectiles/Boss/EssenceDust.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/EssenceDust.png b/Projectiles/Boss/EssenceDust.png new file mode 100644 index 0000000000..59a8c48354 Binary files /dev/null and b/Projectiles/Boss/EssenceDust.png differ diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs new file mode 100644 index 0000000000..15b08fd8b4 --- /dev/null +++ b/Projectiles/Boss/Flare.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/Flare.png b/Projectiles/Boss/Flare.png new file mode 100644 index 0000000000..f2fe3551dd Binary files /dev/null and b/Projectiles/Boss/Flare.png differ diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs new file mode 100644 index 0000000000..1783e35e2f --- /dev/null +++ b/Projectiles/Boss/FlareBomb.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/FlareBomb.png b/Projectiles/Boss/FlareBomb.png new file mode 100644 index 0000000000..24f7e7a2b3 Binary files /dev/null and b/Projectiles/Boss/FlareBomb.png differ diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs new file mode 100644 index 0000000000..7d284f051f --- /dev/null +++ b/Projectiles/Boss/FlareDust.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/FlareDust.png b/Projectiles/Boss/FlareDust.png new file mode 100644 index 0000000000..24f7e7a2b3 Binary files /dev/null and b/Projectiles/Boss/FlareDust.png differ diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs new file mode 100644 index 0000000000..55d7d3f4c6 --- /dev/null +++ b/Projectiles/Boss/FlareDust2.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/FlareDust2.png b/Projectiles/Boss/FlareDust2.png new file mode 100644 index 0000000000..24f7e7a2b3 Binary files /dev/null and b/Projectiles/Boss/FlareDust2.png differ diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs new file mode 100644 index 0000000000..36737e08de --- /dev/null +++ b/Projectiles/Boss/Flarenado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/Flarenado.png b/Projectiles/Boss/Flarenado.png new file mode 100644 index 0000000000..72814b1f39 Binary files /dev/null and b/Projectiles/Boss/Flarenado.png differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs new file mode 100644 index 0000000000..ab1b361b22 --- /dev/null +++ b/Projectiles/Boss/FrostMist.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/FrostMist.png b/Projectiles/Boss/FrostMist.png new file mode 100644 index 0000000000..8349afb42d Binary files /dev/null and b/Projectiles/Boss/FrostMist.png differ diff --git a/Projectiles/Boss/GigaFlare.cs b/Projectiles/Boss/GigaFlare.cs new file mode 100644 index 0000000000..a954b14abe --- /dev/null +++ b/Projectiles/Boss/GigaFlare.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/GigaFlare.png b/Projectiles/Boss/GigaFlare.png new file mode 100644 index 0000000000..01e2bd24ca Binary files /dev/null and b/Projectiles/Boss/GigaFlare.png differ diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs new file mode 100644 index 0000000000..80faaefd78 --- /dev/null +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HiveBombGoliath.png b/Projectiles/Boss/HiveBombGoliath.png new file mode 100644 index 0000000000..3d288c7cdf Binary files /dev/null and b/Projectiles/Boss/HiveBombGoliath.png differ diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs new file mode 100644 index 0000000000..0a96dd24b5 --- /dev/null +++ b/Projectiles/Boss/HolyBlast.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyBlast.png b/Projectiles/Boss/HolyBlast.png new file mode 100644 index 0000000000..d83b5f5d2b Binary files /dev/null and b/Projectiles/Boss/HolyBlast.png differ diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs new file mode 100644 index 0000000000..391434a384 --- /dev/null +++ b/Projectiles/Boss/HolyBomb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyBomb.png b/Projectiles/Boss/HolyBomb.png new file mode 100644 index 0000000000..516fd467de Binary files /dev/null and b/Projectiles/Boss/HolyBomb.png differ diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs new file mode 100644 index 0000000000..b3d25912ed --- /dev/null +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyBurnOrb.png b/Projectiles/Boss/HolyBurnOrb.png new file mode 100644 index 0000000000..385e7d67b1 Binary files /dev/null and b/Projectiles/Boss/HolyBurnOrb.png differ diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs new file mode 100644 index 0000000000..19e1b4a89e --- /dev/null +++ b/Projectiles/Boss/HolyFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyFire.png b/Projectiles/Boss/HolyFire.png new file mode 100644 index 0000000000..8dd445e4dc Binary files /dev/null and b/Projectiles/Boss/HolyFire.png differ diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs new file mode 100644 index 0000000000..0dfcbe6768 --- /dev/null +++ b/Projectiles/Boss/HolyFire2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyFire2.png b/Projectiles/Boss/HolyFire2.png new file mode 100644 index 0000000000..edcdd5d8b7 Binary files /dev/null and b/Projectiles/Boss/HolyFire2.png differ diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs new file mode 100644 index 0000000000..5509af995f --- /dev/null +++ b/Projectiles/Boss/HolyFlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyFlare.png b/Projectiles/Boss/HolyFlare.png new file mode 100644 index 0000000000..72a1b4ee6a Binary files /dev/null and b/Projectiles/Boss/HolyFlare.png differ diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs new file mode 100644 index 0000000000..788538d1d9 --- /dev/null +++ b/Projectiles/Boss/HolyLight.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyLight.png b/Projectiles/Boss/HolyLight.png new file mode 100644 index 0000000000..5df586c460 Binary files /dev/null and b/Projectiles/Boss/HolyLight.png differ diff --git a/Projectiles/Boss/HolyShot.cs b/Projectiles/Boss/HolyShot.cs new file mode 100644 index 0000000000..fabb1eacbd --- /dev/null +++ b/Projectiles/Boss/HolyShot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolyShot.png b/Projectiles/Boss/HolyShot.png new file mode 100644 index 0000000000..e64b5053e6 Binary files /dev/null and b/Projectiles/Boss/HolyShot.png differ diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs new file mode 100644 index 0000000000..7e809a466b --- /dev/null +++ b/Projectiles/Boss/HolySpear.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/HolySpear.png b/Projectiles/Boss/HolySpear.png new file mode 100644 index 0000000000..e64b5053e6 Binary files /dev/null and b/Projectiles/Boss/HolySpear.png differ diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs new file mode 100644 index 0000000000..3c71a551d0 --- /dev/null +++ b/Projectiles/Boss/IceBlast.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/IceBlast.png b/Projectiles/Boss/IceBlast.png new file mode 100644 index 0000000000..fb71f3c887 Binary files /dev/null and b/Projectiles/Boss/IceBlast.png differ diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs new file mode 100644 index 0000000000..803c54b6bd --- /dev/null +++ b/Projectiles/Boss/IceBomb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/IceBomb.png b/Projectiles/Boss/IceBomb.png new file mode 100644 index 0000000000..d4bedafb33 Binary files /dev/null and b/Projectiles/Boss/IceBomb.png differ diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs new file mode 100644 index 0000000000..aebd4c5033 --- /dev/null +++ b/Projectiles/Boss/IceRain.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.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/IceRain.png b/Projectiles/Boss/IceRain.png new file mode 100644 index 0000000000..198f04ee07 Binary files /dev/null and b/Projectiles/Boss/IceRain.png differ diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs new file mode 100644 index 0000000000..69fcdb8287 --- /dev/null +++ b/Projectiles/Boss/IchorShot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/IchorShot.png b/Projectiles/Boss/IchorShot.png new file mode 100644 index 0000000000..2768ba567c Binary files /dev/null and b/Projectiles/Boss/IchorShot.png differ diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs new file mode 100644 index 0000000000..cbfd03fe2e --- /dev/null +++ b/Projectiles/Boss/Infernado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/Infernado.png b/Projectiles/Boss/Infernado.png new file mode 100644 index 0000000000..d4d9ea492c Binary files /dev/null and b/Projectiles/Boss/Infernado.png differ diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs new file mode 100644 index 0000000000..e834e18419 --- /dev/null +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/InfernadoRevenge.png b/Projectiles/Boss/InfernadoRevenge.png new file mode 100644 index 0000000000..d4d9ea492c Binary files /dev/null and b/Projectiles/Boss/InfernadoRevenge.png differ diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs new file mode 100644 index 0000000000..8cde9b1bb0 --- /dev/null +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/LeviathanBomb.png b/Projectiles/Boss/LeviathanBomb.png new file mode 100644 index 0000000000..2aabf1a9f3 Binary files /dev/null and b/Projectiles/Boss/LeviathanBomb.png differ diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs new file mode 100644 index 0000000000..120cb9dd5b --- /dev/null +++ b/Projectiles/Boss/MoltenBlast.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/MoltenBlast.png b/Projectiles/Boss/MoltenBlast.png new file mode 100644 index 0000000000..ed3452cd24 Binary files /dev/null and b/Projectiles/Boss/MoltenBlast.png differ diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs new file mode 100644 index 0000000000..7206e7798e --- /dev/null +++ b/Projectiles/Boss/MoltenBlob.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/MoltenBlob.png b/Projectiles/Boss/MoltenBlob.png new file mode 100644 index 0000000000..811a46069d Binary files /dev/null and b/Projectiles/Boss/MoltenBlob.png differ diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs new file mode 100644 index 0000000000..5c2b398c90 --- /dev/null +++ b/Projectiles/Boss/MushBomb.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/MushBomb.png b/Projectiles/Boss/MushBomb.png new file mode 100644 index 0000000000..279f8aa2b9 Binary files /dev/null and b/Projectiles/Boss/MushBomb.png differ diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs new file mode 100644 index 0000000000..fefe23364c --- /dev/null +++ b/Projectiles/Boss/MushBombFall.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/MushBombFall.png b/Projectiles/Boss/MushBombFall.png new file mode 100644 index 0000000000..279f8aa2b9 Binary files /dev/null and b/Projectiles/Boss/MushBombFall.png differ diff --git a/Projectiles/Boss/Mushmash.cs b/Projectiles/Boss/Mushmash.cs new file mode 100644 index 0000000000..ae58cd72b3 --- /dev/null +++ b/Projectiles/Boss/Mushmash.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/Mushmash.png b/Projectiles/Boss/Mushmash.png new file mode 100644 index 0000000000..f0ea5c0e2a Binary files /dev/null and b/Projectiles/Boss/Mushmash.png differ diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs new file mode 100644 index 0000000000..3949097daa --- /dev/null +++ b/Projectiles/Boss/PhantomBlast.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PhantomBlast.png b/Projectiles/Boss/PhantomBlast.png new file mode 100644 index 0000000000..25e9b9e151 Binary files /dev/null and b/Projectiles/Boss/PhantomBlast.png differ diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs new file mode 100644 index 0000000000..62d2d38cc5 --- /dev/null +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PhantomBlast2.png b/Projectiles/Boss/PhantomBlast2.png new file mode 100644 index 0000000000..5e0aa97e05 Binary files /dev/null and b/Projectiles/Boss/PhantomBlast2.png differ diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs new file mode 100644 index 0000000000..2d77007612 --- /dev/null +++ b/Projectiles/Boss/PhantomMine.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/PhantomMine.png b/Projectiles/Boss/PhantomMine.png new file mode 100644 index 0000000000..aaf6477611 Binary files /dev/null and b/Projectiles/Boss/PhantomMine.png differ diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs new file mode 100644 index 0000000000..01981c94ec --- /dev/null +++ b/Projectiles/Boss/PhantomShot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PhantomShot.png b/Projectiles/Boss/PhantomShot.png new file mode 100644 index 0000000000..0e94ae8cb8 Binary files /dev/null and b/Projectiles/Boss/PhantomShot.png differ diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs new file mode 100644 index 0000000000..70770b027a --- /dev/null +++ b/Projectiles/Boss/PhantomShot2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PhantomShot2.png b/Projectiles/Boss/PhantomShot2.png new file mode 100644 index 0000000000..bb6e4a3e19 Binary files /dev/null and b/Projectiles/Boss/PhantomShot2.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs new file mode 100644 index 0000000000..04ed19b5ef --- /dev/null +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PlagueStingerGoliath.png b/Projectiles/Boss/PlagueStingerGoliath.png new file mode 100644 index 0000000000..64ff0163a6 Binary files /dev/null and b/Projectiles/Boss/PlagueStingerGoliath.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathGlow.png b/Projectiles/Boss/PlagueStingerGoliathGlow.png new file mode 100644 index 0000000000..a4b66710ce Binary files /dev/null and b/Projectiles/Boss/PlagueStingerGoliathGlow.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs new file mode 100644 index 0000000000..05b35c0ebe --- /dev/null +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.png b/Projectiles/Boss/PlagueStingerGoliathV2.png new file mode 100644 index 0000000000..b7b40b04b1 Binary files /dev/null and b/Projectiles/Boss/PlagueStingerGoliathV2.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2Glow.png b/Projectiles/Boss/PlagueStingerGoliathV2Glow.png new file mode 100644 index 0000000000..8abf1090f1 Binary files /dev/null and b/Projectiles/Boss/PlagueStingerGoliathV2Glow.png differ diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs new file mode 100644 index 0000000000..d8b3a9ac9e --- /dev/null +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/ProfanedSpear.png b/Projectiles/Boss/ProfanedSpear.png new file mode 100644 index 0000000000..da7ba8cfd4 Binary files /dev/null and b/Projectiles/Boss/ProfanedSpear.png differ diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs new file mode 100644 index 0000000000..1f11bc3f16 --- /dev/null +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ProvidenceCrystal.png b/Projectiles/Boss/ProvidenceCrystal.png new file mode 100644 index 0000000000..d95c116a22 Binary files /dev/null and b/Projectiles/Boss/ProvidenceCrystal.png differ diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs new file mode 100644 index 0000000000..14deb86148 --- /dev/null +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ProvidenceCrystalShard.png b/Projectiles/Boss/ProvidenceCrystalShard.png new file mode 100644 index 0000000000..5104abbbe6 Binary files /dev/null and b/Projectiles/Boss/ProvidenceCrystalShard.png differ diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs new file mode 100644 index 0000000000..5ae2ea14b1 --- /dev/null +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ProvidenceHolyRay.png b/Projectiles/Boss/ProvidenceHolyRay.png new file mode 100644 index 0000000000..efbc766d6c Binary files /dev/null and b/Projectiles/Boss/ProvidenceHolyRay.png differ diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs new file mode 100644 index 0000000000..ccd134cd78 --- /dev/null +++ b/Projectiles/Boss/RavagerFlame.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/RavagerFlame.png b/Projectiles/Boss/RavagerFlame.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Boss/RavagerFlame.png differ diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs new file mode 100644 index 0000000000..0867b4a57b --- /dev/null +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/RedLightningFeather.png b/Projectiles/Boss/RedLightningFeather.png new file mode 100644 index 0000000000..5171b52bd0 Binary files /dev/null and b/Projectiles/Boss/RedLightningFeather.png differ diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs new file mode 100644 index 0000000000..dff7351868 --- /dev/null +++ b/Projectiles/Boss/SandBlast.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/SandBlast.png b/Projectiles/Boss/SandBlast.png new file mode 100644 index 0000000000..2392a80f7b Binary files /dev/null and b/Projectiles/Boss/SandBlast.png differ diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs new file mode 100644 index 0000000000..5f159de9ff --- /dev/null +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/SandPoisonCloud.png b/Projectiles/Boss/SandPoisonCloud.png new file mode 100644 index 0000000000..412c5607a5 Binary files /dev/null and b/Projectiles/Boss/SandPoisonCloud.png differ diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs new file mode 100644 index 0000000000..4c05e38cd3 --- /dev/null +++ b/Projectiles/Boss/SandTooth.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/SandTooth.png b/Projectiles/Boss/SandTooth.png new file mode 100644 index 0000000000..896d252919 Binary files /dev/null and b/Projectiles/Boss/SandTooth.png differ diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs new file mode 100644 index 0000000000..7a16989ec3 --- /dev/null +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ScavengerLaser.png b/Projectiles/Boss/ScavengerLaser.png new file mode 100644 index 0000000000..abdb698535 Binary files /dev/null and b/Projectiles/Boss/ScavengerLaser.png differ diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs new file mode 100644 index 0000000000..8e5e11cd97 --- /dev/null +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ScavengerNuke.png b/Projectiles/Boss/ScavengerNuke.png new file mode 100644 index 0000000000..b5e80e9140 Binary files /dev/null and b/Projectiles/Boss/ScavengerNuke.png differ diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs new file mode 100644 index 0000000000..96da78dd3d --- /dev/null +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ShadeNimbusHostile.png b/Projectiles/Boss/ShadeNimbusHostile.png new file mode 100644 index 0000000000..8ed0e6e673 Binary files /dev/null and b/Projectiles/Boss/ShadeNimbusHostile.png differ diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs new file mode 100644 index 0000000000..9017712a92 --- /dev/null +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/ShaderainHostile.png b/Projectiles/Boss/ShaderainHostile.png new file mode 100644 index 0000000000..56fa0aa8a6 Binary files /dev/null and b/Projectiles/Boss/ShaderainHostile.png differ diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs new file mode 100644 index 0000000000..2d6e16ed1f --- /dev/null +++ b/Projectiles/Boss/SirenSong.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.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/SirenSong.png b/Projectiles/Boss/SirenSong.png new file mode 100644 index 0000000000..2d410bffb7 Binary files /dev/null and b/Projectiles/Boss/SirenSong.png differ diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs new file mode 100644 index 0000000000..e3a57eeaa4 --- /dev/null +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/SkyFlareRevenge.png b/Projectiles/Boss/SkyFlareRevenge.png new file mode 100644 index 0000000000..e3b21436ca Binary files /dev/null and b/Projectiles/Boss/SkyFlareRevenge.png differ diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs new file mode 100644 index 0000000000..856a05d448 --- /dev/null +++ b/Projectiles/Boss/VileClot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/VileClot.png b/Projectiles/Boss/VileClot.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Boss/VileClot.png differ diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs new file mode 100644 index 0000000000..d34fc19bd0 --- /dev/null +++ b/Projectiles/Boss/WaterSpear.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/WaterSpear.png b/Projectiles/Boss/WaterSpear.png new file mode 100644 index 0000000000..c5b595d096 Binary files /dev/null and b/Projectiles/Boss/WaterSpear.png differ diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs new file mode 100644 index 0000000000..2e2f85ed35 --- /dev/null +++ b/Projectiles/Boss/YharonFireball.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/YharonFireball.png b/Projectiles/Boss/YharonFireball.png new file mode 100644 index 0000000000..6a4eedebff Binary files /dev/null and b/Projectiles/Boss/YharonFireball.png differ diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs new file mode 100644 index 0000000000..be3ab2a6d2 --- /dev/null +++ b/Projectiles/Boss/YharonFireball2.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/YharonFireball2.png b/Projectiles/Boss/YharonFireball2.png new file mode 100644 index 0000000000..6a4eedebff Binary files /dev/null and b/Projectiles/Boss/YharonFireball2.png differ diff --git a/Projectiles/Boss/YharonFireballHoming.cs b/Projectiles/Boss/YharonFireballHoming.cs new file mode 100644 index 0000000000..df2f5691e8 --- /dev/null +++ b/Projectiles/Boss/YharonFireballHoming.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Boss/YharonFireballHoming.png b/Projectiles/Boss/YharonFireballHoming.png new file mode 100644 index 0000000000..6a4eedebff Binary files /dev/null and b/Projectiles/Boss/YharonFireballHoming.png differ diff --git a/Projectiles/BrackishFlask.cs b/Projectiles/BrackishFlask.cs new file mode 100644 index 0000000000..3428962c6c --- /dev/null +++ b/Projectiles/BrackishFlask.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrackishFlask.png b/Projectiles/BrackishFlask.png new file mode 100644 index 0000000000..c0101e465c Binary files /dev/null and b/Projectiles/BrackishFlask.png differ diff --git a/Projectiles/BrackishWater.cs b/Projectiles/BrackishWater.cs new file mode 100644 index 0000000000..b325df419c --- /dev/null +++ b/Projectiles/BrackishWater.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrackishWater.png b/Projectiles/BrackishWater.png new file mode 100644 index 0000000000..831f72cfc8 Binary files /dev/null and b/Projectiles/BrackishWater.png differ diff --git a/Projectiles/BrackishWaterBlast.cs b/Projectiles/BrackishWaterBlast.cs new file mode 100644 index 0000000000..3a259615f0 --- /dev/null +++ b/Projectiles/BrackishWaterBlast.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrackishWaterBlast.png b/Projectiles/BrackishWaterBlast.png new file mode 100644 index 0000000000..59d45407ff Binary files /dev/null and b/Projectiles/BrackishWaterBlast.png differ diff --git a/Projectiles/Brimblade.cs b/Projectiles/Brimblade.cs new file mode 100644 index 0000000000..89933346b5 --- /dev/null +++ b/Projectiles/Brimblade.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimblade.png b/Projectiles/Brimblade.png new file mode 100644 index 0000000000..d7de00d24b Binary files /dev/null and b/Projectiles/Brimblade.png differ diff --git a/Projectiles/Brimblade2.cs b/Projectiles/Brimblade2.cs new file mode 100644 index 0000000000..6662bcd48a --- /dev/null +++ b/Projectiles/Brimblade2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimblade2.png b/Projectiles/Brimblade2.png new file mode 100644 index 0000000000..d7de00d24b Binary files /dev/null and b/Projectiles/Brimblade2.png differ diff --git a/Projectiles/Brimblast.cs b/Projectiles/Brimblast.cs new file mode 100644 index 0000000000..02d97a551e --- /dev/null +++ b/Projectiles/Brimblast.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 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/Brimblast.png b/Projectiles/Brimblast.png new file mode 100644 index 0000000000..72774ce49d Binary files /dev/null and b/Projectiles/Brimblast.png differ diff --git a/Projectiles/Brimlance.cs b/Projectiles/Brimlance.cs new file mode 100644 index 0000000000..5822dbb5a4 --- /dev/null +++ b/Projectiles/Brimlance.cs @@ -0,0 +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 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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimlance.png b/Projectiles/Brimlance.png new file mode 100644 index 0000000000..b0bc402a1d Binary files /dev/null and b/Projectiles/Brimlance.png differ diff --git a/Projectiles/Brimlash.cs b/Projectiles/Brimlash.cs new file mode 100644 index 0000000000..e0d9c0f7b4 --- /dev/null +++ b/Projectiles/Brimlash.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimlash.png b/Projectiles/Brimlash.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/Brimlash.png differ diff --git a/Projectiles/Brimlash2.cs b/Projectiles/Brimlash2.cs new file mode 100644 index 0000000000..002f549b4f --- /dev/null +++ b/Projectiles/Brimlash2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimlash2.png b/Projectiles/Brimlash2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Brimlash2.png differ diff --git a/Projectiles/Brimling.cs b/Projectiles/Brimling.cs new file mode 100644 index 0000000000..5fbbbeb6af --- /dev/null +++ b/Projectiles/Brimling.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Brimling.png b/Projectiles/Brimling.png new file mode 100644 index 0000000000..5d278eb8a0 Binary files /dev/null and b/Projectiles/Brimling.png differ diff --git a/Projectiles/BrimstoneBall2.cs b/Projectiles/BrimstoneBall2.cs new file mode 100644 index 0000000000..f54aa33275 --- /dev/null +++ b/Projectiles/BrimstoneBall2.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/BrimstoneBall2.png b/Projectiles/BrimstoneBall2.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BrimstoneBall2.png differ diff --git a/Projectiles/BrimstoneBallFriendly.cs b/Projectiles/BrimstoneBallFriendly.cs new file mode 100644 index 0000000000..8e832c4f98 --- /dev/null +++ b/Projectiles/BrimstoneBallFriendly.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/BrimstoneBallFriendly.png b/Projectiles/BrimstoneBallFriendly.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BrimstoneBallFriendly.png differ diff --git a/Projectiles/BrimstoneBeam.cs b/Projectiles/BrimstoneBeam.cs new file mode 100644 index 0000000000..83d039708e --- /dev/null +++ b/Projectiles/BrimstoneBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam.png b/Projectiles/BrimstoneBeam.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/BrimstoneBeam.png differ diff --git a/Projectiles/BrimstoneBeam2.cs b/Projectiles/BrimstoneBeam2.cs new file mode 100644 index 0000000000..f9c93d7c62 --- /dev/null +++ b/Projectiles/BrimstoneBeam2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam2.png b/Projectiles/BrimstoneBeam2.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/BrimstoneBeam2.png differ diff --git a/Projectiles/BrimstoneBeam3.cs b/Projectiles/BrimstoneBeam3.cs new file mode 100644 index 0000000000..9f375f2461 --- /dev/null +++ b/Projectiles/BrimstoneBeam3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam3.png b/Projectiles/BrimstoneBeam3.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/BrimstoneBeam3.png differ diff --git a/Projectiles/BrimstoneBeam4.cs b/Projectiles/BrimstoneBeam4.cs new file mode 100644 index 0000000000..3d8dccb662 --- /dev/null +++ b/Projectiles/BrimstoneBeam4.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam4.png b/Projectiles/BrimstoneBeam4.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/BrimstoneBeam4.png differ diff --git a/Projectiles/BrimstoneBeam5.cs b/Projectiles/BrimstoneBeam5.cs new file mode 100644 index 0000000000..6fefa39030 --- /dev/null +++ b/Projectiles/BrimstoneBeam5.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBeam5.png b/Projectiles/BrimstoneBeam5.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/BrimstoneBeam5.png differ diff --git a/Projectiles/BrimstoneBolt.cs b/Projectiles/BrimstoneBolt.cs new file mode 100644 index 0000000000..b3d58dd093 --- /dev/null +++ b/Projectiles/BrimstoneBolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBolt.png b/Projectiles/BrimstoneBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/BrimstoneBolt.png differ diff --git a/Projectiles/BrimstoneBoom.cs b/Projectiles/BrimstoneBoom.cs new file mode 100644 index 0000000000..7340cf585c --- /dev/null +++ b/Projectiles/BrimstoneBoom.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneBoom.png b/Projectiles/BrimstoneBoom.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/BrimstoneBoom.png differ diff --git a/Projectiles/BrimstoneFireFriendly.cs b/Projectiles/BrimstoneFireFriendly.cs new file mode 100644 index 0000000000..4ca49828ba --- /dev/null +++ b/Projectiles/BrimstoneFireFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneFireFriendly.png b/Projectiles/BrimstoneFireFriendly.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/BrimstoneFireFriendly.png differ diff --git a/Projectiles/BrimstoneFireSummon.cs b/Projectiles/BrimstoneFireSummon.cs new file mode 100644 index 0000000000..9c44d884b2 --- /dev/null +++ b/Projectiles/BrimstoneFireSummon.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneFireSummon.png b/Projectiles/BrimstoneFireSummon.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/BrimstoneFireSummon.png differ diff --git a/Projectiles/BrimstoneFireball.cs b/Projectiles/BrimstoneFireball.cs new file mode 100644 index 0000000000..2f033d9359 --- /dev/null +++ b/Projectiles/BrimstoneFireball.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/BrimstoneFireball.png b/Projectiles/BrimstoneFireball.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/BrimstoneFireball.png differ diff --git a/Projectiles/BrimstoneHellfireballFriendly.cs b/Projectiles/BrimstoneHellfireballFriendly.cs new file mode 100644 index 0000000000..b41f82e2f9 --- /dev/null +++ b/Projectiles/BrimstoneHellfireballFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneHellfireballFriendly.png b/Projectiles/BrimstoneHellfireballFriendly.png new file mode 100644 index 0000000000..831f72cfc8 Binary files /dev/null and b/Projectiles/BrimstoneHellfireballFriendly.png differ diff --git a/Projectiles/BrimstoneHellfireballFriendly2.cs b/Projectiles/BrimstoneHellfireballFriendly2.cs new file mode 100644 index 0000000000..d8f3cc6db7 --- /dev/null +++ b/Projectiles/BrimstoneHellfireballFriendly2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneHellfireballFriendly2.png b/Projectiles/BrimstoneHellfireballFriendly2.png new file mode 100644 index 0000000000..831f72cfc8 Binary files /dev/null and b/Projectiles/BrimstoneHellfireballFriendly2.png differ diff --git a/Projectiles/BrimstoneHomer.cs b/Projectiles/BrimstoneHomer.cs new file mode 100644 index 0000000000..ecd2685721 --- /dev/null +++ b/Projectiles/BrimstoneHomer.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneHomer.png b/Projectiles/BrimstoneHomer.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/BrimstoneHomer.png differ diff --git a/Projectiles/BrimstoneLaserFriendly.cs b/Projectiles/BrimstoneLaserFriendly.cs new file mode 100644 index 0000000000..e203bc6f73 --- /dev/null +++ b/Projectiles/BrimstoneLaserFriendly.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 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/BrimstoneLaserFriendly.png b/Projectiles/BrimstoneLaserFriendly.png new file mode 100644 index 0000000000..fc59a4cd75 Binary files /dev/null and b/Projectiles/BrimstoneLaserFriendly.png differ diff --git a/Projectiles/BrimstoneLaserSummon.cs b/Projectiles/BrimstoneLaserSummon.cs new file mode 100644 index 0000000000..1c4c1f5895 --- /dev/null +++ b/Projectiles/BrimstoneLaserSummon.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 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/BrimstoneLaserSummon.png b/Projectiles/BrimstoneLaserSummon.png new file mode 100644 index 0000000000..fc59a4cd75 Binary files /dev/null and b/Projectiles/BrimstoneLaserSummon.png differ diff --git a/Projectiles/BrimstoneShot.cs b/Projectiles/BrimstoneShot.cs new file mode 100644 index 0000000000..fbac77cac2 --- /dev/null +++ b/Projectiles/BrimstoneShot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneShot.png b/Projectiles/BrimstoneShot.png new file mode 100644 index 0000000000..fc59a4cd75 Binary files /dev/null and b/Projectiles/BrimstoneShot.png differ diff --git a/Projectiles/BrimstoneTentacle.cs b/Projectiles/BrimstoneTentacle.cs new file mode 100644 index 0000000000..1efc533553 --- /dev/null +++ b/Projectiles/BrimstoneTentacle.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BrimstoneTentacle.png b/Projectiles/BrimstoneTentacle.png new file mode 100644 index 0000000000..84f7b0870b Binary files /dev/null and b/Projectiles/BrimstoneTentacle.png differ diff --git a/Projectiles/BrinySpout.cs b/Projectiles/BrinySpout.cs new file mode 100644 index 0000000000..2ef55148ff --- /dev/null +++ b/Projectiles/BrinySpout.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/BrinySpout.png b/Projectiles/BrinySpout.png new file mode 100644 index 0000000000..c2a07fcfb6 Binary files /dev/null and b/Projectiles/BrinySpout.png differ diff --git a/Projectiles/BrinyTyphoonBubble.cs b/Projectiles/BrinyTyphoonBubble.cs new file mode 100644 index 0000000000..1cd157a468 --- /dev/null +++ b/Projectiles/BrinyTyphoonBubble.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BrinyTyphoonBubble.png b/Projectiles/BrinyTyphoonBubble.png new file mode 100644 index 0000000000..90a422dbd8 Binary files /dev/null and b/Projectiles/BrinyTyphoonBubble.png differ diff --git a/Projectiles/BrittleStar.cs b/Projectiles/BrittleStar.cs new file mode 100644 index 0000000000..ca8eec241c --- /dev/null +++ b/Projectiles/BrittleStar.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 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/BrittleStar.png b/Projectiles/BrittleStar.png new file mode 100644 index 0000000000..c89624f1c8 Binary files /dev/null and b/Projectiles/BrittleStar.png differ diff --git a/Projectiles/BurningMeteor.cs b/Projectiles/BurningMeteor.cs new file mode 100644 index 0000000000..bfb121a9bf --- /dev/null +++ b/Projectiles/BurningMeteor.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/BurningMeteor.png b/Projectiles/BurningMeteor.png new file mode 100644 index 0000000000..80659c4a35 Binary files /dev/null and b/Projectiles/BurningMeteor.png differ diff --git a/Projectiles/BurntSienna.cs b/Projectiles/BurntSienna.cs new file mode 100644 index 0000000000..5f42c7c868 --- /dev/null +++ b/Projectiles/BurntSienna.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/BurntSienna.png b/Projectiles/BurntSienna.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/BurntSienna.png differ diff --git a/Projectiles/Butcher.cs b/Projectiles/Butcher.cs new file mode 100644 index 0000000000..96459f3aa9 --- /dev/null +++ b/Projectiles/Butcher.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/Butcher.png b/Projectiles/Butcher.png new file mode 100644 index 0000000000..3b6458a45f Binary files /dev/null and b/Projectiles/Butcher.png differ diff --git a/Projectiles/CactusHealOrb.cs b/Projectiles/CactusHealOrb.cs new file mode 100644 index 0000000000..1f7b8b325a --- /dev/null +++ b/Projectiles/CactusHealOrb.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/CactusHealOrb.png b/Projectiles/CactusHealOrb.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/CactusHealOrb.png differ diff --git a/Projectiles/Calamari.cs b/Projectiles/Calamari.cs new file mode 100644 index 0000000000..e31c902028 --- /dev/null +++ b/Projectiles/Calamari.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Calamari.png b/Projectiles/Calamari.png new file mode 100644 index 0000000000..f1240bc95e Binary files /dev/null and b/Projectiles/Calamari.png differ diff --git a/Projectiles/CalamariInk.cs b/Projectiles/CalamariInk.cs new file mode 100644 index 0000000000..f28e75c667 --- /dev/null +++ b/Projectiles/CalamariInk.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CalamariInk.png b/Projectiles/CalamariInk.png new file mode 100644 index 0000000000..de56af3be4 Binary files /dev/null and b/Projectiles/CalamariInk.png differ diff --git a/Projectiles/Calamitamini.cs b/Projectiles/Calamitamini.cs new file mode 100644 index 0000000000..ab2c8facb3 --- /dev/null +++ b/Projectiles/Calamitamini.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Calamitamini.png b/Projectiles/Calamitamini.png new file mode 100644 index 0000000000..b498a82ddf Binary files /dev/null and b/Projectiles/Calamitamini.png differ diff --git a/Projectiles/CalamityAura.cs b/Projectiles/CalamityAura.cs new file mode 100644 index 0000000000..96f8654771 --- /dev/null +++ b/Projectiles/CalamityAura.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CalamityAura.png b/Projectiles/CalamityAura.png new file mode 100644 index 0000000000..a92710aa78 Binary files /dev/null and b/Projectiles/CalamityAura.png differ diff --git a/Projectiles/CalamityAuraType2.cs b/Projectiles/CalamityAuraType2.cs new file mode 100644 index 0000000000..40f03d0995 --- /dev/null +++ b/Projectiles/CalamityAuraType2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CalamityAuraType2.png b/Projectiles/CalamityAuraType2.png new file mode 100644 index 0000000000..12072157f8 Binary files /dev/null and b/Projectiles/CalamityAuraType2.png differ diff --git a/Projectiles/CalamityAuraType3.cs b/Projectiles/CalamityAuraType3.cs new file mode 100644 index 0000000000..5963186451 --- /dev/null +++ b/Projectiles/CalamityAuraType3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CalamityAuraType3.png b/Projectiles/CalamityAuraType3.png new file mode 100644 index 0000000000..c2f75036f7 Binary files /dev/null and b/Projectiles/CalamityAuraType3.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs new file mode 100644 index 0000000000..4720163164 --- /dev/null +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -0,0 +1,864 @@ +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 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 + } +} diff --git a/Projectiles/Cataclymini.cs b/Projectiles/Cataclymini.cs new file mode 100644 index 0000000000..8d5bb161ef --- /dev/null +++ b/Projectiles/Cataclymini.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Cataclymini.png b/Projectiles/Cataclymini.png new file mode 100644 index 0000000000..dcc35d190b Binary files /dev/null and b/Projectiles/Cataclymini.png differ diff --git a/Projectiles/Catastromini.cs b/Projectiles/Catastromini.cs new file mode 100644 index 0000000000..30c8c9e766 --- /dev/null +++ b/Projectiles/Catastromini.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Catastromini.png b/Projectiles/Catastromini.png new file mode 100644 index 0000000000..54b5691802 Binary files /dev/null and b/Projectiles/Catastromini.png differ diff --git a/Projectiles/Celestus.cs b/Projectiles/Celestus.cs new file mode 100644 index 0000000000..61cc20e863 --- /dev/null +++ b/Projectiles/Celestus.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Celestus.png b/Projectiles/Celestus.png new file mode 100644 index 0000000000..8b52214ea1 Binary files /dev/null and b/Projectiles/Celestus.png differ diff --git a/Projectiles/Celestus2.cs b/Projectiles/Celestus2.cs new file mode 100644 index 0000000000..3f88e43845 --- /dev/null +++ b/Projectiles/Celestus2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Celestus2.png b/Projectiles/Celestus2.png new file mode 100644 index 0000000000..8b52214ea1 Binary files /dev/null and b/Projectiles/Celestus2.png differ diff --git a/Projectiles/ChaosBlaze.cs b/Projectiles/ChaosBlaze.cs new file mode 100644 index 0000000000..c4c73256f4 --- /dev/null +++ b/Projectiles/ChaosBlaze.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosBlaze.png b/Projectiles/ChaosBlaze.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/ChaosBlaze.png differ diff --git a/Projectiles/ChaosFlame.cs b/Projectiles/ChaosFlame.cs new file mode 100644 index 0000000000..4902028a2d --- /dev/null +++ b/Projectiles/ChaosFlame.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosFlame.png b/Projectiles/ChaosFlame.png new file mode 100644 index 0000000000..831f72cfc8 Binary files /dev/null and b/Projectiles/ChaosFlame.png differ diff --git a/Projectiles/ChaosFlameLarge.cs b/Projectiles/ChaosFlameLarge.cs new file mode 100644 index 0000000000..cb57e3e17c --- /dev/null +++ b/Projectiles/ChaosFlameLarge.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/ChaosFlameLarge.png b/Projectiles/ChaosFlameLarge.png new file mode 100644 index 0000000000..aa8e22d717 Binary files /dev/null and b/Projectiles/ChaosFlameLarge.png differ diff --git a/Projectiles/ChaosFlameMedium.cs b/Projectiles/ChaosFlameMedium.cs new file mode 100644 index 0000000000..b9e5c03c76 --- /dev/null +++ b/Projectiles/ChaosFlameMedium.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/ChaosFlameMedium.png b/Projectiles/ChaosFlameMedium.png new file mode 100644 index 0000000000..dfc1df55b9 Binary files /dev/null and b/Projectiles/ChaosFlameMedium.png differ diff --git a/Projectiles/ChaosFlameSmall.cs b/Projectiles/ChaosFlameSmall.cs new file mode 100644 index 0000000000..1be2a166b1 --- /dev/null +++ b/Projectiles/ChaosFlameSmall.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/ChaosFlameSmall.png b/Projectiles/ChaosFlameSmall.png new file mode 100644 index 0000000000..e09617c256 Binary files /dev/null and b/Projectiles/ChaosFlameSmall.png differ diff --git a/Projectiles/ChaosFlare.cs b/Projectiles/ChaosFlare.cs new file mode 100644 index 0000000000..f7a88b6e51 --- /dev/null +++ b/Projectiles/ChaosFlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosFlare.png b/Projectiles/ChaosFlare.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/ChaosFlare.png differ diff --git a/Projectiles/ChaosFlare2.cs b/Projectiles/ChaosFlare2.cs new file mode 100644 index 0000000000..52bb6e43cb --- /dev/null +++ b/Projectiles/ChaosFlare2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosFlare2.png b/Projectiles/ChaosFlare2.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/ChaosFlare2.png differ diff --git a/Projectiles/ChaosGeyser.cs b/Projectiles/ChaosGeyser.cs new file mode 100644 index 0000000000..7918c8308f --- /dev/null +++ b/Projectiles/ChaosGeyser.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 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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosGeyser.png b/Projectiles/ChaosGeyser.png new file mode 100644 index 0000000000..dd0a1e7735 Binary files /dev/null and b/Projectiles/ChaosGeyser.png differ diff --git a/Projectiles/ChaosSpirit.cs b/Projectiles/ChaosSpirit.cs new file mode 100644 index 0000000000..a226f6cc3a --- /dev/null +++ b/Projectiles/ChaosSpirit.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaosSpirit.png b/Projectiles/ChaosSpirit.png new file mode 100644 index 0000000000..6be106a2e6 Binary files /dev/null and b/Projectiles/ChaosSpirit.png differ diff --git a/Projectiles/ChaotrixProjectile.cs b/Projectiles/ChaotrixProjectile.cs new file mode 100644 index 0000000000..0102e147a6 --- /dev/null +++ b/Projectiles/ChaotrixProjectile.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ChaotrixProjectile.png b/Projectiles/ChaotrixProjectile.png new file mode 100644 index 0000000000..8b8dc552c7 Binary files /dev/null and b/Projectiles/ChaotrixProjectile.png differ diff --git a/Projectiles/ChargedBlast.cs b/Projectiles/ChargedBlast.cs new file mode 100644 index 0000000000..b11f45ef99 --- /dev/null +++ b/Projectiles/ChargedBlast.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ChargedBlast.png b/Projectiles/ChargedBlast.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/ChargedBlast.png differ diff --git a/Projectiles/ChargedBlast2.cs b/Projectiles/ChargedBlast2.cs new file mode 100644 index 0000000000..0e6cc3002b --- /dev/null +++ b/Projectiles/ChargedBlast2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ChargedBlast2.png b/Projectiles/ChargedBlast2.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/ChargedBlast2.png differ diff --git a/Projectiles/ChargedBlast3.cs b/Projectiles/ChargedBlast3.cs new file mode 100644 index 0000000000..52408681ae --- /dev/null +++ b/Projectiles/ChargedBlast3.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ChargedBlast3.png b/Projectiles/ChargedBlast3.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/ChargedBlast3.png differ diff --git a/Projectiles/ChibiiDoggo.cs b/Projectiles/ChibiiDoggo.cs new file mode 100644 index 0000000000..5ddfef7a7d --- /dev/null +++ b/Projectiles/ChibiiDoggo.cs @@ -0,0 +1,252 @@ +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"); + 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); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + goto IL_6899; + Microsoft.Xna.Framework.Color ff3399 = new Microsoft.Xna.Framework.Color(255, 51, 153, 255); + color26 = Microsoft.Xna.Framework.Color.Lerp(color26, ff3399, 0.5f); + color26.A += (byte)(150); + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value4 = (projectile.oldPos[num161]); + float num165 = projectile.rotation; + 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; + } + } + } +} diff --git a/Projectiles/ChibiiDoggo.png b/Projectiles/ChibiiDoggo.png new file mode 100644 index 0000000000..5ac0be022c Binary files /dev/null and b/Projectiles/ChibiiDoggo.png differ diff --git a/Projectiles/ChibiiDoggoFly.cs b/Projectiles/ChibiiDoggoFly.cs new file mode 100644 index 0000000000..bf610365be --- /dev/null +++ b/Projectiles/ChibiiDoggoFly.cs @@ -0,0 +1,124 @@ +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"); + 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); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 12; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + { + goto IL_6899; + } + Microsoft.Xna.Framework.Color ff3399 = new Microsoft.Xna.Framework.Color(255, 51, 153, 255); + color26 = Microsoft.Xna.Framework.Color.Lerp(color26, ff3399, 0.5f); + color26.A += (byte)(150); + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value4 = (projectile.oldPos[num161]); + float num165 = projectile.rotation; + 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; + } + } + } +} diff --git a/Projectiles/ChibiiDoggoFly.png b/Projectiles/ChibiiDoggoFly.png new file mode 100644 index 0000000000..04ac5eb788 Binary files /dev/null and b/Projectiles/ChibiiDoggoFly.png differ diff --git a/Projectiles/ChibiiDoggoFlyMonochrome.png b/Projectiles/ChibiiDoggoFlyMonochrome.png new file mode 100644 index 0000000000..01fd2cd453 Binary files /dev/null and b/Projectiles/ChibiiDoggoFlyMonochrome.png differ diff --git a/Projectiles/ChibiiDoggoMonochrome.png b/Projectiles/ChibiiDoggoMonochrome.png new file mode 100644 index 0000000000..bacc8c0c3d Binary files /dev/null and b/Projectiles/ChibiiDoggoMonochrome.png differ diff --git a/Projectiles/Chicken.cs b/Projectiles/Chicken.cs new file mode 100644 index 0000000000..71a55012f1 --- /dev/null +++ b/Projectiles/Chicken.cs @@ -0,0 +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; + } + } + + + } +} \ No newline at end of file diff --git a/Projectiles/Chicken.png b/Projectiles/Chicken.png new file mode 100644 index 0000000000..f1f695e90b Binary files /dev/null and b/Projectiles/Chicken.png differ diff --git a/Projectiles/ChickenExplosion.cs b/Projectiles/ChickenExplosion.cs new file mode 100644 index 0000000000..1dc7234836 --- /dev/null +++ b/Projectiles/ChickenExplosion.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/ChickenExplosion.png b/Projectiles/ChickenExplosion.png new file mode 100644 index 0000000000..f47e46f43d Binary files /dev/null and b/Projectiles/ChickenExplosion.png differ diff --git a/Projectiles/Climax.cs b/Projectiles/Climax.cs new file mode 100644 index 0000000000..063a5ca5a4 --- /dev/null +++ b/Projectiles/Climax.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Climax.png b/Projectiles/Climax.png new file mode 100644 index 0000000000..09d7a242e3 Binary files /dev/null and b/Projectiles/Climax.png differ diff --git a/Projectiles/ClimaxBeam.cs b/Projectiles/ClimaxBeam.cs new file mode 100644 index 0000000000..f48c23f317 --- /dev/null +++ b/Projectiles/ClimaxBeam.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ClimaxBeam.png b/Projectiles/ClimaxBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/ClimaxBeam.png differ diff --git a/Projectiles/CloudyWaifu.cs b/Projectiles/CloudyWaifu.cs new file mode 100644 index 0000000000..030784bad0 --- /dev/null +++ b/Projectiles/CloudyWaifu.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CloudyWaifu.png b/Projectiles/CloudyWaifu.png new file mode 100644 index 0000000000..765844b956 Binary files /dev/null and b/Projectiles/CloudyWaifu.png differ diff --git a/Projectiles/CloudyWaifuAttack.png b/Projectiles/CloudyWaifuAttack.png new file mode 100644 index 0000000000..5b4eb809a0 Binary files /dev/null and b/Projectiles/CloudyWaifuAttack.png differ diff --git a/Projectiles/CnidarianProjectile.cs b/Projectiles/CnidarianProjectile.cs new file mode 100644 index 0000000000..7a8ed1c9d9 --- /dev/null +++ b/Projectiles/CnidarianProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/CnidarianProjectile.png b/Projectiles/CnidarianProjectile.png new file mode 100644 index 0000000000..1eb7ff5b6e Binary files /dev/null and b/Projectiles/CnidarianProjectile.png differ diff --git a/Projectiles/CobaltKunaiProjectile.cs b/Projectiles/CobaltKunaiProjectile.cs new file mode 100644 index 0000000000..5bdef9fa17 --- /dev/null +++ b/Projectiles/CobaltKunaiProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CobaltKunaiProjectile.png b/Projectiles/CobaltKunaiProjectile.png new file mode 100644 index 0000000000..60efb60324 Binary files /dev/null and b/Projectiles/CobaltKunaiProjectile.png differ diff --git a/Projectiles/Contagion.cs b/Projectiles/Contagion.cs new file mode 100644 index 0000000000..df80df5f43 --- /dev/null +++ b/Projectiles/Contagion.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/Contagion.png b/Projectiles/Contagion.png new file mode 100644 index 0000000000..3aebefe8cf Binary files /dev/null and b/Projectiles/Contagion.png differ diff --git a/Projectiles/ContagionArrow.cs b/Projectiles/ContagionArrow.cs new file mode 100644 index 0000000000..a02d50773d --- /dev/null +++ b/Projectiles/ContagionArrow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ContagionArrow.png b/Projectiles/ContagionArrow.png new file mode 100644 index 0000000000..0234d51ed4 Binary files /dev/null and b/Projectiles/ContagionArrow.png differ diff --git a/Projectiles/ContagionBall.cs b/Projectiles/ContagionBall.cs new file mode 100644 index 0000000000..a4500f3988 --- /dev/null +++ b/Projectiles/ContagionBall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ContagionBall.png b/Projectiles/ContagionBall.png new file mode 100644 index 0000000000..ccf32cafa4 Binary files /dev/null and b/Projectiles/ContagionBall.png differ diff --git a/Projectiles/CoralSpike.cs b/Projectiles/CoralSpike.cs new file mode 100644 index 0000000000..4731fb8448 --- /dev/null +++ b/Projectiles/CoralSpike.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/CoralSpike.png b/Projectiles/CoralSpike.png new file mode 100644 index 0000000000..f18261bd86 Binary files /dev/null and b/Projectiles/CoralSpike.png differ diff --git a/Projectiles/CorossiveFlames.cs b/Projectiles/CorossiveFlames.cs new file mode 100644 index 0000000000..ff507dbcfc --- /dev/null +++ b/Projectiles/CorossiveFlames.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CorossiveFlames.png b/Projectiles/CorossiveFlames.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/CorossiveFlames.png differ diff --git a/Projectiles/Corroslime.cs b/Projectiles/Corroslime.cs new file mode 100644 index 0000000000..c20c1e093d --- /dev/null +++ b/Projectiles/Corroslime.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Corroslime.png b/Projectiles/Corroslime.png new file mode 100644 index 0000000000..d0dcacd82a Binary files /dev/null and b/Projectiles/Corroslime.png differ diff --git a/Projectiles/CosmicBlast.cs b/Projectiles/CosmicBlast.cs new file mode 100644 index 0000000000..e1a9ba29e0 --- /dev/null +++ b/Projectiles/CosmicBlast.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicBlast.png b/Projectiles/CosmicBlast.png new file mode 100644 index 0000000000..473de042e2 Binary files /dev/null and b/Projectiles/CosmicBlast.png differ diff --git a/Projectiles/CosmicBlastBig.cs b/Projectiles/CosmicBlastBig.cs new file mode 100644 index 0000000000..54cf7038bc --- /dev/null +++ b/Projectiles/CosmicBlastBig.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicBlastBig.png b/Projectiles/CosmicBlastBig.png new file mode 100644 index 0000000000..dca09e06ce Binary files /dev/null and b/Projectiles/CosmicBlastBig.png differ diff --git a/Projectiles/CosmicBolt.cs b/Projectiles/CosmicBolt.cs new file mode 100644 index 0000000000..05735a899c --- /dev/null +++ b/Projectiles/CosmicBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicBolt.png b/Projectiles/CosmicBolt.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/CosmicBolt.png differ diff --git a/Projectiles/CosmicDischarge.cs b/Projectiles/CosmicDischarge.cs new file mode 100644 index 0000000000..a7c82637cd --- /dev/null +++ b/Projectiles/CosmicDischarge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicDischarge.png b/Projectiles/CosmicDischarge.png new file mode 100644 index 0000000000..83f54ed78d Binary files /dev/null and b/Projectiles/CosmicDischarge.png differ diff --git a/Projectiles/CosmicEnergy.cs b/Projectiles/CosmicEnergy.cs new file mode 100644 index 0000000000..d46acdb388 --- /dev/null +++ b/Projectiles/CosmicEnergy.cs @@ -0,0 +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 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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicEnergy.png b/Projectiles/CosmicEnergy.png new file mode 100644 index 0000000000..38b1a825fb Binary files /dev/null and b/Projectiles/CosmicEnergy.png differ diff --git a/Projectiles/CosmicFire.cs b/Projectiles/CosmicFire.cs new file mode 100644 index 0000000000..62e8230724 --- /dev/null +++ b/Projectiles/CosmicFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicFire.png b/Projectiles/CosmicFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/CosmicFire.png differ diff --git a/Projectiles/CosmicIceBurst.cs b/Projectiles/CosmicIceBurst.cs new file mode 100644 index 0000000000..b37b777493 --- /dev/null +++ b/Projectiles/CosmicIceBurst.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicIceBurst.png b/Projectiles/CosmicIceBurst.png new file mode 100644 index 0000000000..c80e2e6b35 Binary files /dev/null and b/Projectiles/CosmicIceBurst.png differ diff --git a/Projectiles/CosmicKunai.cs b/Projectiles/CosmicKunai.cs new file mode 100644 index 0000000000..24adfe585a --- /dev/null +++ b/Projectiles/CosmicKunai.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicKunai.png b/Projectiles/CosmicKunai.png new file mode 100644 index 0000000000..645149a78c Binary files /dev/null and b/Projectiles/CosmicKunai.png differ diff --git a/Projectiles/CosmicOrb.cs b/Projectiles/CosmicOrb.cs new file mode 100644 index 0000000000..ec495cf172 --- /dev/null +++ b/Projectiles/CosmicOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicOrb.png b/Projectiles/CosmicOrb.png new file mode 100644 index 0000000000..bb4835e1b2 Binary files /dev/null and b/Projectiles/CosmicOrb.png differ diff --git a/Projectiles/CosmicSpiritBomb1.cs b/Projectiles/CosmicSpiritBomb1.cs new file mode 100644 index 0000000000..0738e8fa0e --- /dev/null +++ b/Projectiles/CosmicSpiritBomb1.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicSpiritBomb1.png b/Projectiles/CosmicSpiritBomb1.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/CosmicSpiritBomb1.png differ diff --git a/Projectiles/CosmicSpiritBomb2.cs b/Projectiles/CosmicSpiritBomb2.cs new file mode 100644 index 0000000000..e3721971d6 --- /dev/null +++ b/Projectiles/CosmicSpiritBomb2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicSpiritBomb2.png b/Projectiles/CosmicSpiritBomb2.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/CosmicSpiritBomb2.png differ diff --git a/Projectiles/CosmicSpiritBomb3.cs b/Projectiles/CosmicSpiritBomb3.cs new file mode 100644 index 0000000000..56c9eb3e64 --- /dev/null +++ b/Projectiles/CosmicSpiritBomb3.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicSpiritBomb3.png b/Projectiles/CosmicSpiritBomb3.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/CosmicSpiritBomb3.png differ diff --git a/Projectiles/CosmicTentacle.cs b/Projectiles/CosmicTentacle.cs new file mode 100644 index 0000000000..c6aa13f1e8 --- /dev/null +++ b/Projectiles/CosmicTentacle.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CosmicTentacle.png b/Projectiles/CosmicTentacle.png new file mode 100644 index 0000000000..84f7b0870b Binary files /dev/null and b/Projectiles/CosmicTentacle.png differ diff --git a/Projectiles/Cosmilamp.cs b/Projectiles/Cosmilamp.cs new file mode 100644 index 0000000000..0c791e1a9e --- /dev/null +++ b/Projectiles/Cosmilamp.cs @@ -0,0 +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; + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Cosmilamp.png b/Projectiles/Cosmilamp.png new file mode 100644 index 0000000000..335f855c50 Binary files /dev/null and b/Projectiles/Cosmilamp.png differ diff --git a/Projectiles/Crimslime.cs b/Projectiles/Crimslime.cs new file mode 100644 index 0000000000..86cdf41070 --- /dev/null +++ b/Projectiles/Crimslime.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Crimslime.png b/Projectiles/Crimslime.png new file mode 100644 index 0000000000..f829626fbe Binary files /dev/null and b/Projectiles/Crimslime.png differ diff --git a/Projectiles/CrimsonSpike.cs b/Projectiles/CrimsonSpike.cs new file mode 100644 index 0000000000..32ee952ddb --- /dev/null +++ b/Projectiles/CrimsonSpike.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/CrimsonSpike.png b/Projectiles/CrimsonSpike.png new file mode 100644 index 0000000000..78d3df37b2 Binary files /dev/null and b/Projectiles/CrimsonSpike.png differ diff --git a/Projectiles/Crushax.cs b/Projectiles/Crushax.cs new file mode 100644 index 0000000000..8d18cd3201 --- /dev/null +++ b/Projectiles/Crushax.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Crushax.png b/Projectiles/Crushax.png new file mode 100644 index 0000000000..c90de40872 Binary files /dev/null and b/Projectiles/Crushax.png differ diff --git a/Projectiles/CrystalDust.cs b/Projectiles/CrystalDust.cs new file mode 100644 index 0000000000..3537231d1a --- /dev/null +++ b/Projectiles/CrystalDust.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 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/CrystalDust.png b/Projectiles/CrystalDust.png new file mode 100644 index 0000000000..59a8c48354 Binary files /dev/null and b/Projectiles/CrystalDust.png differ diff --git a/Projectiles/CrystalPiercerProjectile.cs b/Projectiles/CrystalPiercerProjectile.cs new file mode 100644 index 0000000000..23e17fb44d --- /dev/null +++ b/Projectiles/CrystalPiercerProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CrystalPiercerProjectile.png b/Projectiles/CrystalPiercerProjectile.png new file mode 100644 index 0000000000..91ad01f4ce Binary files /dev/null and b/Projectiles/CrystalPiercerProjectile.png differ diff --git a/Projectiles/Crystalline.cs b/Projectiles/Crystalline.cs new file mode 100644 index 0000000000..2624086a66 --- /dev/null +++ b/Projectiles/Crystalline.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Crystalline.png b/Projectiles/Crystalline.png new file mode 100644 index 0000000000..2da0cd4df8 Binary files /dev/null and b/Projectiles/Crystalline.png differ diff --git a/Projectiles/Crystalline2.cs b/Projectiles/Crystalline2.cs new file mode 100644 index 0000000000..fe9f4e3eeb --- /dev/null +++ b/Projectiles/Crystalline2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Crystalline2.png b/Projectiles/Crystalline2.png new file mode 100644 index 0000000000..1783364d36 Binary files /dev/null and b/Projectiles/Crystalline2.png differ diff --git a/Projectiles/CursedDagger.cs b/Projectiles/CursedDagger.cs new file mode 100644 index 0000000000..52774ed534 --- /dev/null +++ b/Projectiles/CursedDagger.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CursedDagger.png b/Projectiles/CursedDagger.png new file mode 100644 index 0000000000..9a81c1fccc Binary files /dev/null and b/Projectiles/CursedDagger.png differ diff --git a/Projectiles/CursedRound.cs b/Projectiles/CursedRound.cs new file mode 100644 index 0000000000..e7e47e0a56 --- /dev/null +++ b/Projectiles/CursedRound.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/CursedRound.png b/Projectiles/CursedRound.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/CursedRound.png differ diff --git a/Projectiles/DNA.cs b/Projectiles/DNA.cs new file mode 100644 index 0000000000..644bbe92ba --- /dev/null +++ b/Projectiles/DNA.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/DNA.png b/Projectiles/DNA.png new file mode 100644 index 0000000000..c983a54f5a Binary files /dev/null and b/Projectiles/DNA.png differ diff --git a/Projectiles/DNA2.cs b/Projectiles/DNA2.cs new file mode 100644 index 0000000000..0726317530 --- /dev/null +++ b/Projectiles/DNA2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/DNA2.png b/Projectiles/DNA2.png new file mode 100644 index 0000000000..c983a54f5a Binary files /dev/null and b/Projectiles/DNA2.png differ diff --git a/Projectiles/DaedalusCrystal.cs b/Projectiles/DaedalusCrystal.cs new file mode 100644 index 0000000000..fe83f49f07 --- /dev/null +++ b/Projectiles/DaedalusCrystal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DaedalusCrystal.png b/Projectiles/DaedalusCrystal.png new file mode 100644 index 0000000000..64d4138c1a Binary files /dev/null and b/Projectiles/DaedalusCrystal.png differ diff --git a/Projectiles/DaedalusCrystalShot.cs b/Projectiles/DaedalusCrystalShot.cs new file mode 100644 index 0000000000..c6b52e8d15 --- /dev/null +++ b/Projectiles/DaedalusCrystalShot.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DaedalusCrystalShot.png b/Projectiles/DaedalusCrystalShot.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/DaedalusCrystalShot.png differ diff --git a/Projectiles/DaemonsFlame.cs b/Projectiles/DaemonsFlame.cs new file mode 100644 index 0000000000..b6d94db067 --- /dev/null +++ b/Projectiles/DaemonsFlame.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/DaemonsFlame.png b/Projectiles/DaemonsFlame.png new file mode 100644 index 0000000000..87c087929c Binary files /dev/null and b/Projectiles/DaemonsFlame.png differ diff --git a/Projectiles/DaemonsFlameArrow.cs b/Projectiles/DaemonsFlameArrow.cs new file mode 100644 index 0000000000..f65bcb71cc --- /dev/null +++ b/Projectiles/DaemonsFlameArrow.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DaemonsFlameArrow.png b/Projectiles/DaemonsFlameArrow.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/DaemonsFlameArrow.png differ diff --git a/Projectiles/DankCreeper.cs b/Projectiles/DankCreeper.cs new file mode 100644 index 0000000000..c647107e5e --- /dev/null +++ b/Projectiles/DankCreeper.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/DankCreeper.png b/Projectiles/DankCreeper.png new file mode 100644 index 0000000000..d71993c057 Binary files /dev/null and b/Projectiles/DankCreeper.png differ diff --git a/Projectiles/Dark.cs b/Projectiles/Dark.cs new file mode 100644 index 0000000000..8c53bf47d3 --- /dev/null +++ b/Projectiles/Dark.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Dark.png b/Projectiles/Dark.png new file mode 100644 index 0000000000..7f62b3dfe7 Binary files /dev/null and b/Projectiles/Dark.png differ diff --git a/Projectiles/DarkBall.cs b/Projectiles/DarkBall.cs new file mode 100644 index 0000000000..81aaf4ab72 --- /dev/null +++ b/Projectiles/DarkBall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/DarkBall.png b/Projectiles/DarkBall.png new file mode 100644 index 0000000000..f7f5e52e88 Binary files /dev/null and b/Projectiles/DarkBall.png differ diff --git a/Projectiles/DarkEnergySpawn.cs b/Projectiles/DarkEnergySpawn.cs new file mode 100644 index 0000000000..c723aaf3d0 --- /dev/null +++ b/Projectiles/DarkEnergySpawn.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DarkEnergySpawn.png b/Projectiles/DarkEnergySpawn.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/DarkEnergySpawn.png differ diff --git a/Projectiles/DemonBlast.cs b/Projectiles/DemonBlast.cs new file mode 100644 index 0000000000..1317db1e89 --- /dev/null +++ b/Projectiles/DemonBlast.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/DemonBlast.png b/Projectiles/DemonBlast.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/DemonBlast.png differ diff --git a/Projectiles/DemonBlastType2.cs b/Projectiles/DemonBlastType2.cs new file mode 100644 index 0000000000..f61d6c5815 --- /dev/null +++ b/Projectiles/DemonBlastType2.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/DemonBlastType2.png b/Projectiles/DemonBlastType2.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/DemonBlastType2.png differ diff --git a/Projectiles/DemonBlastType3.cs b/Projectiles/DemonBlastType3.cs new file mode 100644 index 0000000000..c9275dc79b --- /dev/null +++ b/Projectiles/DemonBlastType3.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/DemonBlastType3.png b/Projectiles/DemonBlastType3.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/DemonBlastType3.png differ diff --git a/Projectiles/DemonicPitchfork.cs b/Projectiles/DemonicPitchfork.cs new file mode 100644 index 0000000000..42cd465df7 --- /dev/null +++ b/Projectiles/DemonicPitchfork.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DemonicPitchfork.png b/Projectiles/DemonicPitchfork.png new file mode 100644 index 0000000000..b5c9350d9f Binary files /dev/null and b/Projectiles/DemonicPitchfork.png differ diff --git a/Projectiles/DepthOrb.cs b/Projectiles/DepthOrb.cs new file mode 100644 index 0000000000..c22d7d3314 --- /dev/null +++ b/Projectiles/DepthOrb.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/DepthOrb.png b/Projectiles/DepthOrb.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/DepthOrb.png differ diff --git a/Projectiles/DepthOrb2.cs b/Projectiles/DepthOrb2.cs new file mode 100644 index 0000000000..89cff327e7 --- /dev/null +++ b/Projectiles/DepthOrb2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DepthOrb2.png b/Projectiles/DepthOrb2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/DepthOrb2.png differ diff --git a/Projectiles/DiseasedPike.cs b/Projectiles/DiseasedPike.cs new file mode 100644 index 0000000000..89d71ecce5 --- /dev/null +++ b/Projectiles/DiseasedPike.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/DiseasedPike.png b/Projectiles/DiseasedPike.png new file mode 100644 index 0000000000..74309de40a Binary files /dev/null and b/Projectiles/DiseasedPike.png differ diff --git a/Projectiles/DracoBeam.cs b/Projectiles/DracoBeam.cs new file mode 100644 index 0000000000..e41e795389 --- /dev/null +++ b/Projectiles/DracoBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DracoBeam.png b/Projectiles/DracoBeam.png new file mode 100644 index 0000000000..3ee36e47e9 Binary files /dev/null and b/Projectiles/DracoBeam.png differ diff --git a/Projectiles/DracoBeam2.cs b/Projectiles/DracoBeam2.cs new file mode 100644 index 0000000000..5651a4c5b1 --- /dev/null +++ b/Projectiles/DracoBeam2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DracoBeam2.png b/Projectiles/DracoBeam2.png new file mode 100644 index 0000000000..3ee36e47e9 Binary files /dev/null and b/Projectiles/DracoBeam2.png differ diff --git a/Projectiles/DragonBurst.cs b/Projectiles/DragonBurst.cs new file mode 100644 index 0000000000..1f8d86fb1c --- /dev/null +++ b/Projectiles/DragonBurst.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DragonBurst.png b/Projectiles/DragonBurst.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/DragonBurst.png differ diff --git a/Projectiles/DragonDust.cs b/Projectiles/DragonDust.cs new file mode 100644 index 0000000000..dd6f2557d5 --- /dev/null +++ b/Projectiles/DragonDust.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/DragonDust.png b/Projectiles/DragonDust.png new file mode 100644 index 0000000000..59a8c48354 Binary files /dev/null and b/Projectiles/DragonDust.png differ diff --git a/Projectiles/DragonRage.cs b/Projectiles/DragonRage.cs new file mode 100644 index 0000000000..d90a01c677 --- /dev/null +++ b/Projectiles/DragonRage.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DragonRage.png b/Projectiles/DragonRage.png new file mode 100644 index 0000000000..3961db41df Binary files /dev/null and b/Projectiles/DragonRage.png differ diff --git a/Projectiles/Drataliornus.cs b/Projectiles/Drataliornus.cs new file mode 100644 index 0000000000..4f75c5e420 --- /dev/null +++ b/Projectiles/Drataliornus.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Drataliornus.png b/Projectiles/Drataliornus.png new file mode 100644 index 0000000000..35dab92fcd Binary files /dev/null and b/Projectiles/Drataliornus.png differ diff --git a/Projectiles/DrataliornusExoArrow.cs b/Projectiles/DrataliornusExoArrow.cs new file mode 100644 index 0000000000..32cbf3303b --- /dev/null +++ b/Projectiles/DrataliornusExoArrow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/DrataliornusExoArrow.png b/Projectiles/DrataliornusExoArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/DrataliornusExoArrow.png differ diff --git a/Projectiles/DrataliornusFlame.cs b/Projectiles/DrataliornusFlame.cs new file mode 100644 index 0000000000..663c493563 --- /dev/null +++ b/Projectiles/DrataliornusFlame.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DrataliornusFlame.png b/Projectiles/DrataliornusFlame.png new file mode 100644 index 0000000000..a6f7327dc7 Binary files /dev/null and b/Projectiles/DrataliornusFlame.png differ diff --git a/Projectiles/Dreadmine.cs b/Projectiles/Dreadmine.cs new file mode 100644 index 0000000000..cb43d97369 --- /dev/null +++ b/Projectiles/Dreadmine.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Dreadmine.png b/Projectiles/Dreadmine.png new file mode 100644 index 0000000000..2ebb9113cf Binary files /dev/null and b/Projectiles/Dreadmine.png differ diff --git a/Projectiles/DreadmineTurret.cs b/Projectiles/DreadmineTurret.cs new file mode 100644 index 0000000000..57fa263463 --- /dev/null +++ b/Projectiles/DreadmineTurret.cs @@ -0,0 +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 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; + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DreadmineTurret.png b/Projectiles/DreadmineTurret.png new file mode 100644 index 0000000000..caa6bf6b69 Binary files /dev/null and b/Projectiles/DreadmineTurret.png differ diff --git a/Projectiles/DrewsSandyWaifu.cs b/Projectiles/DrewsSandyWaifu.cs new file mode 100644 index 0000000000..f17f3742c7 --- /dev/null +++ b/Projectiles/DrewsSandyWaifu.cs @@ -0,0 +1,290 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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); + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DrewsSandyWaifu.png b/Projectiles/DrewsSandyWaifu.png new file mode 100644 index 0000000000..44c0f7eb77 Binary files /dev/null and b/Projectiles/DrewsSandyWaifu.png differ diff --git a/Projectiles/DrillCannon.png b/Projectiles/DrillCannon.png new file mode 100644 index 0000000000..8dc6970475 Binary files /dev/null and b/Projectiles/DrillCannon.png differ diff --git a/Projectiles/DustProjectile.cs b/Projectiles/DustProjectile.cs new file mode 100644 index 0000000000..585e4300d2 --- /dev/null +++ b/Projectiles/DustProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/DustProjectile.png b/Projectiles/DustProjectile.png new file mode 100644 index 0000000000..77e7330592 Binary files /dev/null and b/Projectiles/DustProjectile.png differ diff --git a/Projectiles/DuststormCloud.cs b/Projectiles/DuststormCloud.cs new file mode 100644 index 0000000000..4db8869227 --- /dev/null +++ b/Projectiles/DuststormCloud.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 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/DuststormCloud.png b/Projectiles/DuststormCloud.png new file mode 100644 index 0000000000..b3ef97ca5a Binary files /dev/null and b/Projectiles/DuststormCloud.png differ diff --git a/Projectiles/DuststormInABottle.cs b/Projectiles/DuststormInABottle.cs new file mode 100644 index 0000000000..b0b50227d7 --- /dev/null +++ b/Projectiles/DuststormInABottle.cs @@ -0,0 +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)); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/DuststormInABottle.png b/Projectiles/DuststormInABottle.png new file mode 100644 index 0000000000..1e049812e3 Binary files /dev/null and b/Projectiles/DuststormInABottle.png differ diff --git a/Projectiles/Earth.cs b/Projectiles/Earth.cs new file mode 100644 index 0000000000..815250a0d6 --- /dev/null +++ b/Projectiles/Earth.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Earth.png b/Projectiles/Earth.png new file mode 100644 index 0000000000..ab03cbf3af Binary files /dev/null and b/Projectiles/Earth.png differ diff --git a/Projectiles/Earth2.cs b/Projectiles/Earth2.cs new file mode 100644 index 0000000000..c04daa47ad --- /dev/null +++ b/Projectiles/Earth2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Earth2.png b/Projectiles/Earth2.png new file mode 100644 index 0000000000..ffd272bc9a Binary files /dev/null and b/Projectiles/Earth2.png differ diff --git a/Projectiles/Earth3.cs b/Projectiles/Earth3.cs new file mode 100644 index 0000000000..0a8d6fdd17 --- /dev/null +++ b/Projectiles/Earth3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Earth3.png b/Projectiles/Earth3.png new file mode 100644 index 0000000000..816c0bfa15 Binary files /dev/null and b/Projectiles/Earth3.png differ diff --git a/Projectiles/Earth4.cs b/Projectiles/Earth4.cs new file mode 100644 index 0000000000..5dfc3328a0 --- /dev/null +++ b/Projectiles/Earth4.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Earth4.png b/Projectiles/Earth4.png new file mode 100644 index 0000000000..aefb4f61d2 Binary files /dev/null and b/Projectiles/Earth4.png differ diff --git a/Projectiles/EarthHealOrb.cs b/Projectiles/EarthHealOrb.cs new file mode 100644 index 0000000000..7ffc5f3ff7 --- /dev/null +++ b/Projectiles/EarthHealOrb.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/EarthHealOrb.png b/Projectiles/EarthHealOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/EarthHealOrb.png differ diff --git a/Projectiles/EarthRockBig.cs b/Projectiles/EarthRockBig.cs new file mode 100644 index 0000000000..57d3b2f029 --- /dev/null +++ b/Projectiles/EarthRockBig.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EarthRockBig.png b/Projectiles/EarthRockBig.png new file mode 100644 index 0000000000..aa5fe5b904 Binary files /dev/null and b/Projectiles/EarthRockBig.png differ diff --git a/Projectiles/EarthRockSmall.cs b/Projectiles/EarthRockSmall.cs new file mode 100644 index 0000000000..b88930adf8 --- /dev/null +++ b/Projectiles/EarthRockSmall.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EarthRockSmall.png b/Projectiles/EarthRockSmall.png new file mode 100644 index 0000000000..e28023b0e3 Binary files /dev/null and b/Projectiles/EarthRockSmall.png differ diff --git a/Projectiles/EarthenPike.cs b/Projectiles/EarthenPike.cs new file mode 100644 index 0000000000..86f87cabaf --- /dev/null +++ b/Projectiles/EarthenPike.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EarthenPike.png b/Projectiles/EarthenPike.png new file mode 100644 index 0000000000..ff2c93587a Binary files /dev/null and b/Projectiles/EarthenPike.png differ diff --git a/Projectiles/EidolicWail.cs b/Projectiles/EidolicWail.cs new file mode 100644 index 0000000000..0f8aa3dee6 --- /dev/null +++ b/Projectiles/EidolicWail.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/EidolicWail.png b/Projectiles/EidolicWail.png new file mode 100644 index 0000000000..2739c2b429 Binary files /dev/null and b/Projectiles/EidolicWail.png differ diff --git a/Projectiles/EldritchTentacle.cs b/Projectiles/EldritchTentacle.cs new file mode 100644 index 0000000000..72ff7cc7b1 --- /dev/null +++ b/Projectiles/EldritchTentacle.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EldritchTentacle.png b/Projectiles/EldritchTentacle.png new file mode 100644 index 0000000000..84f7b0870b Binary files /dev/null and b/Projectiles/EldritchTentacle.png differ diff --git a/Projectiles/ElementBall.cs b/Projectiles/ElementBall.cs new file mode 100644 index 0000000000..afd53f757a --- /dev/null +++ b/Projectiles/ElementBall.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 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/ElementBall.png b/Projectiles/ElementBall.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/ElementBall.png differ diff --git a/Projectiles/ElementBallShiv.cs b/Projectiles/ElementBallShiv.cs new file mode 100644 index 0000000000..d15b84c469 --- /dev/null +++ b/Projectiles/ElementBallShiv.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementBallShiv.png b/Projectiles/ElementBallShiv.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/ElementBallShiv.png differ diff --git a/Projectiles/ElementBolt.cs b/Projectiles/ElementBolt.cs new file mode 100644 index 0000000000..14f2baeba5 --- /dev/null +++ b/Projectiles/ElementBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementBolt.png b/Projectiles/ElementBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/ElementBolt.png differ diff --git a/Projectiles/ElementBolt2.cs b/Projectiles/ElementBolt2.cs new file mode 100644 index 0000000000..6d82723e35 --- /dev/null +++ b/Projectiles/ElementBolt2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementBolt2.png b/Projectiles/ElementBolt2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/ElementBolt2.png differ diff --git a/Projectiles/ElementOrb.cs b/Projectiles/ElementOrb.cs new file mode 100644 index 0000000000..444425c248 --- /dev/null +++ b/Projectiles/ElementOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementOrb.png b/Projectiles/ElementOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/ElementOrb.png differ diff --git a/Projectiles/ElementOrb2.cs b/Projectiles/ElementOrb2.cs new file mode 100644 index 0000000000..5ac75b4857 --- /dev/null +++ b/Projectiles/ElementOrb2.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementOrb2.png b/Projectiles/ElementOrb2.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/ElementOrb2.png differ diff --git a/Projectiles/ElementRay.cs b/Projectiles/ElementRay.cs new file mode 100644 index 0000000000..5ae81539ce --- /dev/null +++ b/Projectiles/ElementRay.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementRay.png b/Projectiles/ElementRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/ElementRay.png differ diff --git a/Projectiles/ElementTentacle.cs b/Projectiles/ElementTentacle.cs new file mode 100644 index 0000000000..ab381b1669 --- /dev/null +++ b/Projectiles/ElementTentacle.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementTentacle.png b/Projectiles/ElementTentacle.png new file mode 100644 index 0000000000..84f7b0870b Binary files /dev/null and b/Projectiles/ElementTentacle.png differ diff --git a/Projectiles/ElementalAxe.cs b/Projectiles/ElementalAxe.cs new file mode 100644 index 0000000000..310718a077 --- /dev/null +++ b/Projectiles/ElementalAxe.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ElementalAxe.png b/Projectiles/ElementalAxe.png new file mode 100644 index 0000000000..d5862b9ec7 Binary files /dev/null and b/Projectiles/ElementalAxe.png differ diff --git a/Projectiles/ElysianArrow.cs b/Projectiles/ElysianArrow.cs new file mode 100644 index 0000000000..e6b531d26a --- /dev/null +++ b/Projectiles/ElysianArrow.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ElysianArrow.png b/Projectiles/ElysianArrow.png new file mode 100644 index 0000000000..bf8d18b65e Binary files /dev/null and b/Projectiles/ElysianArrow.png differ diff --git a/Projectiles/EmpyreanKnives.cs b/Projectiles/EmpyreanKnives.cs new file mode 100644 index 0000000000..5277e8e4ed --- /dev/null +++ b/Projectiles/EmpyreanKnives.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EmpyreanKnives.png b/Projectiles/EmpyreanKnives.png new file mode 100644 index 0000000000..09b796a5aa Binary files /dev/null and b/Projectiles/EmpyreanKnives.png differ diff --git a/Projectiles/EnhancedNanoRound.cs b/Projectiles/EnhancedNanoRound.cs new file mode 100644 index 0000000000..5aac624dd2 --- /dev/null +++ b/Projectiles/EnhancedNanoRound.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EnhancedNanoRound.png b/Projectiles/EnhancedNanoRound.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/EnhancedNanoRound.png differ diff --git a/Projectiles/EonBeam.cs b/Projectiles/EonBeam.cs new file mode 100644 index 0000000000..57c379e780 --- /dev/null +++ b/Projectiles/EonBeam.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/EonBeam.png b/Projectiles/EonBeam.png new file mode 100644 index 0000000000..417541d511 Binary files /dev/null and b/Projectiles/EonBeam.png differ diff --git a/Projectiles/EonBeamV2.cs b/Projectiles/EonBeamV2.cs new file mode 100644 index 0000000000..5a602b47b1 --- /dev/null +++ b/Projectiles/EonBeamV2.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/EonBeamV2.png b/Projectiles/EonBeamV2.png new file mode 100644 index 0000000000..b31e53bf14 Binary files /dev/null and b/Projectiles/EonBeamV2.png differ diff --git a/Projectiles/EonBeamV3.cs b/Projectiles/EonBeamV3.cs new file mode 100644 index 0000000000..26f49b8414 --- /dev/null +++ b/Projectiles/EonBeamV3.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EonBeamV3.png b/Projectiles/EonBeamV3.png new file mode 100644 index 0000000000..7723e59bf7 Binary files /dev/null and b/Projectiles/EonBeamV3.png differ diff --git a/Projectiles/EonBeamV4.cs b/Projectiles/EonBeamV4.cs new file mode 100644 index 0000000000..d66229f469 --- /dev/null +++ b/Projectiles/EonBeamV4.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EonBeamV4.png b/Projectiles/EonBeamV4.png new file mode 100644 index 0000000000..0bd97578a2 Binary files /dev/null and b/Projectiles/EonBeamV4.png differ diff --git a/Projectiles/EradicatorMeleeProjectile.cs b/Projectiles/EradicatorMeleeProjectile.cs new file mode 100644 index 0000000000..27bbac2e61 --- /dev/null +++ b/Projectiles/EradicatorMeleeProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/EradicatorMeleeProjectile.png b/Projectiles/EradicatorMeleeProjectile.png new file mode 100644 index 0000000000..e12958fc93 Binary files /dev/null and b/Projectiles/EradicatorMeleeProjectile.png differ diff --git a/Projectiles/EradicatorProjectile.cs b/Projectiles/EradicatorProjectile.cs new file mode 100644 index 0000000000..e25d168dd2 --- /dev/null +++ b/Projectiles/EradicatorProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/EradicatorProjectile.png b/Projectiles/EradicatorProjectile.png new file mode 100644 index 0000000000..e12958fc93 Binary files /dev/null and b/Projectiles/EradicatorProjectile.png differ diff --git a/Projectiles/EssenceBeam.cs b/Projectiles/EssenceBeam.cs new file mode 100644 index 0000000000..2a10a8294f --- /dev/null +++ b/Projectiles/EssenceBeam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceBeam.png b/Projectiles/EssenceBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/EssenceBeam.png differ diff --git a/Projectiles/EssenceBurst.cs b/Projectiles/EssenceBurst.cs new file mode 100644 index 0000000000..928df69d92 --- /dev/null +++ b/Projectiles/EssenceBurst.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceBurst.png b/Projectiles/EssenceBurst.png new file mode 100644 index 0000000000..84f7b0870b Binary files /dev/null and b/Projectiles/EssenceBurst.png differ diff --git a/Projectiles/EssenceFire.cs b/Projectiles/EssenceFire.cs new file mode 100644 index 0000000000..98f2b93ff1 --- /dev/null +++ b/Projectiles/EssenceFire.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceFire.png b/Projectiles/EssenceFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/EssenceFire.png differ diff --git a/Projectiles/EssenceFlame.cs b/Projectiles/EssenceFlame.cs new file mode 100644 index 0000000000..3a251595c4 --- /dev/null +++ b/Projectiles/EssenceFlame.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceFlame.png b/Projectiles/EssenceFlame.png new file mode 100644 index 0000000000..2ef4c2dba5 Binary files /dev/null and b/Projectiles/EssenceFlame.png differ diff --git a/Projectiles/EssenceFlame2.cs b/Projectiles/EssenceFlame2.cs new file mode 100644 index 0000000000..c1ae5207ea --- /dev/null +++ b/Projectiles/EssenceFlame2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceFlame2.png b/Projectiles/EssenceFlame2.png new file mode 100644 index 0000000000..2ef4c2dba5 Binary files /dev/null and b/Projectiles/EssenceFlame2.png differ diff --git a/Projectiles/EssenceScythe.cs b/Projectiles/EssenceScythe.cs new file mode 100644 index 0000000000..34ff0ee83a --- /dev/null +++ b/Projectiles/EssenceScythe.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/EssenceScythe.png b/Projectiles/EssenceScythe.png new file mode 100644 index 0000000000..1aa52f5284 Binary files /dev/null and b/Projectiles/EssenceScythe.png differ diff --git a/Projectiles/EvergladeSprayProjectile.cs b/Projectiles/EvergladeSprayProjectile.cs new file mode 100644 index 0000000000..115c58f958 --- /dev/null +++ b/Projectiles/EvergladeSprayProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/EvergladeSprayProjectile.png b/Projectiles/EvergladeSprayProjectile.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/EvergladeSprayProjectile.png differ diff --git a/Projectiles/ExecutionersBlade.cs b/Projectiles/ExecutionersBlade.cs new file mode 100644 index 0000000000..dd8aca6155 --- /dev/null +++ b/Projectiles/ExecutionersBlade.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ExecutionersBlade.png b/Projectiles/ExecutionersBlade.png new file mode 100644 index 0000000000..1a71859059 Binary files /dev/null and b/Projectiles/ExecutionersBlade.png differ diff --git a/Projectiles/ExoFire.cs b/Projectiles/ExoFire.cs new file mode 100644 index 0000000000..6f92a4fb99 --- /dev/null +++ b/Projectiles/ExoFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ExoFire.png b/Projectiles/ExoFire.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/ExoFire.png differ diff --git a/Projectiles/ExoMark.cs b/Projectiles/ExoMark.cs new file mode 100644 index 0000000000..fe0eb043df --- /dev/null +++ b/Projectiles/ExoMark.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ExoMark.png b/Projectiles/ExoMark.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/ExoMark.png differ diff --git a/Projectiles/ExoTornado.cs b/Projectiles/ExoTornado.cs new file mode 100644 index 0000000000..e24082500d --- /dev/null +++ b/Projectiles/ExoTornado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ExoTornado.png b/Projectiles/ExoTornado.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/ExoTornado.png differ diff --git a/Projectiles/Exobeam.cs b/Projectiles/Exobeam.cs new file mode 100644 index 0000000000..1b67f63b28 --- /dev/null +++ b/Projectiles/Exobeam.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/Exobeam.png b/Projectiles/Exobeam.png new file mode 100644 index 0000000000..b35841741b Binary files /dev/null and b/Projectiles/Exobeam.png differ diff --git a/Projectiles/Exoboom.cs b/Projectiles/Exoboom.cs new file mode 100644 index 0000000000..70614ad64e --- /dev/null +++ b/Projectiles/Exoboom.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 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/Exoboom.png b/Projectiles/Exoboom.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/Exoboom.png differ diff --git a/Projectiles/Exocomet.cs b/Projectiles/Exocomet.cs new file mode 100644 index 0000000000..d5e38503ad --- /dev/null +++ b/Projectiles/Exocomet.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Exocomet.png b/Projectiles/Exocomet.png new file mode 100644 index 0000000000..abdb698535 Binary files /dev/null and b/Projectiles/Exocomet.png differ diff --git a/Projectiles/Exoheal.cs b/Projectiles/Exoheal.cs new file mode 100644 index 0000000000..5f4bf47276 --- /dev/null +++ b/Projectiles/Exoheal.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/Exoheal.png b/Projectiles/Exoheal.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Exoheal.png differ diff --git a/Projectiles/ExplodingStake.cs b/Projectiles/ExplodingStake.cs new file mode 100644 index 0000000000..34bd481ace --- /dev/null +++ b/Projectiles/ExplodingStake.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ExplodingStake.png b/Projectiles/ExplodingStake.png new file mode 100644 index 0000000000..0a7f580d1a Binary files /dev/null and b/Projectiles/ExplodingStake.png differ diff --git a/Projectiles/ExsanguinationLanceProjectile.cs b/Projectiles/ExsanguinationLanceProjectile.cs new file mode 100644 index 0000000000..6879a1d462 --- /dev/null +++ b/Projectiles/ExsanguinationLanceProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ExsanguinationLanceProjectile.png b/Projectiles/ExsanguinationLanceProjectile.png new file mode 100644 index 0000000000..115b1dd4bd Binary files /dev/null and b/Projectiles/ExsanguinationLanceProjectile.png differ diff --git a/Projectiles/FabBolt.cs b/Projectiles/FabBolt.cs new file mode 100644 index 0000000000..9bd5f30a3a --- /dev/null +++ b/Projectiles/FabBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FabBolt.png b/Projectiles/FabBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/FabBolt.png differ diff --git a/Projectiles/FabOrb.cs b/Projectiles/FabOrb.cs new file mode 100644 index 0000000000..7252408c24 --- /dev/null +++ b/Projectiles/FabOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FabOrb.png b/Projectiles/FabOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/FabOrb.png differ diff --git a/Projectiles/FabRay.cs b/Projectiles/FabRay.cs new file mode 100644 index 0000000000..91b39dfb6a --- /dev/null +++ b/Projectiles/FabRay.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 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/FabRay.png b/Projectiles/FabRay.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/FabRay.png differ diff --git a/Projectiles/FabsolDust.cs b/Projectiles/FabsolDust.cs new file mode 100644 index 0000000000..2dc08c13cf --- /dev/null +++ b/Projectiles/FabsolDust.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FabsolDust.png b/Projectiles/FabsolDust.png new file mode 100644 index 0000000000..b2414440a0 Binary files /dev/null and b/Projectiles/FabsolDust.png differ diff --git a/Projectiles/FatesReveal.cs b/Projectiles/FatesReveal.cs new file mode 100644 index 0000000000..3db6d73288 --- /dev/null +++ b/Projectiles/FatesReveal.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FatesReveal.png b/Projectiles/FatesReveal.png new file mode 100644 index 0000000000..08f5179cd1 Binary files /dev/null and b/Projectiles/FatesReveal.png differ diff --git a/Projectiles/FeatherKnifeProjectile.cs b/Projectiles/FeatherKnifeProjectile.cs new file mode 100644 index 0000000000..71fcc51a3c --- /dev/null +++ b/Projectiles/FeatherKnifeProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FeatherKnifeProjectile.png b/Projectiles/FeatherKnifeProjectile.png new file mode 100644 index 0000000000..6f3569825a Binary files /dev/null and b/Projectiles/FeatherKnifeProjectile.png differ diff --git a/Projectiles/FishronRPG.cs b/Projectiles/FishronRPG.cs new file mode 100644 index 0000000000..1f5e60472e --- /dev/null +++ b/Projectiles/FishronRPG.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FishronRPG.png b/Projectiles/FishronRPG.png new file mode 100644 index 0000000000..6fd09fb62a Binary files /dev/null and b/Projectiles/FishronRPG.png differ diff --git a/Projectiles/FlakKraken.cs b/Projectiles/FlakKraken.cs new file mode 100644 index 0000000000..c904ab5749 --- /dev/null +++ b/Projectiles/FlakKraken.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/FlakKraken.png b/Projectiles/FlakKraken.png new file mode 100644 index 0000000000..b8303e5d68 Binary files /dev/null and b/Projectiles/FlakKraken.png differ diff --git a/Projectiles/FlakKrakenGun.cs b/Projectiles/FlakKrakenGun.cs new file mode 100644 index 0000000000..f7ee6e1fb3 --- /dev/null +++ b/Projectiles/FlakKrakenGun.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlakKrakenGun.png b/Projectiles/FlakKrakenGun.png new file mode 100644 index 0000000000..88f490cdcd Binary files /dev/null and b/Projectiles/FlakKrakenGun.png differ diff --git a/Projectiles/FlameBeamTip.cs b/Projectiles/FlameBeamTip.cs new file mode 100644 index 0000000000..a153704698 --- /dev/null +++ b/Projectiles/FlameBeamTip.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/FlameBeamTip.png b/Projectiles/FlameBeamTip.png new file mode 100644 index 0000000000..d5a672aac7 Binary files /dev/null and b/Projectiles/FlameBeamTip.png differ diff --git a/Projectiles/FlameBeamTip2.cs b/Projectiles/FlameBeamTip2.cs new file mode 100644 index 0000000000..cfcda72cb3 --- /dev/null +++ b/Projectiles/FlameBeamTip2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlameBeamTip2.png b/Projectiles/FlameBeamTip2.png new file mode 100644 index 0000000000..d5a672aac7 Binary files /dev/null and b/Projectiles/FlameBeamTip2.png differ diff --git a/Projectiles/FlameBlast.cs b/Projectiles/FlameBlast.cs new file mode 100644 index 0000000000..c776adc02e --- /dev/null +++ b/Projectiles/FlameBlast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlameBlast.png b/Projectiles/FlameBlast.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FlameBlast.png differ diff --git a/Projectiles/FlameBurst.cs b/Projectiles/FlameBurst.cs new file mode 100644 index 0000000000..666157e15e --- /dev/null +++ b/Projectiles/FlameBurst.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlameBurst.png b/Projectiles/FlameBurst.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FlameBurst.png differ diff --git a/Projectiles/FlameBurstHostile.cs b/Projectiles/FlameBurstHostile.cs new file mode 100644 index 0000000000..ce46cb54af --- /dev/null +++ b/Projectiles/FlameBurstHostile.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/FlameBurstHostile.png b/Projectiles/FlameBurstHostile.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FlameBurstHostile.png differ diff --git a/Projectiles/FlamePillar.cs b/Projectiles/FlamePillar.cs new file mode 100644 index 0000000000..a4ce846605 --- /dev/null +++ b/Projectiles/FlamePillar.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlamePillar.png b/Projectiles/FlamePillar.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/FlamePillar.png differ diff --git a/Projectiles/FlameScytheProjectile.cs b/Projectiles/FlameScytheProjectile.cs new file mode 100644 index 0000000000..af5199fee8 --- /dev/null +++ b/Projectiles/FlameScytheProjectile.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlameScytheProjectile.png b/Projectiles/FlameScytheProjectile.png new file mode 100644 index 0000000000..6df15cd567 Binary files /dev/null and b/Projectiles/FlameScytheProjectile.png differ diff --git a/Projectiles/FlameScytheProjectileMelee.cs b/Projectiles/FlameScytheProjectileMelee.cs new file mode 100644 index 0000000000..e43054c07f --- /dev/null +++ b/Projectiles/FlameScytheProjectileMelee.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlameScytheProjectileMelee.png b/Projectiles/FlameScytheProjectileMelee.png new file mode 100644 index 0000000000..6df15cd567 Binary files /dev/null and b/Projectiles/FlameScytheProjectileMelee.png differ diff --git a/Projectiles/FlamingPumpkin.cs b/Projectiles/FlamingPumpkin.cs new file mode 100644 index 0000000000..ee33350175 --- /dev/null +++ b/Projectiles/FlamingPumpkin.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlamingPumpkin.png b/Projectiles/FlamingPumpkin.png new file mode 100644 index 0000000000..ee9283758a Binary files /dev/null and b/Projectiles/FlamingPumpkin.png differ diff --git a/Projectiles/FlamingStake.cs b/Projectiles/FlamingStake.cs new file mode 100644 index 0000000000..3cd0a4c8b9 --- /dev/null +++ b/Projectiles/FlamingStake.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlamingStake.png b/Projectiles/FlamingStake.png new file mode 100644 index 0000000000..bde4f15c6f Binary files /dev/null and b/Projectiles/FlamingStake.png differ diff --git a/Projectiles/FlareBat.cs b/Projectiles/FlareBat.cs new file mode 100644 index 0000000000..641e775d2d --- /dev/null +++ b/Projectiles/FlareBat.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlareBat.png b/Projectiles/FlareBat.png new file mode 100644 index 0000000000..f6ce1f8ca6 Binary files /dev/null and b/Projectiles/FlareBat.png differ diff --git a/Projectiles/FlareBoltProjectile.cs b/Projectiles/FlareBoltProjectile.cs new file mode 100644 index 0000000000..3dfa1ebe68 --- /dev/null +++ b/Projectiles/FlareBoltProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlareBoltProjectile.png b/Projectiles/FlareBoltProjectile.png new file mode 100644 index 0000000000..c0b9af4701 Binary files /dev/null and b/Projectiles/FlareBoltProjectile.png differ diff --git a/Projectiles/FlareExplosion.cs b/Projectiles/FlareExplosion.cs new file mode 100644 index 0000000000..bf06f96876 --- /dev/null +++ b/Projectiles/FlareExplosion.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlareExplosion.png b/Projectiles/FlareExplosion.png new file mode 100644 index 0000000000..e975d88423 Binary files /dev/null and b/Projectiles/FlareExplosion.png differ diff --git a/Projectiles/FlareExplosionHuge.cs b/Projectiles/FlareExplosionHuge.cs new file mode 100644 index 0000000000..6e7237033a --- /dev/null +++ b/Projectiles/FlareExplosionHuge.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FlareExplosionHuge.png b/Projectiles/FlareExplosionHuge.png new file mode 100644 index 0000000000..d0ac21fbc0 Binary files /dev/null and b/Projectiles/FlareExplosionHuge.png differ diff --git a/Projectiles/Flarefrost.cs b/Projectiles/Flarefrost.cs new file mode 100644 index 0000000000..0018222079 --- /dev/null +++ b/Projectiles/Flarefrost.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Flarefrost.png b/Projectiles/Flarefrost.png new file mode 100644 index 0000000000..5188920caa Binary files /dev/null and b/Projectiles/Flarefrost.png differ diff --git a/Projectiles/Flash.cs b/Projectiles/Flash.cs new file mode 100644 index 0000000000..cea3735a78 --- /dev/null +++ b/Projectiles/Flash.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Flash.png b/Projectiles/Flash.png new file mode 100644 index 0000000000..3cb685553d Binary files /dev/null and b/Projectiles/Flash.png differ diff --git a/Projectiles/FlashBullet.cs b/Projectiles/FlashBullet.cs new file mode 100644 index 0000000000..076f70a386 --- /dev/null +++ b/Projectiles/FlashBullet.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FlashBullet.png b/Projectiles/FlashBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/FlashBullet.png differ diff --git a/Projectiles/ForbiddenAxeBlade.cs b/Projectiles/ForbiddenAxeBlade.cs new file mode 100644 index 0000000000..6a9e263fb6 --- /dev/null +++ b/Projectiles/ForbiddenAxeBlade.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ForbiddenAxeBlade.png b/Projectiles/ForbiddenAxeBlade.png new file mode 100644 index 0000000000..f252a32853 Binary files /dev/null and b/Projectiles/ForbiddenAxeBlade.png differ diff --git a/Projectiles/ForbiddenSunProjectile.cs b/Projectiles/ForbiddenSunProjectile.cs new file mode 100644 index 0000000000..3c6035560b --- /dev/null +++ b/Projectiles/ForbiddenSunProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ForbiddenSunProjectile.png b/Projectiles/ForbiddenSunProjectile.png new file mode 100644 index 0000000000..314e8ea2b0 Binary files /dev/null and b/Projectiles/ForbiddenSunProjectile.png differ diff --git a/Projectiles/ForbiddenSunburst.cs b/Projectiles/ForbiddenSunburst.cs new file mode 100644 index 0000000000..6178bfaf3c --- /dev/null +++ b/Projectiles/ForbiddenSunburst.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/ForbiddenSunburst.png b/Projectiles/ForbiddenSunburst.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/ForbiddenSunburst.png differ diff --git a/Projectiles/FossilShard.cs b/Projectiles/FossilShard.cs new file mode 100644 index 0000000000..dbf93f1f78 --- /dev/null +++ b/Projectiles/FossilShard.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FossilShard.png b/Projectiles/FossilShard.png new file mode 100644 index 0000000000..75ea1cfd83 Binary files /dev/null and b/Projectiles/FossilShard.png differ diff --git a/Projectiles/FossilSpike.cs b/Projectiles/FossilSpike.cs new file mode 100644 index 0000000000..282693ec8d --- /dev/null +++ b/Projectiles/FossilSpike.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FossilSpike.png b/Projectiles/FossilSpike.png new file mode 100644 index 0000000000..fb666e7969 Binary files /dev/null and b/Projectiles/FossilSpike.png differ diff --git a/Projectiles/Fox.cs b/Projectiles/Fox.cs new file mode 100644 index 0000000000..10689e4979 --- /dev/null +++ b/Projectiles/Fox.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Fox.png b/Projectiles/Fox.png new file mode 100644 index 0000000000..cd75e59b98 Binary files /dev/null and b/Projectiles/Fox.png differ diff --git a/Projectiles/FrigidflashBoltProjectile.cs b/Projectiles/FrigidflashBoltProjectile.cs new file mode 100644 index 0000000000..b8dc4b1f4a --- /dev/null +++ b/Projectiles/FrigidflashBoltProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FrigidflashBoltProjectile.png b/Projectiles/FrigidflashBoltProjectile.png new file mode 100644 index 0000000000..28da9a05f2 Binary files /dev/null and b/Projectiles/FrigidflashBoltProjectile.png differ diff --git a/Projectiles/FrostBoltProjectile.cs b/Projectiles/FrostBoltProjectile.cs new file mode 100644 index 0000000000..012c2a97e0 --- /dev/null +++ b/Projectiles/FrostBoltProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FrostBoltProjectile.png b/Projectiles/FrostBoltProjectile.png new file mode 100644 index 0000000000..ed4e3450c0 Binary files /dev/null and b/Projectiles/FrostBoltProjectile.png differ diff --git a/Projectiles/FrostMistFriendly.cs b/Projectiles/FrostMistFriendly.cs new file mode 100644 index 0000000000..eb074f2b81 --- /dev/null +++ b/Projectiles/FrostMistFriendly.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FrostMistFriendly.png b/Projectiles/FrostMistFriendly.png new file mode 100644 index 0000000000..8349afb42d Binary files /dev/null and b/Projectiles/FrostMistFriendly.png differ diff --git a/Projectiles/FrostsparkBullet.cs b/Projectiles/FrostsparkBullet.cs new file mode 100644 index 0000000000..493d62d38d --- /dev/null +++ b/Projectiles/FrostsparkBullet.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FrostsparkBullet.png b/Projectiles/FrostsparkBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/FrostsparkBullet.png differ diff --git a/Projectiles/FungalClump.cs b/Projectiles/FungalClump.cs new file mode 100644 index 0000000000..4cbcbbcf3f --- /dev/null +++ b/Projectiles/FungalClump.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FungalClump.png b/Projectiles/FungalClump.png new file mode 100644 index 0000000000..537360db53 Binary files /dev/null and b/Projectiles/FungalClump.png differ diff --git a/Projectiles/FungalHeal.cs b/Projectiles/FungalHeal.cs new file mode 100644 index 0000000000..0be9213e96 --- /dev/null +++ b/Projectiles/FungalHeal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/FungalHeal.png b/Projectiles/FungalHeal.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FungalHeal.png differ diff --git a/Projectiles/FungiOrb.cs b/Projectiles/FungiOrb.cs new file mode 100644 index 0000000000..ed4cde6341 --- /dev/null +++ b/Projectiles/FungiOrb.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/FungiOrb.png b/Projectiles/FungiOrb.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FungiOrb.png differ diff --git a/Projectiles/FungiOrb2.cs b/Projectiles/FungiOrb2.cs new file mode 100644 index 0000000000..5727981602 --- /dev/null +++ b/Projectiles/FungiOrb2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/FungiOrb2.png b/Projectiles/FungiOrb2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/FungiOrb2.png differ diff --git a/Projectiles/GalacticaComet.cs b/Projectiles/GalacticaComet.cs new file mode 100644 index 0000000000..4ea21d88ab --- /dev/null +++ b/Projectiles/GalacticaComet.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GalacticaComet.png b/Projectiles/GalacticaComet.png new file mode 100644 index 0000000000..a48c0a7b7a Binary files /dev/null and b/Projectiles/GalacticaComet.png differ diff --git a/Projectiles/Galaxia.cs b/Projectiles/Galaxia.cs new file mode 100644 index 0000000000..16f05ff595 --- /dev/null +++ b/Projectiles/Galaxia.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Galaxia.png b/Projectiles/Galaxia.png new file mode 100644 index 0000000000..bcd3ed059d Binary files /dev/null and b/Projectiles/Galaxia.png differ diff --git a/Projectiles/Galaxia2.cs b/Projectiles/Galaxia2.cs new file mode 100644 index 0000000000..b34c2e2486 --- /dev/null +++ b/Projectiles/Galaxia2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Galaxia2.png b/Projectiles/Galaxia2.png new file mode 100644 index 0000000000..bcd3ed059d Binary files /dev/null and b/Projectiles/Galaxia2.png differ diff --git a/Projectiles/GalaxyBlast.cs b/Projectiles/GalaxyBlast.cs new file mode 100644 index 0000000000..6d114375f9 --- /dev/null +++ b/Projectiles/GalaxyBlast.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GalaxyBlast.png b/Projectiles/GalaxyBlast.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/GalaxyBlast.png differ diff --git a/Projectiles/GalaxyBlastType2.cs b/Projectiles/GalaxyBlastType2.cs new file mode 100644 index 0000000000..5a9c180c08 --- /dev/null +++ b/Projectiles/GalaxyBlastType2.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GalaxyBlastType2.png b/Projectiles/GalaxyBlastType2.png new file mode 100644 index 0000000000..2c535decee Binary files /dev/null and b/Projectiles/GalaxyBlastType2.png differ diff --git a/Projectiles/GalaxyBlastType3.cs b/Projectiles/GalaxyBlastType3.cs new file mode 100644 index 0000000000..6733952248 --- /dev/null +++ b/Projectiles/GalaxyBlastType3.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GalaxyBlastType3.png b/Projectiles/GalaxyBlastType3.png new file mode 100644 index 0000000000..5188920caa Binary files /dev/null and b/Projectiles/GalaxyBlastType3.png differ diff --git a/Projectiles/GammaLaser.cs b/Projectiles/GammaLaser.cs new file mode 100644 index 0000000000..84bce7f787 --- /dev/null +++ b/Projectiles/GammaLaser.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/GammaLaser.png b/Projectiles/GammaLaser.png new file mode 100644 index 0000000000..5fe7b19ed5 Binary files /dev/null and b/Projectiles/GammaLaser.png differ diff --git a/Projectiles/GelDartProjectile.cs b/Projectiles/GelDartProjectile.cs new file mode 100644 index 0000000000..4f38d2f0cb --- /dev/null +++ b/Projectiles/GelDartProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GelDartProjectile.png b/Projectiles/GelDartProjectile.png new file mode 100644 index 0000000000..a584390e21 Binary files /dev/null and b/Projectiles/GelDartProjectile.png differ diff --git a/Projectiles/GelWave.cs b/Projectiles/GelWave.cs new file mode 100644 index 0000000000..1254c883fe --- /dev/null +++ b/Projectiles/GelWave.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GelWave.png b/Projectiles/GelWave.png new file mode 100644 index 0000000000..4a03892650 Binary files /dev/null and b/Projectiles/GelWave.png differ diff --git a/Projectiles/GhastlyBlast.cs b/Projectiles/GhastlyBlast.cs new file mode 100644 index 0000000000..7f2280eb71 --- /dev/null +++ b/Projectiles/GhastlyBlast.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlyBlast.png b/Projectiles/GhastlyBlast.png new file mode 100644 index 0000000000..d7cc25eaa5 Binary files /dev/null and b/Projectiles/GhastlyBlast.png differ diff --git a/Projectiles/GhastlyExplosion.cs b/Projectiles/GhastlyExplosion.cs new file mode 100644 index 0000000000..f5ea1c3906 --- /dev/null +++ b/Projectiles/GhastlyExplosion.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlyExplosion.png b/Projectiles/GhastlyExplosion.png new file mode 100644 index 0000000000..0d9b842a7f Binary files /dev/null and b/Projectiles/GhastlyExplosion.png differ diff --git a/Projectiles/GhastlyExplosionShard.cs b/Projectiles/GhastlyExplosionShard.cs new file mode 100644 index 0000000000..95527e1cb2 --- /dev/null +++ b/Projectiles/GhastlyExplosionShard.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GhastlyExplosionShard.png b/Projectiles/GhastlyExplosionShard.png new file mode 100644 index 0000000000..0d9b842a7f Binary files /dev/null and b/Projectiles/GhastlyExplosionShard.png differ diff --git a/Projectiles/GhastlySoulLarge.cs b/Projectiles/GhastlySoulLarge.cs new file mode 100644 index 0000000000..303d29b1ca --- /dev/null +++ b/Projectiles/GhastlySoulLarge.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlySoulLarge.png b/Projectiles/GhastlySoulLarge.png new file mode 100644 index 0000000000..417c094b01 Binary files /dev/null and b/Projectiles/GhastlySoulLarge.png differ diff --git a/Projectiles/GhastlySoulMedium.cs b/Projectiles/GhastlySoulMedium.cs new file mode 100644 index 0000000000..2c1da7f158 --- /dev/null +++ b/Projectiles/GhastlySoulMedium.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlySoulMedium.png b/Projectiles/GhastlySoulMedium.png new file mode 100644 index 0000000000..f9a5111949 Binary files /dev/null and b/Projectiles/GhastlySoulMedium.png differ diff --git a/Projectiles/GhastlySoulSmall.cs b/Projectiles/GhastlySoulSmall.cs new file mode 100644 index 0000000000..00b10c69b6 --- /dev/null +++ b/Projectiles/GhastlySoulSmall.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlySoulSmall.png b/Projectiles/GhastlySoulSmall.png new file mode 100644 index 0000000000..96f62a52d5 Binary files /dev/null and b/Projectiles/GhastlySoulSmall.png differ diff --git a/Projectiles/GhastlySubBlast.cs b/Projectiles/GhastlySubBlast.cs new file mode 100644 index 0000000000..0837c0c773 --- /dev/null +++ b/Projectiles/GhastlySubBlast.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GhastlySubBlast.png b/Projectiles/GhastlySubBlast.png new file mode 100644 index 0000000000..2998a31989 Binary files /dev/null and b/Projectiles/GhastlySubBlast.png differ diff --git a/Projectiles/GhastlyVisage.cs b/Projectiles/GhastlyVisage.cs new file mode 100644 index 0000000000..4cd7a50b9c --- /dev/null +++ b/Projectiles/GhastlyVisage.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/GhastlyVisage.png b/Projectiles/GhastlyVisage.png new file mode 100644 index 0000000000..ae934f4ae9 Binary files /dev/null and b/Projectiles/GhastlyVisage.png differ diff --git a/Projectiles/GhostFire.cs b/Projectiles/GhostFire.cs new file mode 100644 index 0000000000..cd92029e7e --- /dev/null +++ b/Projectiles/GhostFire.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GhostFire.png b/Projectiles/GhostFire.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/GhostFire.png differ diff --git a/Projectiles/GhostlyBolt.cs b/Projectiles/GhostlyBolt.cs new file mode 100644 index 0000000000..d65a804763 --- /dev/null +++ b/Projectiles/GhostlyBolt.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GhostlyBolt.png b/Projectiles/GhostlyBolt.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/GhostlyBolt.png differ diff --git a/Projectiles/GhostlyMine.cs b/Projectiles/GhostlyMine.cs new file mode 100644 index 0000000000..7d780a2c39 --- /dev/null +++ b/Projectiles/GhostlyMine.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GhostlyMine.png b/Projectiles/GhostlyMine.png new file mode 100644 index 0000000000..aaf6477611 Binary files /dev/null and b/Projectiles/GhostlyMine.png differ diff --git a/Projectiles/GhoulishGouger.cs b/Projectiles/GhoulishGouger.cs new file mode 100644 index 0000000000..cb9a77292c --- /dev/null +++ b/Projectiles/GhoulishGouger.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GhoulishGouger.png b/Projectiles/GhoulishGouger.png new file mode 100644 index 0000000000..409d9d01df Binary files /dev/null and b/Projectiles/GhoulishGouger.png differ diff --git a/Projectiles/GigaFlareFriendly.cs b/Projectiles/GigaFlareFriendly.cs new file mode 100644 index 0000000000..5ad0e8d610 --- /dev/null +++ b/Projectiles/GigaFlareFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GigaFlareFriendly.png b/Projectiles/GigaFlareFriendly.png new file mode 100644 index 0000000000..01e2bd24ca Binary files /dev/null and b/Projectiles/GigaFlareFriendly.png differ diff --git a/Projectiles/GildedProboscis.cs b/Projectiles/GildedProboscis.cs new file mode 100644 index 0000000000..0dcc430b08 --- /dev/null +++ b/Projectiles/GildedProboscis.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GildedProboscis.png b/Projectiles/GildedProboscis.png new file mode 100644 index 0000000000..9e150e8847 Binary files /dev/null and b/Projectiles/GildedProboscis.png differ diff --git a/Projectiles/GleamingBolt.cs b/Projectiles/GleamingBolt.cs new file mode 100644 index 0000000000..01250f45e8 --- /dev/null +++ b/Projectiles/GleamingBolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GleamingBolt.png b/Projectiles/GleamingBolt.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/GleamingBolt.png differ diff --git a/Projectiles/GleamingBolt2.cs b/Projectiles/GleamingBolt2.cs new file mode 100644 index 0000000000..cd7a6cada4 --- /dev/null +++ b/Projectiles/GleamingBolt2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GleamingBolt2.png b/Projectiles/GleamingBolt2.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/GleamingBolt2.png differ diff --git a/Projectiles/GodKiller.cs b/Projectiles/GodKiller.cs new file mode 100644 index 0000000000..e6ebf32e68 --- /dev/null +++ b/Projectiles/GodKiller.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GodKiller.png b/Projectiles/GodKiller.png new file mode 100644 index 0000000000..c7ac65692e Binary files /dev/null and b/Projectiles/GodKiller.png differ diff --git a/Projectiles/GodSlayerBlaze.cs b/Projectiles/GodSlayerBlaze.cs new file mode 100644 index 0000000000..524f502fc3 --- /dev/null +++ b/Projectiles/GodSlayerBlaze.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GodSlayerBlaze.png b/Projectiles/GodSlayerBlaze.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/GodSlayerBlaze.png differ diff --git a/Projectiles/GodSlayerHealOrb.cs b/Projectiles/GodSlayerHealOrb.cs new file mode 100644 index 0000000000..7ffb40a49e --- /dev/null +++ b/Projectiles/GodSlayerHealOrb.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GodSlayerHealOrb.png b/Projectiles/GodSlayerHealOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/GodSlayerHealOrb.png differ diff --git a/Projectiles/GodSlayerOrb.cs b/Projectiles/GodSlayerOrb.cs new file mode 100644 index 0000000000..18a956daf8 --- /dev/null +++ b/Projectiles/GodSlayerOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GodSlayerOrb.png b/Projectiles/GodSlayerOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/GodSlayerOrb.png differ diff --git a/Projectiles/GodSlayerPhantom.cs b/Projectiles/GodSlayerPhantom.cs new file mode 100644 index 0000000000..0a9bd5d2b6 --- /dev/null +++ b/Projectiles/GodSlayerPhantom.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/GodSlayerPhantom.png b/Projectiles/GodSlayerPhantom.png new file mode 100644 index 0000000000..80914fd387 Binary files /dev/null and b/Projectiles/GodSlayerPhantom.png differ diff --git a/Projectiles/GodSlayerShrapnel.cs b/Projectiles/GodSlayerShrapnel.cs new file mode 100644 index 0000000000..a31ece90af --- /dev/null +++ b/Projectiles/GodSlayerShrapnel.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/GodSlayerShrapnel.png b/Projectiles/GodSlayerShrapnel.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/GodSlayerShrapnel.png differ diff --git a/Projectiles/GodSlayerShrapnelRound.cs b/Projectiles/GodSlayerShrapnelRound.cs new file mode 100644 index 0000000000..43957b3e0d --- /dev/null +++ b/Projectiles/GodSlayerShrapnelRound.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GodSlayerShrapnelRound.png b/Projectiles/GodSlayerShrapnelRound.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/GodSlayerShrapnelRound.png differ diff --git a/Projectiles/GoldenGun.cs b/Projectiles/GoldenGun.cs new file mode 100644 index 0000000000..0da6351f67 --- /dev/null +++ b/Projectiles/GoldenGun.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GoldenGun.png b/Projectiles/GoldenGun.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/GoldenGun.png differ diff --git a/Projectiles/GoldplumeSpearProjectile.cs b/Projectiles/GoldplumeSpearProjectile.cs new file mode 100644 index 0000000000..fbc164d0dd --- /dev/null +++ b/Projectiles/GoldplumeSpearProjectile.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GoldplumeSpearProjectile.png b/Projectiles/GoldplumeSpearProjectile.png new file mode 100644 index 0000000000..3f4b6d5601 Binary files /dev/null and b/Projectiles/GoldplumeSpearProjectile.png differ diff --git a/Projectiles/GoliathExplosion.cs b/Projectiles/GoliathExplosion.cs new file mode 100644 index 0000000000..5756279720 --- /dev/null +++ b/Projectiles/GoliathExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/GoliathExplosion.png b/Projectiles/GoliathExplosion.png new file mode 100644 index 0000000000..73557dc730 Binary files /dev/null and b/Projectiles/GoliathExplosion.png differ diff --git a/Projectiles/GoliathRocket.cs b/Projectiles/GoliathRocket.cs new file mode 100644 index 0000000000..21ce0a0bc6 --- /dev/null +++ b/Projectiles/GoliathRocket.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GoliathRocket.png b/Projectiles/GoliathRocket.png new file mode 100644 index 0000000000..8e6f7e2d10 Binary files /dev/null and b/Projectiles/GoliathRocket.png differ diff --git a/Projectiles/GraniteEnergy.cs b/Projectiles/GraniteEnergy.cs new file mode 100644 index 0000000000..69a8a31088 --- /dev/null +++ b/Projectiles/GraniteEnergy.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GraniteEnergy.png b/Projectiles/GraniteEnergy.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/GraniteEnergy.png differ diff --git a/Projectiles/GranitePulse.cs b/Projectiles/GranitePulse.cs new file mode 100644 index 0000000000..066143fc02 --- /dev/null +++ b/Projectiles/GranitePulse.cs @@ -0,0 +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); + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GranitePulse.png b/Projectiles/GranitePulse.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/GranitePulse.png differ diff --git a/Projectiles/GraySpawn.cs b/Projectiles/GraySpawn.cs new file mode 100644 index 0000000000..b19cd1eb7d --- /dev/null +++ b/Projectiles/GraySpawn.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GraySpawn.png b/Projectiles/GraySpawn.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/GraySpawn.png differ diff --git a/Projectiles/GreenBall.cs b/Projectiles/GreenBall.cs new file mode 100644 index 0000000000..71adfd2ae6 --- /dev/null +++ b/Projectiles/GreenBall.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 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/GreenBall.png b/Projectiles/GreenBall.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/GreenBall.png differ diff --git a/Projectiles/GreenDust.cs b/Projectiles/GreenDust.cs new file mode 100644 index 0000000000..0cfe956c6f --- /dev/null +++ b/Projectiles/GreenDust.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/GreenDust.png b/Projectiles/GreenDust.png new file mode 100644 index 0000000000..426b5e7251 Binary files /dev/null and b/Projectiles/GreenDust.png differ diff --git a/Projectiles/GreenExoArrow.cs b/Projectiles/GreenExoArrow.cs new file mode 100644 index 0000000000..f2a8b92e21 --- /dev/null +++ b/Projectiles/GreenExoArrow.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/GreenExoArrow.png b/Projectiles/GreenExoArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/GreenExoArrow.png differ diff --git a/Projectiles/GreenWater.cs b/Projectiles/GreenWater.cs new file mode 100644 index 0000000000..362c71872c --- /dev/null +++ b/Projectiles/GreenWater.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/GreenWater.png b/Projectiles/GreenWater.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/GreenWater.png differ diff --git a/Projectiles/HealOrbProv.cs b/Projectiles/HealOrbProv.cs new file mode 100644 index 0000000000..6ce3945098 --- /dev/null +++ b/Projectiles/HealOrbProv.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/HealOrbProv.png b/Projectiles/HealOrbProv.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/HealOrbProv.png differ diff --git a/Projectiles/HeartRapierProjectile.cs b/Projectiles/HeartRapierProjectile.cs new file mode 100644 index 0000000000..0c400bbac3 --- /dev/null +++ b/Projectiles/HeartRapierProjectile.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 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/HeartRapierProjectile.png b/Projectiles/HeartRapierProjectile.png new file mode 100644 index 0000000000..d7636bfa9a Binary files /dev/null and b/Projectiles/HeartRapierProjectile.png differ diff --git a/Projectiles/HellfireExplosion.cs b/Projectiles/HellfireExplosion.cs new file mode 100644 index 0000000000..e98461edca --- /dev/null +++ b/Projectiles/HellfireExplosion.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HellfireExplosion.png b/Projectiles/HellfireExplosion.png new file mode 100644 index 0000000000..68fb6e2672 Binary files /dev/null and b/Projectiles/HellfireExplosion.png differ diff --git a/Projectiles/HellfireExplosionFriendly.cs b/Projectiles/HellfireExplosionFriendly.cs new file mode 100644 index 0000000000..b1407d3ac1 --- /dev/null +++ b/Projectiles/HellfireExplosionFriendly.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/HellfireExplosionFriendly.png b/Projectiles/HellfireExplosionFriendly.png new file mode 100644 index 0000000000..59d45407ff Binary files /dev/null and b/Projectiles/HellfireExplosionFriendly.png differ diff --git a/Projectiles/HellfireExplosionFriendly2.cs b/Projectiles/HellfireExplosionFriendly2.cs new file mode 100644 index 0000000000..bc045bf77e --- /dev/null +++ b/Projectiles/HellfireExplosionFriendly2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HellfireExplosionFriendly2.png b/Projectiles/HellfireExplosionFriendly2.png new file mode 100644 index 0000000000..59d45407ff Binary files /dev/null and b/Projectiles/HellfireExplosionFriendly2.png differ diff --git a/Projectiles/HellionFlowerSpearProjectile.cs b/Projectiles/HellionFlowerSpearProjectile.cs new file mode 100644 index 0000000000..77f0d7f68d --- /dev/null +++ b/Projectiles/HellionFlowerSpearProjectile.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 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/HellionFlowerSpearProjectile.png b/Projectiles/HellionFlowerSpearProjectile.png new file mode 100644 index 0000000000..33568791c1 Binary files /dev/null and b/Projectiles/HellionFlowerSpearProjectile.png differ diff --git a/Projectiles/HellionSpike.cs b/Projectiles/HellionSpike.cs new file mode 100644 index 0000000000..bfb9b06199 --- /dev/null +++ b/Projectiles/HellionSpike.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HellionSpike.png b/Projectiles/HellionSpike.png new file mode 100644 index 0000000000..4b9841637b Binary files /dev/null and b/Projectiles/HellionSpike.png differ diff --git a/Projectiles/Herring.cs b/Projectiles/Herring.cs new file mode 100644 index 0000000000..d032ef42a8 --- /dev/null +++ b/Projectiles/Herring.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Herring.png b/Projectiles/Herring.png new file mode 100644 index 0000000000..9d384c9345 Binary files /dev/null and b/Projectiles/Herring.png differ diff --git a/Projectiles/HiveBomb.cs b/Projectiles/HiveBomb.cs new file mode 100644 index 0000000000..9153b96954 --- /dev/null +++ b/Projectiles/HiveBomb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HiveBomb.png b/Projectiles/HiveBomb.png new file mode 100644 index 0000000000..9c917f299e Binary files /dev/null and b/Projectiles/HiveBomb.png differ diff --git a/Projectiles/HiveBombExplosion.cs b/Projectiles/HiveBombExplosion.cs new file mode 100644 index 0000000000..1578a0142c --- /dev/null +++ b/Projectiles/HiveBombExplosion.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HiveBombExplosion.png b/Projectiles/HiveBombExplosion.png new file mode 100644 index 0000000000..80da916522 Binary files /dev/null and b/Projectiles/HiveBombExplosion.png differ diff --git a/Projectiles/HiveBombExplosionHostile.cs b/Projectiles/HiveBombExplosionHostile.cs new file mode 100644 index 0000000000..d6faeeec00 --- /dev/null +++ b/Projectiles/HiveBombExplosionHostile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HiveBombExplosionHostile.png b/Projectiles/HiveBombExplosionHostile.png new file mode 100644 index 0000000000..03ece3122b Binary files /dev/null and b/Projectiles/HiveBombExplosionHostile.png differ diff --git a/Projectiles/HiveExplosion.cs b/Projectiles/HiveExplosion.cs new file mode 100644 index 0000000000..6d683a0cfb --- /dev/null +++ b/Projectiles/HiveExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/HiveExplosion.png b/Projectiles/HiveExplosion.png new file mode 100644 index 0000000000..7962bdc787 Binary files /dev/null and b/Projectiles/HiveExplosion.png differ diff --git a/Projectiles/HiveMissile.cs b/Projectiles/HiveMissile.cs new file mode 100644 index 0000000000..aa0333c784 --- /dev/null +++ b/Projectiles/HiveMissile.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/HiveMissile.png b/Projectiles/HiveMissile.png new file mode 100644 index 0000000000..ced7686d06 Binary files /dev/null and b/Projectiles/HiveMissile.png differ diff --git a/Projectiles/HolyEruption.cs b/Projectiles/HolyEruption.cs new file mode 100644 index 0000000000..a8b713897e --- /dev/null +++ b/Projectiles/HolyEruption.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyEruption.png b/Projectiles/HolyEruption.png new file mode 100644 index 0000000000..dd0a1e7735 Binary files /dev/null and b/Projectiles/HolyEruption.png differ diff --git a/Projectiles/HolyExplosion.cs b/Projectiles/HolyExplosion.cs new file mode 100644 index 0000000000..dd15acbbf9 --- /dev/null +++ b/Projectiles/HolyExplosion.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyExplosion.png b/Projectiles/HolyExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/HolyExplosion.png differ diff --git a/Projectiles/HolyExplosionSupreme.cs b/Projectiles/HolyExplosionSupreme.cs new file mode 100644 index 0000000000..a0a9f0742a --- /dev/null +++ b/Projectiles/HolyExplosionSupreme.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyExplosionSupreme.png b/Projectiles/HolyExplosionSupreme.png new file mode 100644 index 0000000000..80da916522 Binary files /dev/null and b/Projectiles/HolyExplosionSupreme.png differ diff --git a/Projectiles/HolyFireBullet.cs b/Projectiles/HolyFireBullet.cs new file mode 100644 index 0000000000..c8179d1d56 --- /dev/null +++ b/Projectiles/HolyFireBullet.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyFireBullet.png b/Projectiles/HolyFireBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/HolyFireBullet.png differ diff --git a/Projectiles/HolyFlame.cs b/Projectiles/HolyFlame.cs new file mode 100644 index 0000000000..832151fdbf --- /dev/null +++ b/Projectiles/HolyFlame.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyFlame.png b/Projectiles/HolyFlame.png new file mode 100644 index 0000000000..dc3dcb69a3 Binary files /dev/null and b/Projectiles/HolyFlame.png differ diff --git a/Projectiles/HolyFlameBomb.cs b/Projectiles/HolyFlameBomb.cs new file mode 100644 index 0000000000..641a79d3bb --- /dev/null +++ b/Projectiles/HolyFlameBomb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyFlameBomb.png b/Projectiles/HolyFlameBomb.png new file mode 100644 index 0000000000..385e7d67b1 Binary files /dev/null and b/Projectiles/HolyFlameBomb.png differ diff --git a/Projectiles/HolyLaser.cs b/Projectiles/HolyLaser.cs new file mode 100644 index 0000000000..46016b3efd --- /dev/null +++ b/Projectiles/HolyLaser.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/HolyLaser.png b/Projectiles/HolyLaser.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/HolyLaser.png differ diff --git a/Projectiles/HorsWaterBlast.cs b/Projectiles/HorsWaterBlast.cs new file mode 100644 index 0000000000..5295466de8 --- /dev/null +++ b/Projectiles/HorsWaterBlast.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HorsWaterBlast.png b/Projectiles/HorsWaterBlast.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/HorsWaterBlast.png differ diff --git a/Projectiles/HyperBlade.cs b/Projectiles/HyperBlade.cs new file mode 100644 index 0000000000..a5373d1e39 --- /dev/null +++ b/Projectiles/HyperBlade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/HyperBlade.png b/Projectiles/HyperBlade.png new file mode 100644 index 0000000000..bc530bb268 Binary files /dev/null and b/Projectiles/HyperBlade.png differ diff --git a/Projectiles/HyperiusBullet.cs b/Projectiles/HyperiusBullet.cs new file mode 100644 index 0000000000..6805283c47 --- /dev/null +++ b/Projectiles/HyperiusBullet.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/HyperiusBullet.png b/Projectiles/HyperiusBullet.png new file mode 100644 index 0000000000..01c3ee5696 Binary files /dev/null and b/Projectiles/HyperiusBullet.png differ diff --git a/Projectiles/IceBeam.cs b/Projectiles/IceBeam.cs new file mode 100644 index 0000000000..2878d7c2e2 --- /dev/null +++ b/Projectiles/IceBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/IceBeam.png b/Projectiles/IceBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/IceBeam.png differ diff --git a/Projectiles/IceBombFriendly.cs b/Projectiles/IceBombFriendly.cs new file mode 100644 index 0000000000..3a15bbcef8 --- /dev/null +++ b/Projectiles/IceBombFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/IceBombFriendly.png b/Projectiles/IceBombFriendly.png new file mode 100644 index 0000000000..d4bedafb33 Binary files /dev/null and b/Projectiles/IceBombFriendly.png differ diff --git a/Projectiles/IceClasper.cs b/Projectiles/IceClasper.cs new file mode 100644 index 0000000000..87ec53c8ee --- /dev/null +++ b/Projectiles/IceClasper.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/IceClasper.png b/Projectiles/IceClasper.png new file mode 100644 index 0000000000..5d35882b80 Binary files /dev/null and b/Projectiles/IceClasper.png differ diff --git a/Projectiles/IceCluster.cs b/Projectiles/IceCluster.cs new file mode 100644 index 0000000000..eec657efe8 --- /dev/null +++ b/Projectiles/IceCluster.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/IceCluster.png b/Projectiles/IceCluster.png new file mode 100644 index 0000000000..189fa30c3b Binary files /dev/null and b/Projectiles/IceCluster.png differ diff --git a/Projectiles/IceSpike.cs b/Projectiles/IceSpike.cs new file mode 100644 index 0000000000..c9d9ef03ce --- /dev/null +++ b/Projectiles/IceSpike.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/IceSpike.png b/Projectiles/IceSpike.png new file mode 100644 index 0000000000..198f04ee07 Binary files /dev/null and b/Projectiles/IceSpike.png differ diff --git a/Projectiles/IceStarProjectile.cs b/Projectiles/IceStarProjectile.cs new file mode 100644 index 0000000000..4d2ea3b50d --- /dev/null +++ b/Projectiles/IceStarProjectile.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/IceStarProjectile.png b/Projectiles/IceStarProjectile.png new file mode 100644 index 0000000000..ec834cdfa5 Binary files /dev/null and b/Projectiles/IceStarProjectile.png differ diff --git a/Projectiles/Iceberg.cs b/Projectiles/Iceberg.cs new file mode 100644 index 0000000000..85ee31b3d0 --- /dev/null +++ b/Projectiles/Iceberg.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Iceberg.png b/Projectiles/Iceberg.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Iceberg.png differ diff --git a/Projectiles/Icebreaker.cs b/Projectiles/Icebreaker.cs new file mode 100644 index 0000000000..1319c56d8f --- /dev/null +++ b/Projectiles/Icebreaker.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Icebreaker.png b/Projectiles/Icebreaker.png new file mode 100644 index 0000000000..7839c05097 Binary files /dev/null and b/Projectiles/Icebreaker.png differ diff --git a/Projectiles/IchorSpear.cs b/Projectiles/IchorSpear.cs new file mode 100644 index 0000000000..2f81498616 --- /dev/null +++ b/Projectiles/IchorSpear.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/IchorSpear.png b/Projectiles/IchorSpear.png new file mode 100644 index 0000000000..88bb1ebf5b Binary files /dev/null and b/Projectiles/IchorSpear.png differ diff --git a/Projectiles/InfernadoFriendly.cs b/Projectiles/InfernadoFriendly.cs new file mode 100644 index 0000000000..462c177a27 --- /dev/null +++ b/Projectiles/InfernadoFriendly.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/InfernadoFriendly.png b/Projectiles/InfernadoFriendly.png new file mode 100644 index 0000000000..d4d9ea492c Binary files /dev/null and b/Projectiles/InfernadoFriendly.png differ diff --git a/Projectiles/InfernadoMarkFriendly.cs b/Projectiles/InfernadoMarkFriendly.cs new file mode 100644 index 0000000000..190bafb248 --- /dev/null +++ b/Projectiles/InfernadoMarkFriendly.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/InfernadoMarkFriendly.png b/Projectiles/InfernadoMarkFriendly.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/InfernadoMarkFriendly.png differ diff --git a/Projectiles/InfernalBlade.cs b/Projectiles/InfernalBlade.cs new file mode 100644 index 0000000000..7cccbbe456 --- /dev/null +++ b/Projectiles/InfernalBlade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/InfernalBlade.png b/Projectiles/InfernalBlade.png new file mode 100644 index 0000000000..1dd394dfcb Binary files /dev/null and b/Projectiles/InfernalBlade.png differ diff --git a/Projectiles/InfernalBlade2.cs b/Projectiles/InfernalBlade2.cs new file mode 100644 index 0000000000..c0ea07c24d --- /dev/null +++ b/Projectiles/InfernalBlade2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/InfernalBlade2.png b/Projectiles/InfernalBlade2.png new file mode 100644 index 0000000000..1dd394dfcb Binary files /dev/null and b/Projectiles/InfernalBlade2.png differ diff --git a/Projectiles/InkBomb.cs b/Projectiles/InkBomb.cs new file mode 100644 index 0000000000..60b7046549 --- /dev/null +++ b/Projectiles/InkBomb.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/InkBomb.png b/Projectiles/InkBomb.png new file mode 100644 index 0000000000..867707bfc8 Binary files /dev/null and b/Projectiles/InkBomb.png differ diff --git a/Projectiles/InkPoisonCloud.cs b/Projectiles/InkPoisonCloud.cs new file mode 100644 index 0000000000..1d43a92f2f --- /dev/null +++ b/Projectiles/InkPoisonCloud.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 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/InkPoisonCloud.png b/Projectiles/InkPoisonCloud.png new file mode 100644 index 0000000000..284c8f4ec6 Binary files /dev/null and b/Projectiles/InkPoisonCloud.png differ diff --git a/Projectiles/InkPoisonCloud2.cs b/Projectiles/InkPoisonCloud2.cs new file mode 100644 index 0000000000..f9e84b7f21 --- /dev/null +++ b/Projectiles/InkPoisonCloud2.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 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/InkPoisonCloud2.png b/Projectiles/InkPoisonCloud2.png new file mode 100644 index 0000000000..1aa9239041 Binary files /dev/null and b/Projectiles/InkPoisonCloud2.png differ diff --git a/Projectiles/InkPoisonCloud3.cs b/Projectiles/InkPoisonCloud3.cs new file mode 100644 index 0000000000..117c680036 --- /dev/null +++ b/Projectiles/InkPoisonCloud3.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 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/InkPoisonCloud3.png b/Projectiles/InkPoisonCloud3.png new file mode 100644 index 0000000000..97f095777d Binary files /dev/null and b/Projectiles/InkPoisonCloud3.png differ diff --git a/Projectiles/IonBlast.cs b/Projectiles/IonBlast.cs new file mode 100644 index 0000000000..58dffd3a7f --- /dev/null +++ b/Projectiles/IonBlast.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/IonBlast.png b/Projectiles/IonBlast.png new file mode 100644 index 0000000000..8cb57f5357 Binary files /dev/null and b/Projectiles/IonBlast.png differ diff --git a/Projectiles/IonExplosion.cs b/Projectiles/IonExplosion.cs new file mode 100644 index 0000000000..abf49e6006 --- /dev/null +++ b/Projectiles/IonExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/IonExplosion.png b/Projectiles/IonExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/IonExplosion.png differ diff --git a/Projectiles/Judgement.cs b/Projectiles/Judgement.cs new file mode 100644 index 0000000000..d39f9183fd --- /dev/null +++ b/Projectiles/Judgement.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 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/Judgement.png b/Projectiles/Judgement.png new file mode 100644 index 0000000000..e6c2d4b44a Binary files /dev/null and b/Projectiles/Judgement.png differ diff --git a/Projectiles/JudgementBlah.cs b/Projectiles/JudgementBlah.cs new file mode 100644 index 0000000000..f9b77b8497 --- /dev/null +++ b/Projectiles/JudgementBlah.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/JudgementBlah.png b/Projectiles/JudgementBlah.png new file mode 100644 index 0000000000..e6c2d4b44a Binary files /dev/null and b/Projectiles/JudgementBlah.png differ diff --git a/Projectiles/LaceratorProjectile.cs b/Projectiles/LaceratorProjectile.cs new file mode 100644 index 0000000000..8f7230a4f5 --- /dev/null +++ b/Projectiles/LaceratorProjectile.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/LaceratorProjectile.png b/Projectiles/LaceratorProjectile.png new file mode 100644 index 0000000000..29852d4d1b Binary files /dev/null and b/Projectiles/LaceratorProjectile.png differ diff --git a/Projectiles/LaserFountain.cs b/Projectiles/LaserFountain.cs new file mode 100644 index 0000000000..a3b51c551b --- /dev/null +++ b/Projectiles/LaserFountain.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/LaserFountain.png b/Projectiles/LaserFountain.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/LaserFountain.png differ diff --git a/Projectiles/LavaChunk.cs b/Projectiles/LavaChunk.cs new file mode 100644 index 0000000000..c6b1c743cd --- /dev/null +++ b/Projectiles/LavaChunk.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/LavaChunk.png b/Projectiles/LavaChunk.png new file mode 100644 index 0000000000..0a9cef86c1 Binary files /dev/null and b/Projectiles/LavaChunk.png differ diff --git a/Projectiles/LeafArrow.cs b/Projectiles/LeafArrow.cs new file mode 100644 index 0000000000..93a5616cfb --- /dev/null +++ b/Projectiles/LeafArrow.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/LeafArrow.png b/Projectiles/LeafArrow.png new file mode 100644 index 0000000000..5079a4a710 Binary files /dev/null and b/Projectiles/LeafArrow.png differ diff --git a/Projectiles/Leech.cs b/Projectiles/Leech.cs new file mode 100644 index 0000000000..93dc77d4f8 --- /dev/null +++ b/Projectiles/Leech.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Leech.png b/Projectiles/Leech.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Leech.png differ diff --git a/Projectiles/Levi.cs b/Projectiles/Levi.cs new file mode 100644 index 0000000000..be2a98a413 --- /dev/null +++ b/Projectiles/Levi.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Levi.png b/Projectiles/Levi.png new file mode 100644 index 0000000000..9142f70f94 Binary files /dev/null and b/Projectiles/Levi.png differ diff --git a/Projectiles/LifeScythe.cs b/Projectiles/LifeScythe.cs new file mode 100644 index 0000000000..dbd34ca3f4 --- /dev/null +++ b/Projectiles/LifeScythe.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/LifeScythe.png b/Projectiles/LifeScythe.png new file mode 100644 index 0000000000..d39023aebd Binary files /dev/null and b/Projectiles/LifeScythe.png differ diff --git a/Projectiles/Light.cs b/Projectiles/Light.cs new file mode 100644 index 0000000000..6e1130dcb2 --- /dev/null +++ b/Projectiles/Light.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Light.png b/Projectiles/Light.png new file mode 100644 index 0000000000..90c73a1903 Binary files /dev/null and b/Projectiles/Light.png differ diff --git a/Projectiles/Lionfish.cs b/Projectiles/Lionfish.cs new file mode 100644 index 0000000000..beca31fd89 --- /dev/null +++ b/Projectiles/Lionfish.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Lionfish.png b/Projectiles/Lionfish.png new file mode 100644 index 0000000000..56025eca70 Binary files /dev/null and b/Projectiles/Lionfish.png differ diff --git a/Projectiles/LiquidBlade.cs b/Projectiles/LiquidBlade.cs new file mode 100644 index 0000000000..3d342a07b7 --- /dev/null +++ b/Projectiles/LiquidBlade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/LiquidBlade.png b/Projectiles/LiquidBlade.png new file mode 100644 index 0000000000..1dd394dfcb Binary files /dev/null and b/Projectiles/LiquidBlade.png differ diff --git a/Projectiles/LiquidBlade2.cs b/Projectiles/LiquidBlade2.cs new file mode 100644 index 0000000000..b62ab2d420 --- /dev/null +++ b/Projectiles/LiquidBlade2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/LiquidBlade2.png b/Projectiles/LiquidBlade2.png new file mode 100644 index 0000000000..c216615a26 Binary files /dev/null and b/Projectiles/LiquidBlade2.png differ diff --git a/Projectiles/LunarBolt.cs b/Projectiles/LunarBolt.cs new file mode 100644 index 0000000000..c3ae4abd1a --- /dev/null +++ b/Projectiles/LunarBolt.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/LunarBolt.png b/Projectiles/LunarBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/LunarBolt.png differ diff --git a/Projectiles/LunarBolt2.cs b/Projectiles/LunarBolt2.cs new file mode 100644 index 0000000000..e368ddc10f --- /dev/null +++ b/Projectiles/LunarBolt2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/LunarBolt2.png b/Projectiles/LunarBolt2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/LunarBolt2.png differ diff --git a/Projectiles/LunicBeam.cs b/Projectiles/LunicBeam.cs new file mode 100644 index 0000000000..f9f0422340 --- /dev/null +++ b/Projectiles/LunicBeam.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/LunicBeam.png b/Projectiles/LunicBeam.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/LunicBeam.png differ diff --git a/Projectiles/MageHammerBoom.cs b/Projectiles/MageHammerBoom.cs new file mode 100644 index 0000000000..6eef7e1886 --- /dev/null +++ b/Projectiles/MageHammerBoom.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MageHammerBoom.png b/Projectiles/MageHammerBoom.png new file mode 100644 index 0000000000..a727d47235 Binary files /dev/null and b/Projectiles/MageHammerBoom.png differ diff --git a/Projectiles/MagnaBlast.cs b/Projectiles/MagnaBlast.cs new file mode 100644 index 0000000000..eb10de0187 --- /dev/null +++ b/Projectiles/MagnaBlast.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +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/MagnaBlast.png b/Projectiles/MagnaBlast.png new file mode 100644 index 0000000000..4a5f92eb8f Binary files /dev/null and b/Projectiles/MagnaBlast.png differ diff --git a/Projectiles/MagnaStrike.cs b/Projectiles/MagnaStrike.cs new file mode 100644 index 0000000000..82372550d7 --- /dev/null +++ b/Projectiles/MagnaStrike.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MagnaStrike.png b/Projectiles/MagnaStrike.png new file mode 100644 index 0000000000..4a8591fafa Binary files /dev/null and b/Projectiles/MagnaStrike.png differ diff --git a/Projectiles/MagneticBeam.cs b/Projectiles/MagneticBeam.cs new file mode 100644 index 0000000000..57b0d35c41 --- /dev/null +++ b/Projectiles/MagneticBeam.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MagneticBeam.png b/Projectiles/MagneticBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/MagneticBeam.png differ diff --git a/Projectiles/MagneticOrb.cs b/Projectiles/MagneticOrb.cs new file mode 100644 index 0000000000..53d172eea9 --- /dev/null +++ b/Projectiles/MagneticOrb.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MagneticOrb.png b/Projectiles/MagneticOrb.png new file mode 100644 index 0000000000..526f873f90 Binary files /dev/null and b/Projectiles/MagneticOrb.png differ diff --git a/Projectiles/Malachite.cs b/Projectiles/Malachite.cs new file mode 100644 index 0000000000..7abdd714f6 --- /dev/null +++ b/Projectiles/Malachite.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Malachite.png b/Projectiles/Malachite.png new file mode 100644 index 0000000000..fcd0137dba Binary files /dev/null and b/Projectiles/Malachite.png differ diff --git a/Projectiles/MalachiteBolt.cs b/Projectiles/MalachiteBolt.cs new file mode 100644 index 0000000000..962457ae5c --- /dev/null +++ b/Projectiles/MalachiteBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MalachiteBolt.png b/Projectiles/MalachiteBolt.png new file mode 100644 index 0000000000..fcd0137dba Binary files /dev/null and b/Projectiles/MalachiteBolt.png differ diff --git a/Projectiles/ManaBolt.cs b/Projectiles/ManaBolt.cs new file mode 100644 index 0000000000..d80ce61522 --- /dev/null +++ b/Projectiles/ManaBolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ManaBolt.png b/Projectiles/ManaBolt.png new file mode 100644 index 0000000000..5188920caa Binary files /dev/null and b/Projectiles/ManaBolt.png differ diff --git a/Projectiles/ManaBoltSmall.cs b/Projectiles/ManaBoltSmall.cs new file mode 100644 index 0000000000..f03e2e6cbd --- /dev/null +++ b/Projectiles/ManaBoltSmall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ManaBoltSmall.png b/Projectiles/ManaBoltSmall.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/ManaBoltSmall.png differ diff --git a/Projectiles/ManaBoltSmall2.cs b/Projectiles/ManaBoltSmall2.cs new file mode 100644 index 0000000000..a51b78697a --- /dev/null +++ b/Projectiles/ManaBoltSmall2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ManaBoltSmall2.png b/Projectiles/ManaBoltSmall2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/ManaBoltSmall2.png differ diff --git a/Projectiles/MangroveChakramProjectile.cs b/Projectiles/MangroveChakramProjectile.cs new file mode 100644 index 0000000000..fef5097763 --- /dev/null +++ b/Projectiles/MangroveChakramProjectile.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 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/MangroveChakramProjectile.png b/Projectiles/MangroveChakramProjectile.png new file mode 100644 index 0000000000..aad8e4a516 Binary files /dev/null and b/Projectiles/MangroveChakramProjectile.png differ diff --git a/Projectiles/MangroveChakramProjectileMelee.cs b/Projectiles/MangroveChakramProjectileMelee.cs new file mode 100644 index 0000000000..7b077859a9 --- /dev/null +++ b/Projectiles/MangroveChakramProjectileMelee.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 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/MangroveChakramProjectileMelee.png b/Projectiles/MangroveChakramProjectileMelee.png new file mode 100644 index 0000000000..aad8e4a516 Binary files /dev/null and b/Projectiles/MangroveChakramProjectileMelee.png differ diff --git a/Projectiles/MarianaProjectile.cs b/Projectiles/MarianaProjectile.cs new file mode 100644 index 0000000000..19911fbd3d --- /dev/null +++ b/Projectiles/MarianaProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MarianaProjectile.png b/Projectiles/MarianaProjectile.png new file mode 100644 index 0000000000..405f97fc61 Binary files /dev/null and b/Projectiles/MarianaProjectile.png differ diff --git a/Projectiles/MarkRound.cs b/Projectiles/MarkRound.cs new file mode 100644 index 0000000000..0d8c6d874d --- /dev/null +++ b/Projectiles/MarkRound.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MarkRound.png b/Projectiles/MarkRound.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/MarkRound.png differ diff --git a/Projectiles/MarniteObliterator.cs b/Projectiles/MarniteObliterator.cs new file mode 100644 index 0000000000..39dbfdd646 --- /dev/null +++ b/Projectiles/MarniteObliterator.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MarniteObliterator.png b/Projectiles/MarniteObliterator.png new file mode 100644 index 0000000000..22e8aaea42 Binary files /dev/null and b/Projectiles/MarniteObliterator.png differ diff --git a/Projectiles/MarniteSpearProjectile.cs b/Projectiles/MarniteSpearProjectile.cs new file mode 100644 index 0000000000..6fa1d7b5b9 --- /dev/null +++ b/Projectiles/MarniteSpearProjectile.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MarniteSpearProjectile.png b/Projectiles/MarniteSpearProjectile.png new file mode 100644 index 0000000000..09e6477e7c Binary files /dev/null and b/Projectiles/MarniteSpearProjectile.png differ diff --git a/Projectiles/MechanicalBarracuda.cs b/Projectiles/MechanicalBarracuda.cs new file mode 100644 index 0000000000..13c78589d5 --- /dev/null +++ b/Projectiles/MechanicalBarracuda.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MechanicalBarracuda.png b/Projectiles/MechanicalBarracuda.png new file mode 100644 index 0000000000..a08bcffa93 Binary files /dev/null and b/Projectiles/MechanicalBarracuda.png differ diff --git a/Projectiles/MechwormBody.cs b/Projectiles/MechwormBody.cs new file mode 100644 index 0000000000..4d48218c0c --- /dev/null +++ b/Projectiles/MechwormBody.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MechwormBody.png b/Projectiles/MechwormBody.png new file mode 100644 index 0000000000..eee4c5f9dc Binary files /dev/null and b/Projectiles/MechwormBody.png differ diff --git a/Projectiles/MechwormBody2.cs b/Projectiles/MechwormBody2.cs new file mode 100644 index 0000000000..84cc305fba --- /dev/null +++ b/Projectiles/MechwormBody2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MechwormBody2.png b/Projectiles/MechwormBody2.png new file mode 100644 index 0000000000..eee4c5f9dc Binary files /dev/null and b/Projectiles/MechwormBody2.png differ diff --git a/Projectiles/MechwormHead.cs b/Projectiles/MechwormHead.cs new file mode 100644 index 0000000000..744e7fc6b2 --- /dev/null +++ b/Projectiles/MechwormHead.cs @@ -0,0 +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; + } + } +} diff --git a/Projectiles/MechwormHead.png b/Projectiles/MechwormHead.png new file mode 100644 index 0000000000..42dd2e2402 Binary files /dev/null and b/Projectiles/MechwormHead.png differ diff --git a/Projectiles/MechwormTail.cs b/Projectiles/MechwormTail.cs new file mode 100644 index 0000000000..586e18543c --- /dev/null +++ b/Projectiles/MechwormTail.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MechwormTail.png b/Projectiles/MechwormTail.png new file mode 100644 index 0000000000..678fe7867a Binary files /dev/null and b/Projectiles/MechwormTail.png differ diff --git a/Projectiles/MeowFire.cs b/Projectiles/MeowFire.cs new file mode 100644 index 0000000000..d13888f510 --- /dev/null +++ b/Projectiles/MeowFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MeowFire.png b/Projectiles/MeowFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/MeowFire.png differ diff --git a/Projectiles/MeowFire2.cs b/Projectiles/MeowFire2.cs new file mode 100644 index 0000000000..61f7d7e62c --- /dev/null +++ b/Projectiles/MeowFire2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MeowFire2.png b/Projectiles/MeowFire2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/MeowFire2.png differ diff --git a/Projectiles/MeteorFist.cs b/Projectiles/MeteorFist.cs new file mode 100644 index 0000000000..bbbcaf4654 --- /dev/null +++ b/Projectiles/MeteorFist.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MeteorFist.png b/Projectiles/MeteorFist.png new file mode 100644 index 0000000000..3a51d819f5 Binary files /dev/null and b/Projectiles/MeteorFist.png differ diff --git a/Projectiles/MiniRocket.cs b/Projectiles/MiniRocket.cs new file mode 100644 index 0000000000..52b0471b80 --- /dev/null +++ b/Projectiles/MiniRocket.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MiniRocket.png b/Projectiles/MiniRocket.png new file mode 100644 index 0000000000..b6fbd0efbb Binary files /dev/null and b/Projectiles/MiniRocket.png differ diff --git a/Projectiles/MiniRocketExplosion.cs b/Projectiles/MiniRocketExplosion.cs new file mode 100644 index 0000000000..09823d21e9 --- /dev/null +++ b/Projectiles/MiniRocketExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MiniRocketExplosion.png b/Projectiles/MiniRocketExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/MiniRocketExplosion.png differ diff --git a/Projectiles/MiniSandShark.cs b/Projectiles/MiniSandShark.cs new file mode 100644 index 0000000000..e1409ff879 --- /dev/null +++ b/Projectiles/MiniSandShark.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/MiniSandShark.png b/Projectiles/MiniSandShark.png new file mode 100644 index 0000000000..80d87da105 Binary files /dev/null and b/Projectiles/MiniSandShark.png differ diff --git a/Projectiles/MirrorBlast.cs b/Projectiles/MirrorBlast.cs new file mode 100644 index 0000000000..487dc8e685 --- /dev/null +++ b/Projectiles/MirrorBlast.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/MirrorBlast.png b/Projectiles/MirrorBlast.png new file mode 100644 index 0000000000..b9497e1bad Binary files /dev/null and b/Projectiles/MirrorBlast.png differ diff --git a/Projectiles/MistArrow.cs b/Projectiles/MistArrow.cs new file mode 100644 index 0000000000..57d9fd4524 --- /dev/null +++ b/Projectiles/MistArrow.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MistArrow.png b/Projectiles/MistArrow.png new file mode 100644 index 0000000000..9aab0bf1d7 Binary files /dev/null and b/Projectiles/MistArrow.png differ diff --git a/Projectiles/MoltenAmputator.cs b/Projectiles/MoltenAmputator.cs new file mode 100644 index 0000000000..2cf2afc11e --- /dev/null +++ b/Projectiles/MoltenAmputator.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/MoltenAmputator.png b/Projectiles/MoltenAmputator.png new file mode 100644 index 0000000000..4e44d58710 Binary files /dev/null and b/Projectiles/MoltenAmputator.png differ diff --git a/Projectiles/MortarRound.cs b/Projectiles/MortarRound.cs new file mode 100644 index 0000000000..298bb69e97 --- /dev/null +++ b/Projectiles/MortarRound.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/MortarRound.png b/Projectiles/MortarRound.png new file mode 100644 index 0000000000..37ef5e341c Binary files /dev/null and b/Projectiles/MortarRound.png differ diff --git a/Projectiles/Mourningstar.cs b/Projectiles/Mourningstar.cs new file mode 100644 index 0000000000..55e60333fe --- /dev/null +++ b/Projectiles/Mourningstar.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Mourningstar.png b/Projectiles/Mourningstar.png new file mode 100644 index 0000000000..3f5f4d8eef Binary files /dev/null and b/Projectiles/Mourningstar.png differ diff --git a/Projectiles/Murasama.cs b/Projectiles/Murasama.cs new file mode 100644 index 0000000000..6afb9e3000 --- /dev/null +++ b/Projectiles/Murasama.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Murasama.png b/Projectiles/Murasama.png new file mode 100644 index 0000000000..3680218463 Binary files /dev/null and b/Projectiles/Murasama.png differ diff --git a/Projectiles/Mycoroot.cs b/Projectiles/Mycoroot.cs new file mode 100644 index 0000000000..6cd75e5261 --- /dev/null +++ b/Projectiles/Mycoroot.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Mycoroot.png b/Projectiles/Mycoroot.png new file mode 100644 index 0000000000..b8bfd1b5d0 Binary files /dev/null and b/Projectiles/Mycoroot.png differ diff --git a/Projectiles/MythrilKnifeProjectile.cs b/Projectiles/MythrilKnifeProjectile.cs new file mode 100644 index 0000000000..c4b348c1ee --- /dev/null +++ b/Projectiles/MythrilKnifeProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/MythrilKnifeProjectile.png b/Projectiles/MythrilKnifeProjectile.png new file mode 100644 index 0000000000..8ff7d5aede Binary files /dev/null and b/Projectiles/MythrilKnifeProjectile.png differ diff --git a/Projectiles/Nanomachine.cs b/Projectiles/Nanomachine.cs new file mode 100644 index 0000000000..ec12e277e1 --- /dev/null +++ b/Projectiles/Nanomachine.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Nanomachine.png b/Projectiles/Nanomachine.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Nanomachine.png differ diff --git a/Projectiles/Nanotech.cs b/Projectiles/Nanotech.cs new file mode 100644 index 0000000000..71e6f91773 --- /dev/null +++ b/Projectiles/Nanotech.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Nanotech.png b/Projectiles/Nanotech.png new file mode 100644 index 0000000000..d9efda8b1d Binary files /dev/null and b/Projectiles/Nanotech.png differ diff --git a/Projectiles/NapalmArrow.cs b/Projectiles/NapalmArrow.cs new file mode 100644 index 0000000000..c46b4b5c03 --- /dev/null +++ b/Projectiles/NapalmArrow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NapalmArrow.png b/Projectiles/NapalmArrow.png new file mode 100644 index 0000000000..53fb0e274a Binary files /dev/null and b/Projectiles/NapalmArrow.png differ diff --git a/Projectiles/Nebudust.cs b/Projectiles/Nebudust.cs new file mode 100644 index 0000000000..26e7c6248e --- /dev/null +++ b/Projectiles/Nebudust.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/Nebudust.png b/Projectiles/Nebudust.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Nebudust.png differ diff --git a/Projectiles/NebulaDust.cs b/Projectiles/NebulaDust.cs new file mode 100644 index 0000000000..8169c41b8c --- /dev/null +++ b/Projectiles/NebulaDust.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NebulaDust.png b/Projectiles/NebulaDust.png new file mode 100644 index 0000000000..39fc076f6c Binary files /dev/null and b/Projectiles/NebulaDust.png differ diff --git a/Projectiles/NebulaShot.cs b/Projectiles/NebulaShot.cs new file mode 100644 index 0000000000..a469839db6 --- /dev/null +++ b/Projectiles/NebulaShot.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NebulaShot.png b/Projectiles/NebulaShot.png new file mode 100644 index 0000000000..ef1edb7c71 Binary files /dev/null and b/Projectiles/NebulaShot.png differ diff --git a/Projectiles/NebulaStar.cs b/Projectiles/NebulaStar.cs new file mode 100644 index 0000000000..d1f9887d5f --- /dev/null +++ b/Projectiles/NebulaStar.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NebulaStar.png b/Projectiles/NebulaStar.png new file mode 100644 index 0000000000..8bc516ca54 Binary files /dev/null and b/Projectiles/NebulaStar.png differ diff --git a/Projectiles/Nebulash.cs b/Projectiles/Nebulash.cs new file mode 100644 index 0000000000..93b550e36c --- /dev/null +++ b/Projectiles/Nebulash.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Nebulash.png b/Projectiles/Nebulash.png new file mode 100644 index 0000000000..67ecfde001 Binary files /dev/null and b/Projectiles/Nebulash.png differ diff --git a/Projectiles/Needler.cs b/Projectiles/Needler.cs new file mode 100644 index 0000000000..405ae2c042 --- /dev/null +++ b/Projectiles/Needler.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Needler.png b/Projectiles/Needler.png new file mode 100644 index 0000000000..8a38d483fa Binary files /dev/null and b/Projectiles/Needler.png differ diff --git a/Projectiles/NeptuneOrb.cs b/Projectiles/NeptuneOrb.cs new file mode 100644 index 0000000000..35e341d21e --- /dev/null +++ b/Projectiles/NeptuneOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/NeptuneOrb.png b/Projectiles/NeptuneOrb.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/NeptuneOrb.png differ diff --git a/Projectiles/NightBolt.cs b/Projectiles/NightBolt.cs new file mode 100644 index 0000000000..2e526d7751 --- /dev/null +++ b/Projectiles/NightBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NightBolt.png b/Projectiles/NightBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/NightBolt.png differ diff --git a/Projectiles/NightOrb.cs b/Projectiles/NightOrb.cs new file mode 100644 index 0000000000..d6c05299dd --- /dev/null +++ b/Projectiles/NightOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NightOrb.png b/Projectiles/NightOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/NightOrb.png differ diff --git a/Projectiles/NightRay.cs b/Projectiles/NightRay.cs new file mode 100644 index 0000000000..8b986235a8 --- /dev/null +++ b/Projectiles/NightRay.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NightRay.png b/Projectiles/NightRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/NightRay.png differ diff --git a/Projectiles/NightStabber.cs b/Projectiles/NightStabber.cs new file mode 100644 index 0000000000..7bab489687 --- /dev/null +++ b/Projectiles/NightStabber.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NightStabber.png b/Projectiles/NightStabber.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/NightStabber.png differ diff --git a/Projectiles/NobodyKnows.cs b/Projectiles/NobodyKnows.cs new file mode 100644 index 0000000000..cb719916d3 --- /dev/null +++ b/Projectiles/NobodyKnows.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/NobodyKnows.png b/Projectiles/NobodyKnows.png new file mode 100644 index 0000000000..0c09522090 Binary files /dev/null and b/Projectiles/NobodyKnows.png differ diff --git a/Projectiles/NuclearFuryProjectile.cs b/Projectiles/NuclearFuryProjectile.cs new file mode 100644 index 0000000000..565296438b --- /dev/null +++ b/Projectiles/NuclearFuryProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/NuclearFuryProjectile.png b/Projectiles/NuclearFuryProjectile.png new file mode 100644 index 0000000000..5bd9c6a382 Binary files /dev/null and b/Projectiles/NuclearFuryProjectile.png differ diff --git a/Projectiles/Nuke.cs b/Projectiles/Nuke.cs new file mode 100644 index 0000000000..85cef64d84 --- /dev/null +++ b/Projectiles/Nuke.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Nuke.png b/Projectiles/Nuke.png new file mode 100644 index 0000000000..bcafcc1dba Binary files /dev/null and b/Projectiles/Nuke.png differ diff --git a/Projectiles/NukeExplosion.cs b/Projectiles/NukeExplosion.cs new file mode 100644 index 0000000000..587600516e --- /dev/null +++ b/Projectiles/NukeExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/NukeExplosion.png b/Projectiles/NukeExplosion.png new file mode 100644 index 0000000000..a984877c16 Binary files /dev/null and b/Projectiles/NukeExplosion.png differ diff --git a/Projectiles/NullShot.cs b/Projectiles/NullShot.cs new file mode 100644 index 0000000000..611a685661 --- /dev/null +++ b/Projectiles/NullShot.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NullShot.png b/Projectiles/NullShot.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/NullShot.png differ diff --git a/Projectiles/NullShot2.cs b/Projectiles/NullShot2.cs new file mode 100644 index 0000000000..4680f0da2e --- /dev/null +++ b/Projectiles/NullShot2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/NullShot2.png b/Projectiles/NullShot2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/NullShot2.png differ diff --git a/Projectiles/OMGWTH.cs b/Projectiles/OMGWTH.cs new file mode 100644 index 0000000000..002f81e0f2 --- /dev/null +++ b/Projectiles/OMGWTH.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/OMGWTH.png b/Projectiles/OMGWTH.png new file mode 100644 index 0000000000..87d6c017a4 Binary files /dev/null and b/Projectiles/OMGWTH.png differ diff --git a/Projectiles/OPHammer.cs b/Projectiles/OPHammer.cs new file mode 100644 index 0000000000..7e341ad734 --- /dev/null +++ b/Projectiles/OPHammer.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/OPHammer.png b/Projectiles/OPHammer.png new file mode 100644 index 0000000000..b527ef88b6 Binary files /dev/null and b/Projectiles/OPHammer.png differ diff --git a/Projectiles/OPHammerMelee.cs b/Projectiles/OPHammerMelee.cs new file mode 100644 index 0000000000..99d5245d4c --- /dev/null +++ b/Projectiles/OPHammerMelee.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/OPHammerMelee.png b/Projectiles/OPHammerMelee.png new file mode 100644 index 0000000000..b527ef88b6 Binary files /dev/null and b/Projectiles/OPHammerMelee.png differ diff --git a/Projectiles/Oathblade.cs b/Projectiles/Oathblade.cs new file mode 100644 index 0000000000..978a1e278d --- /dev/null +++ b/Projectiles/Oathblade.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Oathblade.png b/Projectiles/Oathblade.png new file mode 100644 index 0000000000..e594d983b1 Binary files /dev/null and b/Projectiles/Oathblade.png differ diff --git a/Projectiles/OceanBeam.cs b/Projectiles/OceanBeam.cs new file mode 100644 index 0000000000..c4c1232c71 --- /dev/null +++ b/Projectiles/OceanBeam.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 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/OceanBeam.png b/Projectiles/OceanBeam.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/OceanBeam.png differ diff --git a/Projectiles/OmegaBiomeOrb.cs b/Projectiles/OmegaBiomeOrb.cs new file mode 100644 index 0000000000..0b656700ad --- /dev/null +++ b/Projectiles/OmegaBiomeOrb.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/OmegaBiomeOrb.png b/Projectiles/OmegaBiomeOrb.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/OmegaBiomeOrb.png differ diff --git a/Projectiles/OnyxExplosion.cs b/Projectiles/OnyxExplosion.cs new file mode 100644 index 0000000000..4a06a604a6 --- /dev/null +++ b/Projectiles/OnyxExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/OnyxExplosion.png b/Projectiles/OnyxExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/OnyxExplosion.png differ diff --git a/Projectiles/OnyxSharkBomb.cs b/Projectiles/OnyxSharkBomb.cs new file mode 100644 index 0000000000..bd50da0155 --- /dev/null +++ b/Projectiles/OnyxSharkBomb.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/OnyxSharkBomb.png b/Projectiles/OnyxSharkBomb.png new file mode 100644 index 0000000000..9c23e79a0a Binary files /dev/null and b/Projectiles/OnyxSharkBomb.png differ diff --git a/Projectiles/OpalStrike.cs b/Projectiles/OpalStrike.cs new file mode 100644 index 0000000000..2840cd5950 --- /dev/null +++ b/Projectiles/OpalStrike.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/OpalStrike.png b/Projectiles/OpalStrike.png new file mode 100644 index 0000000000..7b8bbf5551 Binary files /dev/null and b/Projectiles/OpalStrike.png differ diff --git a/Projectiles/OrangeExoArrow.cs b/Projectiles/OrangeExoArrow.cs new file mode 100644 index 0000000000..294b2b9bc0 --- /dev/null +++ b/Projectiles/OrangeExoArrow.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/OrangeExoArrow.png b/Projectiles/OrangeExoArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/OrangeExoArrow.png differ diff --git a/Projectiles/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/OrichalcumSpikedGemstoneProjectile.cs new file mode 100644 index 0000000000..6f0ec20e0c --- /dev/null +++ b/Projectiles/OrichalcumSpikedGemstoneProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/OrichalcumSpikedGemstoneProjectile.png b/Projectiles/OrichalcumSpikedGemstoneProjectile.png new file mode 100644 index 0000000000..7f94126948 Binary files /dev/null and b/Projectiles/OrichalcumSpikedGemstoneProjectile.png differ diff --git a/Projectiles/PalladiumJavelinProjectile.cs b/Projectiles/PalladiumJavelinProjectile.cs new file mode 100644 index 0000000000..6fcf5e8b6c --- /dev/null +++ b/Projectiles/PalladiumJavelinProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PalladiumJavelinProjectile.png b/Projectiles/PalladiumJavelinProjectile.png new file mode 100644 index 0000000000..3e47a84329 Binary files /dev/null and b/Projectiles/PalladiumJavelinProjectile.png differ diff --git a/Projectiles/ParticleBeamofDoom.cs b/Projectiles/ParticleBeamofDoom.cs new file mode 100644 index 0000000000..c931ace2e3 --- /dev/null +++ b/Projectiles/ParticleBeamofDoom.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ParticleBeamofDoom.png b/Projectiles/ParticleBeamofDoom.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/ParticleBeamofDoom.png differ diff --git a/Projectiles/Permafrost/ArcticBearPaw.cs b/Projectiles/Permafrost/ArcticBearPaw.cs new file mode 100644 index 0000000000..e0028af2df --- /dev/null +++ b/Projectiles/Permafrost/ArcticBearPaw.cs @@ -0,0 +1,62 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class ArcticBearPaw : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Bear Paw"); + } + + public override void AI() + { + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + + if (projectile.velocity.X > -0.05f && projectile.velocity.X < 0.05f & + projectile.velocity.Y > -0.05f && projectile.velocity.Y < 0.05f) + { + projectile.Kill(); + } + else + { + projectile.velocity *= 0.96f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 60); + + if (Main.rand.Next(3) == 0) + target.AddBuff(BuffID.Confused, Main.rand.Next(60, 240)); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/ArcticBearPaw.png b/Projectiles/Permafrost/ArcticBearPaw.png new file mode 100644 index 0000000000..d2c9c04e1c Binary files /dev/null and b/Projectiles/Permafrost/ArcticBearPaw.png differ diff --git a/Projectiles/Permafrost/DarkIce.cs b/Projectiles/Permafrost/DarkIce.cs new file mode 100644 index 0000000000..f39d085ea3 --- /dev/null +++ b/Projectiles/Permafrost/DarkIce.cs @@ -0,0 +1,70 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class DarkIce : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + projectile.coldDamage = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ice"); + } + + public override void AI() + { + if (projectile.localAI[0] != 1f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item8, projectile.Center); + } + + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + { + projectile.velocity *= 1.04f; + } + + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.25f); + Main.dust[index2].noGravity = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 480); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(198, 197, 246); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int i = 0; i < 30; i++) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), Main.rand.NextFloat(1f, 2f)); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 4f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/DarkIce.png b/Projectiles/Permafrost/DarkIce.png new file mode 100644 index 0000000000..9f30449aae Binary files /dev/null and b/Projectiles/Permafrost/DarkIce.png differ diff --git a/Projectiles/Permafrost/DarkIceZero.cs b/Projectiles/Permafrost/DarkIceZero.cs new file mode 100644 index 0000000000..e2012f8fa7 --- /dev/null +++ b/Projectiles/Permafrost/DarkIceZero.cs @@ -0,0 +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(); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/DarkIceZero.png b/Projectiles/Permafrost/DarkIceZero.png new file mode 100644 index 0000000000..9f30449aae Binary files /dev/null and b/Projectiles/Permafrost/DarkIceZero.png differ diff --git a/Projectiles/Permafrost/FrostShardFriendly.cs b/Projectiles/Permafrost/FrostShardFriendly.cs new file mode 100644 index 0000000000..786a60cf64 --- /dev/null +++ b/Projectiles/Permafrost/FrostShardFriendly.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/FrostShardFriendly.png b/Projectiles/Permafrost/FrostShardFriendly.png new file mode 100644 index 0000000000..cf7a6c32b1 Binary files /dev/null and b/Projectiles/Permafrost/FrostShardFriendly.png differ diff --git a/Projectiles/Permafrost/FrostyFlare.cs b/Projectiles/Permafrost/FrostyFlare.cs new file mode 100644 index 0000000000..c7c83aef22 --- /dev/null +++ b/Projectiles/Permafrost/FrostyFlare.cs @@ -0,0 +1,131 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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/FrostyFlare.png b/Projectiles/Permafrost/FrostyFlare.png new file mode 100644 index 0000000000..8f934864f9 Binary files /dev/null and b/Projectiles/Permafrost/FrostyFlare.png differ diff --git a/Projectiles/Permafrost/IceSentry.cs b/Projectiles/Permafrost/IceSentry.cs new file mode 100644 index 0000000000..734bae46c2 --- /dev/null +++ b/Projectiles/Permafrost/IceSentry.cs @@ -0,0 +1,164 @@ +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); + } + } +} diff --git a/Projectiles/Permafrost/IceSentry.png b/Projectiles/Permafrost/IceSentry.png new file mode 100644 index 0000000000..56d9586d50 Binary files /dev/null and b/Projectiles/Permafrost/IceSentry.png differ diff --git a/Projectiles/Permafrost/Icicle.cs b/Projectiles/Permafrost/Icicle.cs new file mode 100644 index 0000000000..1db5978862 --- /dev/null +++ b/Projectiles/Permafrost/Icicle.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class Icicle : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 1; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle"); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + Main.dust[index2].scale *= 0.9f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/Icicle.png b/Projectiles/Permafrost/Icicle.png new file mode 100644 index 0000000000..0a5364d057 Binary files /dev/null and b/Projectiles/Permafrost/Icicle.png differ diff --git a/Projectiles/Permafrost/IcicleArrow.cs b/Projectiles/Permafrost/IcicleArrow.cs new file mode 100644 index 0000000000..d4f45af644 --- /dev/null +++ b/Projectiles/Permafrost/IcicleArrow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/IcicleArrow.png b/Projectiles/Permafrost/IcicleArrow.png new file mode 100644 index 0000000000..6812f4d459 Binary files /dev/null and b/Projectiles/Permafrost/IcicleArrow.png differ diff --git a/Projectiles/Permafrost/IcyBullet.cs b/Projectiles/Permafrost/IcyBullet.cs new file mode 100644 index 0000000000..ee26ace66c --- /dev/null +++ b/Projectiles/Permafrost/IcyBullet.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/IcyBullet.png b/Projectiles/Permafrost/IcyBullet.png new file mode 100644 index 0000000000..e56d5a760a Binary files /dev/null and b/Projectiles/Permafrost/IcyBullet.png differ diff --git a/Projectiles/Permafrost/Snowball.cs b/Projectiles/Permafrost/Snowball.cs new file mode 100644 index 0000000000..509dd27865 --- /dev/null +++ b/Projectiles/Permafrost/Snowball.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class Snowball : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowball"); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + //crystal bullet shards + for (int index1 = 0; index1 < 10; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 2f; + } + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 6; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + int p = Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + Main.projectile[p].ranged = false; + Main.projectile[p].magic = true; + } + } + //insert ice shattering dust here + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/Snowball.png b/Projectiles/Permafrost/Snowball.png new file mode 100644 index 0000000000..edd7425f3d Binary files /dev/null and b/Projectiles/Permafrost/Snowball.png differ diff --git a/Projectiles/Permafrost/TridentIcicle.cs b/Projectiles/Permafrost/TridentIcicle.cs new file mode 100644 index 0000000000..b4f5c7ff09 --- /dev/null +++ b/Projectiles/Permafrost/TridentIcicle.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class TridentIcicle : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.coldDamage = true; + projectile.magic = true; + projectile.penetrate = 2; + projectile.ignoreWater = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident Icicle"); + } + + public override void AI() + { + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int i = 0; i < 10; i++) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 2f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Permafrost/TridentIcicle.png b/Projectiles/Permafrost/TridentIcicle.png new file mode 100644 index 0000000000..cd64237a8a Binary files /dev/null and b/Projectiles/Permafrost/TridentIcicle.png differ diff --git a/Projectiles/Phangasm.cs b/Projectiles/Phangasm.cs new file mode 100644 index 0000000000..c89dbd5eef --- /dev/null +++ b/Projectiles/Phangasm.cs @@ -0,0 +1,137 @@ +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/Phangasm.png b/Projectiles/Phangasm.png new file mode 100644 index 0000000000..81a7167455 Binary files /dev/null and b/Projectiles/Phangasm.png differ diff --git a/Projectiles/PhantasmalFury.cs b/Projectiles/PhantasmalFury.cs new file mode 100644 index 0000000000..8f6b8c5bf3 --- /dev/null +++ b/Projectiles/PhantasmalFury.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PhantasmalFury.png b/Projectiles/PhantasmalFury.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/PhantasmalFury.png differ diff --git a/Projectiles/Phantom.cs b/Projectiles/Phantom.cs new file mode 100644 index 0000000000..96ee0f32ce --- /dev/null +++ b/Projectiles/Phantom.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/Phantom.png b/Projectiles/Phantom.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Phantom.png differ diff --git a/Projectiles/PhantomGuy.cs b/Projectiles/PhantomGuy.cs new file mode 100644 index 0000000000..262d44f7f7 --- /dev/null +++ b/Projectiles/PhantomGuy.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PhantomGuy.png b/Projectiles/PhantomGuy.png new file mode 100644 index 0000000000..b842e7e9b6 Binary files /dev/null and b/Projectiles/PhantomGuy.png differ diff --git a/Projectiles/PhoenixFire.cs b/Projectiles/PhoenixFire.cs new file mode 100644 index 0000000000..e64acc6744 --- /dev/null +++ b/Projectiles/PhoenixFire.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/PhoenixFire.png b/Projectiles/PhoenixFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/PhoenixFire.png differ diff --git a/Projectiles/PhoenixFireFriendly.cs b/Projectiles/PhoenixFireFriendly.cs new file mode 100644 index 0000000000..0d70b89aaa --- /dev/null +++ b/Projectiles/PhoenixFireFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PhoenixFireFriendly.png b/Projectiles/PhoenixFireFriendly.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/PhoenixFireFriendly.png differ diff --git a/Projectiles/PhoenixHeal.cs b/Projectiles/PhoenixHeal.cs new file mode 100644 index 0000000000..c9b56f2953 --- /dev/null +++ b/Projectiles/PhoenixHeal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/PhoenixHeal.png b/Projectiles/PhoenixHeal.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/PhoenixHeal.png differ diff --git a/Projectiles/PlagueArrow.cs b/Projectiles/PlagueArrow.cs new file mode 100644 index 0000000000..2040c8b09d --- /dev/null +++ b/Projectiles/PlagueArrow.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PlagueArrow.png b/Projectiles/PlagueArrow.png new file mode 100644 index 0000000000..4a85df1eba Binary files /dev/null and b/Projectiles/PlagueArrow.png differ diff --git a/Projectiles/PlagueDust.cs b/Projectiles/PlagueDust.cs new file mode 100644 index 0000000000..5209037a10 --- /dev/null +++ b/Projectiles/PlagueDust.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/PlagueDust.png b/Projectiles/PlagueDust.png new file mode 100644 index 0000000000..77e7330592 Binary files /dev/null and b/Projectiles/PlagueDust.png differ diff --git a/Projectiles/PlagueExplosion.cs b/Projectiles/PlagueExplosion.cs new file mode 100644 index 0000000000..30c4fc63b7 --- /dev/null +++ b/Projectiles/PlagueExplosion.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PlagueExplosion.png b/Projectiles/PlagueExplosion.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/PlagueExplosion.png differ diff --git a/Projectiles/PlagueExplosionFriendly.cs b/Projectiles/PlagueExplosionFriendly.cs new file mode 100644 index 0000000000..5e61b1af2d --- /dev/null +++ b/Projectiles/PlagueExplosionFriendly.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PlagueExplosionFriendly.png b/Projectiles/PlagueExplosionFriendly.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/PlagueExplosionFriendly.png differ diff --git a/Projectiles/PlagueFang.cs b/Projectiles/PlagueFang.cs new file mode 100644 index 0000000000..c26ed2e053 --- /dev/null +++ b/Projectiles/PlagueFang.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/PlagueFang.png b/Projectiles/PlagueFang.png new file mode 100644 index 0000000000..36894fc914 Binary files /dev/null and b/Projectiles/PlagueFang.png differ diff --git a/Projectiles/PlagueSeeker.cs b/Projectiles/PlagueSeeker.cs new file mode 100644 index 0000000000..d84507b565 --- /dev/null +++ b/Projectiles/PlagueSeeker.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PlagueSeeker.png b/Projectiles/PlagueSeeker.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/PlagueSeeker.png differ diff --git a/Projectiles/PlasmaBall.cs b/Projectiles/PlasmaBall.cs new file mode 100644 index 0000000000..3cfa332d78 --- /dev/null +++ b/Projectiles/PlasmaBall.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaBall.png b/Projectiles/PlasmaBall.png new file mode 100644 index 0000000000..139ef2e822 Binary files /dev/null and b/Projectiles/PlasmaBall.png differ diff --git a/Projectiles/PlasmaBlast.cs b/Projectiles/PlasmaBlast.cs new file mode 100644 index 0000000000..6cf7fc8f28 --- /dev/null +++ b/Projectiles/PlasmaBlast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaBlast.png b/Projectiles/PlasmaBlast.png new file mode 100644 index 0000000000..cafdce830a Binary files /dev/null and b/Projectiles/PlasmaBlast.png differ diff --git a/Projectiles/PlasmaBolt.cs b/Projectiles/PlasmaBolt.cs new file mode 100644 index 0000000000..648b8c25af --- /dev/null +++ b/Projectiles/PlasmaBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaBolt.png b/Projectiles/PlasmaBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/PlasmaBolt.png differ diff --git a/Projectiles/PlasmaExplosion.cs b/Projectiles/PlasmaExplosion.cs new file mode 100644 index 0000000000..59ac6cfa61 --- /dev/null +++ b/Projectiles/PlasmaExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaExplosion.png b/Projectiles/PlasmaExplosion.png new file mode 100644 index 0000000000..d0ac21fbc0 Binary files /dev/null and b/Projectiles/PlasmaExplosion.png differ diff --git a/Projectiles/PlasmaRay.cs b/Projectiles/PlasmaRay.cs new file mode 100644 index 0000000000..8536f16140 --- /dev/null +++ b/Projectiles/PlasmaRay.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaRay.png b/Projectiles/PlasmaRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/PlasmaRay.png differ diff --git a/Projectiles/PlasmaRay2.cs b/Projectiles/PlasmaRay2.cs new file mode 100644 index 0000000000..295f166734 --- /dev/null +++ b/Projectiles/PlasmaRay2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaRay2.png b/Projectiles/PlasmaRay2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/PlasmaRay2.png differ diff --git a/Projectiles/PlasmaShot.cs b/Projectiles/PlasmaShot.cs new file mode 100644 index 0000000000..a658d3fde8 --- /dev/null +++ b/Projectiles/PlasmaShot.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PlasmaShot.png b/Projectiles/PlasmaShot.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/PlasmaShot.png differ diff --git a/Projectiles/PoisonousSeawater.cs b/Projectiles/PoisonousSeawater.cs new file mode 100644 index 0000000000..db9158e19a --- /dev/null +++ b/Projectiles/PoisonousSeawater.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/PoisonousSeawater.png b/Projectiles/PoisonousSeawater.png new file mode 100644 index 0000000000..d72b7b5eac Binary files /dev/null and b/Projectiles/PoisonousSeawater.png differ diff --git a/Projectiles/ProBolt.cs b/Projectiles/ProBolt.cs new file mode 100644 index 0000000000..9e1bb1de30 --- /dev/null +++ b/Projectiles/ProBolt.cs @@ -0,0 +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 + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ProBolt.png b/Projectiles/ProBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/ProBolt.png differ diff --git a/Projectiles/ProfanedEnergy.cs b/Projectiles/ProfanedEnergy.cs new file mode 100644 index 0000000000..4fa1274c5b --- /dev/null +++ b/Projectiles/ProfanedEnergy.cs @@ -0,0 +1,143 @@ +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ProfanedEnergy.png b/Projectiles/ProfanedEnergy.png new file mode 100644 index 0000000000..1e858a1399 Binary files /dev/null and b/Projectiles/ProfanedEnergy.png differ diff --git a/Projectiles/ProfanedTrident.cs b/Projectiles/ProfanedTrident.cs new file mode 100644 index 0000000000..885c99b8dc --- /dev/null +++ b/Projectiles/ProfanedTrident.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ProfanedTrident.png b/Projectiles/ProfanedTrident.png new file mode 100644 index 0000000000..c289771cc6 Binary files /dev/null and b/Projectiles/ProfanedTrident.png differ diff --git a/Projectiles/Purge.cs b/Projectiles/Purge.cs new file mode 100644 index 0000000000..df6724256e --- /dev/null +++ b/Projectiles/Purge.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/Purge.png b/Projectiles/Purge.png new file mode 100644 index 0000000000..21af608050 Binary files /dev/null and b/Projectiles/Purge.png differ diff --git a/Projectiles/PurgeLaser.cs b/Projectiles/PurgeLaser.cs new file mode 100644 index 0000000000..9aacb3109a --- /dev/null +++ b/Projectiles/PurgeLaser.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/PurgeLaser.png b/Projectiles/PurgeLaser.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/PurgeLaser.png differ diff --git a/Projectiles/Pwnagehammer.cs b/Projectiles/Pwnagehammer.cs new file mode 100644 index 0000000000..aa103c2990 --- /dev/null +++ b/Projectiles/Pwnagehammer.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Pwnagehammer.png b/Projectiles/Pwnagehammer.png new file mode 100644 index 0000000000..7a6cb7bc22 Binary files /dev/null and b/Projectiles/Pwnagehammer.png differ diff --git a/Projectiles/PwnagehammerMelee.cs b/Projectiles/PwnagehammerMelee.cs new file mode 100644 index 0000000000..69a1781455 --- /dev/null +++ b/Projectiles/PwnagehammerMelee.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/PwnagehammerMelee.png b/Projectiles/PwnagehammerMelee.png new file mode 100644 index 0000000000..7a6cb7bc22 Binary files /dev/null and b/Projectiles/PwnagehammerMelee.png differ diff --git a/Projectiles/QuagmireProjectile.cs b/Projectiles/QuagmireProjectile.cs new file mode 100644 index 0000000000..3bbcbf107f --- /dev/null +++ b/Projectiles/QuagmireProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/QuagmireProjectile.png b/Projectiles/QuagmireProjectile.png new file mode 100644 index 0000000000..639182396b Binary files /dev/null and b/Projectiles/QuagmireProjectile.png differ diff --git a/Projectiles/RainBolt.cs b/Projectiles/RainBolt.cs new file mode 100644 index 0000000000..f893828f4f --- /dev/null +++ b/Projectiles/RainBolt.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/RainBolt.png b/Projectiles/RainBolt.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/RainBolt.png differ diff --git a/Projectiles/RainHeal.cs b/Projectiles/RainHeal.cs new file mode 100644 index 0000000000..2aa42acc34 --- /dev/null +++ b/Projectiles/RainHeal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/RainHeal.png b/Projectiles/RainHeal.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/RainHeal.png differ diff --git a/Projectiles/RainbowBlast.cs b/Projectiles/RainbowBlast.cs new file mode 100644 index 0000000000..142fb63f42 --- /dev/null +++ b/Projectiles/RainbowBlast.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/RainbowBlast.png b/Projectiles/RainbowBlast.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/RainbowBlast.png differ diff --git a/Projectiles/RainbowBoom.cs b/Projectiles/RainbowBoom.cs new file mode 100644 index 0000000000..1d25349b48 --- /dev/null +++ b/Projectiles/RainbowBoom.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/RainbowBoom.png b/Projectiles/RainbowBoom.png new file mode 100644 index 0000000000..e975d88423 Binary files /dev/null and b/Projectiles/RainbowBoom.png differ diff --git a/Projectiles/Razorwind.cs b/Projectiles/Razorwind.cs new file mode 100644 index 0000000000..71237c8fa0 --- /dev/null +++ b/Projectiles/Razorwind.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Razorwind.png b/Projectiles/Razorwind.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/Razorwind.png differ diff --git a/Projectiles/ReaverBlast.cs b/Projectiles/ReaverBlast.cs new file mode 100644 index 0000000000..583d35a442 --- /dev/null +++ b/Projectiles/ReaverBlast.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ReaverBlast.png b/Projectiles/ReaverBlast.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/ReaverBlast.png differ diff --git a/Projectiles/ReaverOrb.cs b/Projectiles/ReaverOrb.cs new file mode 100644 index 0000000000..aef2b7a14e --- /dev/null +++ b/Projectiles/ReaverOrb.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/ReaverOrb.png b/Projectiles/ReaverOrb.png new file mode 100644 index 0000000000..08ba8e0d39 Binary files /dev/null and b/Projectiles/ReaverOrb.png differ diff --git a/Projectiles/RedBall.cs b/Projectiles/RedBall.cs new file mode 100644 index 0000000000..d6696de790 --- /dev/null +++ b/Projectiles/RedBall.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 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/RedBall.png b/Projectiles/RedBall.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/RedBall.png differ diff --git a/Projectiles/RedDevil.cs b/Projectiles/RedDevil.cs new file mode 100644 index 0000000000..8275317d9c --- /dev/null +++ b/Projectiles/RedDevil.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/RedDevil.png b/Projectiles/RedDevil.png new file mode 100644 index 0000000000..ab63c1a2c0 Binary files /dev/null and b/Projectiles/RedDevil.png differ diff --git a/Projectiles/RedDust.cs b/Projectiles/RedDust.cs new file mode 100644 index 0000000000..78db5cf509 --- /dev/null +++ b/Projectiles/RedDust.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/RedDust.png b/Projectiles/RedDust.png new file mode 100644 index 0000000000..1f74a58cfc Binary files /dev/null and b/Projectiles/RedDust.png differ diff --git a/Projectiles/RedSpawn.cs b/Projectiles/RedSpawn.cs new file mode 100644 index 0000000000..aafb7d65b9 --- /dev/null +++ b/Projectiles/RedSpawn.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/RedSpawn.png b/Projectiles/RedSpawn.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/RedSpawn.png differ diff --git a/Projectiles/RotBallProjectile.cs b/Projectiles/RotBallProjectile.cs new file mode 100644 index 0000000000..e1ce3338b1 --- /dev/null +++ b/Projectiles/RotBallProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/RotBallProjectile.png b/Projectiles/RotBallProjectile.png new file mode 100644 index 0000000000..b5a6ed3dd1 Binary files /dev/null and b/Projectiles/RotBallProjectile.png differ diff --git a/Projectiles/RougeSlashLarge.cs b/Projectiles/RougeSlashLarge.cs new file mode 100644 index 0000000000..ff7bc386da --- /dev/null +++ b/Projectiles/RougeSlashLarge.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/RougeSlashLarge.png b/Projectiles/RougeSlashLarge.png new file mode 100644 index 0000000000..470f62db8a Binary files /dev/null and b/Projectiles/RougeSlashLarge.png differ diff --git a/Projectiles/RougeSlashMedium.cs b/Projectiles/RougeSlashMedium.cs new file mode 100644 index 0000000000..3b4ff433a2 --- /dev/null +++ b/Projectiles/RougeSlashMedium.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/RougeSlashMedium.png b/Projectiles/RougeSlashMedium.png new file mode 100644 index 0000000000..2f704c5fb3 Binary files /dev/null and b/Projectiles/RougeSlashMedium.png differ diff --git a/Projectiles/RougeSlashSmall.cs b/Projectiles/RougeSlashSmall.cs new file mode 100644 index 0000000000..04f81c4ab1 --- /dev/null +++ b/Projectiles/RougeSlashSmall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/RougeSlashSmall.png b/Projectiles/RougeSlashSmall.png new file mode 100644 index 0000000000..e613ab5a02 Binary files /dev/null and b/Projectiles/RougeSlashSmall.png differ diff --git a/Projectiles/RoyalHeal.cs b/Projectiles/RoyalHeal.cs new file mode 100644 index 0000000000..3bf32ac16a --- /dev/null +++ b/Projectiles/RoyalHeal.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/RoyalHeal.png b/Projectiles/RoyalHeal.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/RoyalHeal.png differ diff --git a/Projectiles/RoyalKnife.cs b/Projectiles/RoyalKnife.cs new file mode 100644 index 0000000000..c3691823bf --- /dev/null +++ b/Projectiles/RoyalKnife.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/RoyalKnife.png b/Projectiles/RoyalKnife.png new file mode 100644 index 0000000000..0ee108a711 Binary files /dev/null and b/Projectiles/RoyalKnife.png differ diff --git a/Projectiles/RoyalKnifeMelee.cs b/Projectiles/RoyalKnifeMelee.cs new file mode 100644 index 0000000000..06100f057e --- /dev/null +++ b/Projectiles/RoyalKnifeMelee.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/RoyalKnifeMelee.png b/Projectiles/RoyalKnifeMelee.png new file mode 100644 index 0000000000..0ee108a711 Binary files /dev/null and b/Projectiles/RoyalKnifeMelee.png differ diff --git a/Projectiles/RubberMortarRound.cs b/Projectiles/RubberMortarRound.cs new file mode 100644 index 0000000000..c9dda6b837 --- /dev/null +++ b/Projectiles/RubberMortarRound.cs @@ -0,0 +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); + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/RubberMortarRound.png b/Projectiles/RubberMortarRound.png new file mode 100644 index 0000000000..a7e8a177e1 Binary files /dev/null and b/Projectiles/RubberMortarRound.png differ diff --git a/Projectiles/SHIV.cs b/Projectiles/SHIV.cs new file mode 100644 index 0000000000..1c8e20366f --- /dev/null +++ b/Projectiles/SHIV.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SHIV.png b/Projectiles/SHIV.png new file mode 100644 index 0000000000..01a8a875ef Binary files /dev/null and b/Projectiles/SHIV.png differ diff --git a/Projectiles/SHPB.cs b/Projectiles/SHPB.cs new file mode 100644 index 0000000000..a4980edad5 --- /dev/null +++ b/Projectiles/SHPB.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SHPB.png b/Projectiles/SHPB.png new file mode 100644 index 0000000000..e0b4f68f54 Binary files /dev/null and b/Projectiles/SHPB.png differ diff --git a/Projectiles/SHPExplosion.cs b/Projectiles/SHPExplosion.cs new file mode 100644 index 0000000000..961bdca53b --- /dev/null +++ b/Projectiles/SHPExplosion.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SHPExplosion.png b/Projectiles/SHPExplosion.png new file mode 100644 index 0000000000..3cb685553d Binary files /dev/null and b/Projectiles/SHPExplosion.png differ diff --git a/Projectiles/SHPL.cs b/Projectiles/SHPL.cs new file mode 100644 index 0000000000..3ed4ad6db6 --- /dev/null +++ b/Projectiles/SHPL.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SHPL.png b/Projectiles/SHPL.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/SHPL.png differ diff --git a/Projectiles/SandBlade.cs b/Projectiles/SandBlade.cs new file mode 100644 index 0000000000..c0b39d03c5 --- /dev/null +++ b/Projectiles/SandBlade.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SandBlade.png b/Projectiles/SandBlade.png new file mode 100644 index 0000000000..33659392e1 Binary files /dev/null and b/Projectiles/SandBlade.png differ diff --git a/Projectiles/SandBolt.cs b/Projectiles/SandBolt.cs new file mode 100644 index 0000000000..f070999e08 --- /dev/null +++ b/Projectiles/SandBolt.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SandBolt.png b/Projectiles/SandBolt.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/SandBolt.png differ diff --git a/Projectiles/SandFire.cs b/Projectiles/SandFire.cs new file mode 100644 index 0000000000..deff91b43b --- /dev/null +++ b/Projectiles/SandFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SandFire.png b/Projectiles/SandFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/SandFire.png differ diff --git a/Projectiles/SandMark.cs b/Projectiles/SandMark.cs new file mode 100644 index 0000000000..631aca34f7 --- /dev/null +++ b/Projectiles/SandMark.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SandMark.png b/Projectiles/SandMark.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/SandMark.png differ diff --git a/Projectiles/SandTornado.cs b/Projectiles/SandTornado.cs new file mode 100644 index 0000000000..eefaa1ea18 --- /dev/null +++ b/Projectiles/SandTornado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SandTornado.png b/Projectiles/SandTornado.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/SandTornado.png differ diff --git a/Projectiles/Sandnado.cs b/Projectiles/Sandnado.cs new file mode 100644 index 0000000000..8c9d8183a9 --- /dev/null +++ b/Projectiles/Sandnado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Sandnado.png b/Projectiles/Sandnado.png new file mode 100644 index 0000000000..7d267da60c Binary files /dev/null and b/Projectiles/Sandnado.png differ diff --git a/Projectiles/SandstormBullet.cs b/Projectiles/SandstormBullet.cs new file mode 100644 index 0000000000..5a4aaf2c49 --- /dev/null +++ b/Projectiles/SandstormBullet.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SandstormBullet.png b/Projectiles/SandstormBullet.png new file mode 100644 index 0000000000..2392a80f7b Binary files /dev/null and b/Projectiles/SandstormBullet.png differ diff --git a/Projectiles/SandyWaifu.cs b/Projectiles/SandyWaifu.cs new file mode 100644 index 0000000000..90d6af7164 --- /dev/null +++ b/Projectiles/SandyWaifu.cs @@ -0,0 +1,304 @@ +using System; +using System.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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SandyWaifu.png b/Projectiles/SandyWaifu.png new file mode 100644 index 0000000000..22e16e792d Binary files /dev/null and b/Projectiles/SandyWaifu.png differ diff --git a/Projectiles/SandyWaifuShark.cs b/Projectiles/SandyWaifuShark.cs new file mode 100644 index 0000000000..d3ee83bfa5 --- /dev/null +++ b/Projectiles/SandyWaifuShark.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SandyWaifuShark.png b/Projectiles/SandyWaifuShark.png new file mode 100644 index 0000000000..a2b91920ae Binary files /dev/null and b/Projectiles/SandyWaifuShark.png differ diff --git a/Projectiles/SanguineFlare.cs b/Projectiles/SanguineFlare.cs new file mode 100644 index 0000000000..6fc6320850 --- /dev/null +++ b/Projectiles/SanguineFlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SanguineFlare.png b/Projectiles/SanguineFlare.png new file mode 100644 index 0000000000..17f3a43676 Binary files /dev/null and b/Projectiles/SanguineFlare.png differ diff --git a/Projectiles/SausageMaker.cs b/Projectiles/SausageMaker.cs new file mode 100644 index 0000000000..b502d4bd7f --- /dev/null +++ b/Projectiles/SausageMaker.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/SausageMaker.png b/Projectiles/SausageMaker.png new file mode 100644 index 0000000000..9b9cfe145b Binary files /dev/null and b/Projectiles/SausageMaker.png differ diff --git a/Projectiles/ScourgeoftheCosmos.cs b/Projectiles/ScourgeoftheCosmos.cs new file mode 100644 index 0000000000..cefc3755b5 --- /dev/null +++ b/Projectiles/ScourgeoftheCosmos.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ScourgeoftheCosmos.png b/Projectiles/ScourgeoftheCosmos.png new file mode 100644 index 0000000000..ef44fee035 Binary files /dev/null and b/Projectiles/ScourgeoftheCosmos.png differ diff --git a/Projectiles/ScourgeoftheCosmosMini.cs b/Projectiles/ScourgeoftheCosmosMini.cs new file mode 100644 index 0000000000..dba0591091 --- /dev/null +++ b/Projectiles/ScourgeoftheCosmosMini.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ScourgeoftheCosmosMini.png b/Projectiles/ScourgeoftheCosmosMini.png new file mode 100644 index 0000000000..958b953c3f Binary files /dev/null and b/Projectiles/ScourgeoftheCosmosMini.png differ diff --git a/Projectiles/ScourgeoftheDesert.cs b/Projectiles/ScourgeoftheDesert.cs new file mode 100644 index 0000000000..50120d48a6 --- /dev/null +++ b/Projectiles/ScourgeoftheDesert.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ScourgeoftheDesert.png b/Projectiles/ScourgeoftheDesert.png new file mode 100644 index 0000000000..4bfd79d57b Binary files /dev/null and b/Projectiles/ScourgeoftheDesert.png differ diff --git a/Projectiles/SeaDragonRocket.cs b/Projectiles/SeaDragonRocket.cs new file mode 100644 index 0000000000..cbdd43a8f4 --- /dev/null +++ b/Projectiles/SeaDragonRocket.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SeaDragonRocket.png b/Projectiles/SeaDragonRocket.png new file mode 100644 index 0000000000..d653d4d1ac Binary files /dev/null and b/Projectiles/SeaDragonRocket.png differ diff --git a/Projectiles/Seashell.cs b/Projectiles/Seashell.cs new file mode 100644 index 0000000000..0a64a75cfa --- /dev/null +++ b/Projectiles/Seashell.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Seashell.png b/Projectiles/Seashell.png new file mode 100644 index 0000000000..736223850a Binary files /dev/null and b/Projectiles/Seashell.png differ diff --git a/Projectiles/SeashellBoomerangProjectile.cs b/Projectiles/SeashellBoomerangProjectile.cs new file mode 100644 index 0000000000..25d613f238 --- /dev/null +++ b/Projectiles/SeashellBoomerangProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SeashellBoomerangProjectile.png b/Projectiles/SeashellBoomerangProjectile.png new file mode 100644 index 0000000000..4e0fba13e0 Binary files /dev/null and b/Projectiles/SeashellBoomerangProjectile.png differ diff --git a/Projectiles/SeashellBoomerangProjectileMelee.cs b/Projectiles/SeashellBoomerangProjectileMelee.cs new file mode 100644 index 0000000000..f1be931bec --- /dev/null +++ b/Projectiles/SeashellBoomerangProjectileMelee.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SeashellBoomerangProjectileMelee.png b/Projectiles/SeashellBoomerangProjectileMelee.png new file mode 100644 index 0000000000..4e0fba13e0 Binary files /dev/null and b/Projectiles/SeashellBoomerangProjectileMelee.png differ diff --git a/Projectiles/ShadeFire.cs b/Projectiles/ShadeFire.cs new file mode 100644 index 0000000000..3e2f74cbe4 --- /dev/null +++ b/Projectiles/ShadeFire.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ShadeFire.png b/Projectiles/ShadeFire.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/ShadeFire.png differ diff --git a/Projectiles/ShadeNimbus.cs b/Projectiles/ShadeNimbus.cs new file mode 100644 index 0000000000..1a1f54abc2 --- /dev/null +++ b/Projectiles/ShadeNimbus.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/ShadeNimbus.png b/Projectiles/ShadeNimbus.png new file mode 100644 index 0000000000..8ed0e6e673 Binary files /dev/null and b/Projectiles/ShadeNimbus.png differ diff --git a/Projectiles/ShadeNimbusCloud.cs b/Projectiles/ShadeNimbusCloud.cs new file mode 100644 index 0000000000..7fc4f8c3ce --- /dev/null +++ b/Projectiles/ShadeNimbusCloud.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ShadeNimbusCloud.png b/Projectiles/ShadeNimbusCloud.png new file mode 100644 index 0000000000..f17fc547d8 Binary files /dev/null and b/Projectiles/ShadeNimbusCloud.png differ diff --git a/Projectiles/ShadecrystalProjectile.cs b/Projectiles/ShadecrystalProjectile.cs new file mode 100644 index 0000000000..5a15a5e0f4 --- /dev/null +++ b/Projectiles/ShadecrystalProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ShadecrystalProjectile.png b/Projectiles/ShadecrystalProjectile.png new file mode 100644 index 0000000000..ba1755a590 Binary files /dev/null and b/Projectiles/ShadecrystalProjectile.png differ diff --git a/Projectiles/Shaderain.cs b/Projectiles/Shaderain.cs new file mode 100644 index 0000000000..0245135f83 --- /dev/null +++ b/Projectiles/Shaderain.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shaderain.png b/Projectiles/Shaderain.png new file mode 100644 index 0000000000..56fa0aa8a6 Binary files /dev/null and b/Projectiles/Shaderain.png differ diff --git a/Projectiles/Shadowbolt.cs b/Projectiles/Shadowbolt.cs new file mode 100644 index 0000000000..bfcb6ee942 --- /dev/null +++ b/Projectiles/Shadowbolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Shadowbolt.png b/Projectiles/Shadowbolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Shadowbolt.png differ diff --git a/Projectiles/ShiftingSands.cs b/Projectiles/ShiftingSands.cs new file mode 100644 index 0000000000..5193231e7a --- /dev/null +++ b/Projectiles/ShiftingSands.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ShiftingSands.png b/Projectiles/ShiftingSands.png new file mode 100644 index 0000000000..35e95574f2 Binary files /dev/null and b/Projectiles/ShiftingSands.png differ diff --git a/Projectiles/ShimmersparkProjectile.cs b/Projectiles/ShimmersparkProjectile.cs new file mode 100644 index 0000000000..9ad18eb591 --- /dev/null +++ b/Projectiles/ShimmersparkProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ShimmersparkProjectile.png b/Projectiles/ShimmersparkProjectile.png new file mode 100644 index 0000000000..6ddf95e9bc Binary files /dev/null and b/Projectiles/ShimmersparkProjectile.png differ diff --git a/Projectiles/Shockblast.cs b/Projectiles/Shockblast.cs new file mode 100644 index 0000000000..f34587e257 --- /dev/null +++ b/Projectiles/Shockblast.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shockblast.png b/Projectiles/Shockblast.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Shockblast.png differ diff --git a/Projectiles/ShockblastRound.cs b/Projectiles/ShockblastRound.cs new file mode 100644 index 0000000000..617b07e315 --- /dev/null +++ b/Projectiles/ShockblastRound.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ShockblastRound.png b/Projectiles/ShockblastRound.png new file mode 100644 index 0000000000..d3b0fb3cc9 Binary files /dev/null and b/Projectiles/ShockblastRound.png differ diff --git a/Projectiles/ShortBeam.cs b/Projectiles/ShortBeam.cs new file mode 100644 index 0000000000..4c324244e6 --- /dev/null +++ b/Projectiles/ShortBeam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ShortBeam.png b/Projectiles/ShortBeam.png new file mode 100644 index 0000000000..0b18361b91 Binary files /dev/null and b/Projectiles/ShortBeam.png differ diff --git a/Projectiles/ShortNightBeam.cs b/Projectiles/ShortNightBeam.cs new file mode 100644 index 0000000000..50e4e86475 --- /dev/null +++ b/Projectiles/ShortNightBeam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/ShortNightBeam.png b/Projectiles/ShortNightBeam.png new file mode 100644 index 0000000000..c017728b00 Binary files /dev/null and b/Projectiles/ShortNightBeam.png differ diff --git a/Projectiles/ShortTerraBeam.cs b/Projectiles/ShortTerraBeam.cs new file mode 100644 index 0000000000..25d55effae --- /dev/null +++ b/Projectiles/ShortTerraBeam.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ShortTerraBeam.png b/Projectiles/ShortTerraBeam.png new file mode 100644 index 0000000000..290db187a0 Binary files /dev/null and b/Projectiles/ShortTerraBeam.png differ diff --git a/Projectiles/Shroom.cs b/Projectiles/Shroom.cs new file mode 100644 index 0000000000..a4ef1b545e --- /dev/null +++ b/Projectiles/Shroom.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shroom.png b/Projectiles/Shroom.png new file mode 100644 index 0000000000..a6cd029b87 Binary files /dev/null and b/Projectiles/Shroom.png differ diff --git a/Projectiles/Shroomling.png b/Projectiles/Shroomling.png new file mode 100644 index 0000000000..d9155ae927 Binary files /dev/null and b/Projectiles/Shroomling.png differ diff --git a/Projectiles/Sickness.cs b/Projectiles/Sickness.cs new file mode 100644 index 0000000000..f84ab596af --- /dev/null +++ b/Projectiles/Sickness.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Sickness.png b/Projectiles/Sickness.png new file mode 100644 index 0000000000..54ff224808 Binary files /dev/null and b/Projectiles/Sickness.png differ diff --git a/Projectiles/SicknessRound.cs b/Projectiles/SicknessRound.cs new file mode 100644 index 0000000000..d968ef05cb --- /dev/null +++ b/Projectiles/SicknessRound.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SicknessRound.png b/Projectiles/SicknessRound.png new file mode 100644 index 0000000000..d3b0fb3cc9 Binary files /dev/null and b/Projectiles/SicknessRound.png differ diff --git a/Projectiles/SicknessRound2.cs b/Projectiles/SicknessRound2.cs new file mode 100644 index 0000000000..9c208a7c9a --- /dev/null +++ b/Projectiles/SicknessRound2.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SicknessRound2.png b/Projectiles/SicknessRound2.png new file mode 100644 index 0000000000..d3b0fb3cc9 Binary files /dev/null and b/Projectiles/SicknessRound2.png differ diff --git a/Projectiles/SilvaCrystal.cs b/Projectiles/SilvaCrystal.cs new file mode 100644 index 0000000000..53d4df0bd9 --- /dev/null +++ b/Projectiles/SilvaCrystal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SilvaCrystal.png b/Projectiles/SilvaCrystal.png new file mode 100644 index 0000000000..f38a8b6b6d Binary files /dev/null and b/Projectiles/SilvaCrystal.png differ diff --git a/Projectiles/SilvaCrystalExplosion.cs b/Projectiles/SilvaCrystalExplosion.cs new file mode 100644 index 0000000000..cdf8e0a4d4 --- /dev/null +++ b/Projectiles/SilvaCrystalExplosion.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SilvaCrystalExplosion.png b/Projectiles/SilvaCrystalExplosion.png new file mode 100644 index 0000000000..0968156e79 Binary files /dev/null and b/Projectiles/SilvaCrystalExplosion.png differ diff --git a/Projectiles/SilvaOrb.cs b/Projectiles/SilvaOrb.cs new file mode 100644 index 0000000000..f3d8a06fad --- /dev/null +++ b/Projectiles/SilvaOrb.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SilvaOrb.png b/Projectiles/SilvaOrb.png new file mode 100644 index 0000000000..f47982519d Binary files /dev/null and b/Projectiles/SilvaOrb.png differ diff --git a/Projectiles/SirenLure.cs b/Projectiles/SirenLure.cs new file mode 100644 index 0000000000..8e5832997b --- /dev/null +++ b/Projectiles/SirenLure.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SirenLure.png b/Projectiles/SirenLure.png new file mode 100644 index 0000000000..7564564883 Binary files /dev/null and b/Projectiles/SirenLure.png differ diff --git a/Projectiles/SirenSongFriendly.cs b/Projectiles/SirenSongFriendly.cs new file mode 100644 index 0000000000..750cd33e23 --- /dev/null +++ b/Projectiles/SirenSongFriendly.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/SirenSongFriendly.png b/Projectiles/SirenSongFriendly.png new file mode 100644 index 0000000000..2d410bffb7 Binary files /dev/null and b/Projectiles/SirenSongFriendly.png differ diff --git a/Projectiles/SirenYoung.cs b/Projectiles/SirenYoung.cs new file mode 100644 index 0000000000..68275a95b4 --- /dev/null +++ b/Projectiles/SirenYoung.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SirenYoung.png b/Projectiles/SirenYoung.png new file mode 100644 index 0000000000..c75521c71b Binary files /dev/null and b/Projectiles/SirenYoung.png differ diff --git a/Projectiles/SirensSong.cs b/Projectiles/SirensSong.cs new file mode 100644 index 0000000000..c9714e56d6 --- /dev/null +++ b/Projectiles/SirensSong.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SirensSong.png b/Projectiles/SirensSong.png new file mode 100644 index 0000000000..2d410bffb7 Binary files /dev/null and b/Projectiles/SirensSong.png differ diff --git a/Projectiles/SkyFlare.cs b/Projectiles/SkyFlare.cs new file mode 100644 index 0000000000..e0a13e7f84 --- /dev/null +++ b/Projectiles/SkyFlare.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SkyFlare.png b/Projectiles/SkyFlare.png new file mode 100644 index 0000000000..e3b21436ca Binary files /dev/null and b/Projectiles/SkyFlare.png differ diff --git a/Projectiles/SkyFlareFriendly.cs b/Projectiles/SkyFlareFriendly.cs new file mode 100644 index 0000000000..b6b948a187 --- /dev/null +++ b/Projectiles/SkyFlareFriendly.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SkyFlareFriendly.png b/Projectiles/SkyFlareFriendly.png new file mode 100644 index 0000000000..e3b21436ca Binary files /dev/null and b/Projectiles/SkyFlareFriendly.png differ diff --git a/Projectiles/SlagRound.cs b/Projectiles/SlagRound.cs new file mode 100644 index 0000000000..e6b9d6e0b8 --- /dev/null +++ b/Projectiles/SlagRound.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SlagRound.png b/Projectiles/SlagRound.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/SlagRound.png differ diff --git a/Projectiles/SlashRound.cs b/Projectiles/SlashRound.cs new file mode 100644 index 0000000000..5c100d5a54 --- /dev/null +++ b/Projectiles/SlashRound.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SlashRound.png b/Projectiles/SlashRound.png new file mode 100644 index 0000000000..3f761a0306 Binary files /dev/null and b/Projectiles/SlashRound.png differ diff --git a/Projectiles/SlimeBolt.cs b/Projectiles/SlimeBolt.cs new file mode 100644 index 0000000000..2d10731510 --- /dev/null +++ b/Projectiles/SlimeBolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SlimeBolt.png b/Projectiles/SlimeBolt.png new file mode 100644 index 0000000000..f603916ffa Binary files /dev/null and b/Projectiles/SlimeBolt.png differ diff --git a/Projectiles/SlimeGod.cs b/Projectiles/SlimeGod.cs new file mode 100644 index 0000000000..c9ab2ae164 --- /dev/null +++ b/Projectiles/SlimeGod.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SlimeGod.png b/Projectiles/SlimeGod.png new file mode 100644 index 0000000000..70d4fe5869 Binary files /dev/null and b/Projectiles/SlimeGod.png differ diff --git a/Projectiles/SlimeGodAlt.cs b/Projectiles/SlimeGodAlt.cs new file mode 100644 index 0000000000..90013935c4 --- /dev/null +++ b/Projectiles/SlimeGodAlt.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SlimeGodAlt.png b/Projectiles/SlimeGodAlt.png new file mode 100644 index 0000000000..e4e1a4620f Binary files /dev/null and b/Projectiles/SlimeGodAlt.png differ diff --git a/Projectiles/Snowflake.cs b/Projectiles/Snowflake.cs new file mode 100644 index 0000000000..772ed9eb8e --- /dev/null +++ b/Projectiles/Snowflake.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/Snowflake.png b/Projectiles/Snowflake.png new file mode 100644 index 0000000000..ec834cdfa5 Binary files /dev/null and b/Projectiles/Snowflake.png differ diff --git a/Projectiles/SolarBeam.cs b/Projectiles/SolarBeam.cs new file mode 100644 index 0000000000..c00fcd3356 --- /dev/null +++ b/Projectiles/SolarBeam.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarBeam.png b/Projectiles/SolarBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/SolarBeam.png differ diff --git a/Projectiles/SolarBeam2.cs b/Projectiles/SolarBeam2.cs new file mode 100644 index 0000000000..74e41a7bac --- /dev/null +++ b/Projectiles/SolarBeam2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarBeam2.png b/Projectiles/SolarBeam2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/SolarBeam2.png differ diff --git a/Projectiles/SolarFlare.cs b/Projectiles/SolarFlare.cs new file mode 100644 index 0000000000..fc1d2f47ff --- /dev/null +++ b/Projectiles/SolarFlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarFlare.png b/Projectiles/SolarFlare.png new file mode 100644 index 0000000000..2fde137f0d Binary files /dev/null and b/Projectiles/SolarFlare.png differ diff --git a/Projectiles/SolarFlareYoyo.cs b/Projectiles/SolarFlareYoyo.cs new file mode 100644 index 0000000000..4c1ad2eae3 --- /dev/null +++ b/Projectiles/SolarFlareYoyo.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarFlareYoyo.png b/Projectiles/SolarFlareYoyo.png new file mode 100644 index 0000000000..f36d305459 Binary files /dev/null and b/Projectiles/SolarFlareYoyo.png differ diff --git a/Projectiles/SolarGod.cs b/Projectiles/SolarGod.cs new file mode 100644 index 0000000000..432d820128 --- /dev/null +++ b/Projectiles/SolarGod.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarGod.png b/Projectiles/SolarGod.png new file mode 100644 index 0000000000..6be1a06822 Binary files /dev/null and b/Projectiles/SolarGod.png differ diff --git a/Projectiles/SolarPixie.cs b/Projectiles/SolarPixie.cs new file mode 100644 index 0000000000..7bbccb2fe0 --- /dev/null +++ b/Projectiles/SolarPixie.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolarPixie.png b/Projectiles/SolarPixie.png new file mode 100644 index 0000000000..fcb995c6ca Binary files /dev/null and b/Projectiles/SolarPixie.png differ diff --git a/Projectiles/SolsticeBeam.cs b/Projectiles/SolsticeBeam.cs new file mode 100644 index 0000000000..9a213b4508 --- /dev/null +++ b/Projectiles/SolsticeBeam.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SolsticeBeam.png b/Projectiles/SolsticeBeam.png new file mode 100644 index 0000000000..384005119f Binary files /dev/null and b/Projectiles/SolsticeBeam.png differ diff --git a/Projectiles/SoulPiercer.cs b/Projectiles/SoulPiercer.cs new file mode 100644 index 0000000000..953c2b3dfd --- /dev/null +++ b/Projectiles/SoulPiercer.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SoulPiercer.png b/Projectiles/SoulPiercer.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/SoulPiercer.png differ diff --git a/Projectiles/SoulPiercerBolt.cs b/Projectiles/SoulPiercerBolt.cs new file mode 100644 index 0000000000..1fb200e2fa --- /dev/null +++ b/Projectiles/SoulPiercerBolt.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SoulPiercerBolt.png b/Projectiles/SoulPiercerBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/SoulPiercerBolt.png differ diff --git a/Projectiles/SoulPiercerOrb.cs b/Projectiles/SoulPiercerOrb.cs new file mode 100644 index 0000000000..570e112443 --- /dev/null +++ b/Projectiles/SoulPiercerOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SoulPiercerOrb.png b/Projectiles/SoulPiercerOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/SoulPiercerOrb.png differ diff --git a/Projectiles/SoulScythe.cs b/Projectiles/SoulScythe.cs new file mode 100644 index 0000000000..4fdbefff63 --- /dev/null +++ b/Projectiles/SoulScythe.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SoulScythe.png b/Projectiles/SoulScythe.png new file mode 100644 index 0000000000..360c6a671f Binary files /dev/null and b/Projectiles/SoulScythe.png differ diff --git a/Projectiles/Spark.cs b/Projectiles/Spark.cs new file mode 100644 index 0000000000..7867bf8101 --- /dev/null +++ b/Projectiles/Spark.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Spark.png b/Projectiles/Spark.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/Spark.png differ diff --git a/Projectiles/SparkInfernal.cs b/Projectiles/SparkInfernal.cs new file mode 100644 index 0000000000..21d960b6a8 --- /dev/null +++ b/Projectiles/SparkInfernal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SparkInfernal.png b/Projectiles/SparkInfernal.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/SparkInfernal.png differ diff --git a/Projectiles/SpatialLanceProjectile.cs b/Projectiles/SpatialLanceProjectile.cs new file mode 100644 index 0000000000..c40ef17c32 --- /dev/null +++ b/Projectiles/SpatialLanceProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SpatialLanceProjectile.png b/Projectiles/SpatialLanceProjectile.png new file mode 100644 index 0000000000..254188b871 Binary files /dev/null and b/Projectiles/SpatialLanceProjectile.png differ diff --git a/Projectiles/SpatialSpear.cs b/Projectiles/SpatialSpear.cs new file mode 100644 index 0000000000..f6ae8e460c --- /dev/null +++ b/Projectiles/SpatialSpear.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SpatialSpear.png b/Projectiles/SpatialSpear.png new file mode 100644 index 0000000000..801c5a5103 Binary files /dev/null and b/Projectiles/SpatialSpear.png differ diff --git a/Projectiles/SpatialSpear2.cs b/Projectiles/SpatialSpear2.cs new file mode 100644 index 0000000000..3f7629faab --- /dev/null +++ b/Projectiles/SpatialSpear2.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SpatialSpear2.png b/Projectiles/SpatialSpear2.png new file mode 100644 index 0000000000..bc7b813f2e Binary files /dev/null and b/Projectiles/SpatialSpear2.png differ diff --git a/Projectiles/SpatialSpear3.cs b/Projectiles/SpatialSpear3.cs new file mode 100644 index 0000000000..6e44df2735 --- /dev/null +++ b/Projectiles/SpatialSpear3.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SpatialSpear3.png b/Projectiles/SpatialSpear3.png new file mode 100644 index 0000000000..eb635a32c2 Binary files /dev/null and b/Projectiles/SpatialSpear3.png differ diff --git a/Projectiles/SpatialSpear4.cs b/Projectiles/SpatialSpear4.cs new file mode 100644 index 0000000000..2880feecb5 --- /dev/null +++ b/Projectiles/SpatialSpear4.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SpatialSpear4.png b/Projectiles/SpatialSpear4.png new file mode 100644 index 0000000000..ff6fd499cd Binary files /dev/null and b/Projectiles/SpatialSpear4.png differ diff --git a/Projectiles/SpearofPaleolith.cs b/Projectiles/SpearofPaleolith.cs new file mode 100644 index 0000000000..c93d975550 --- /dev/null +++ b/Projectiles/SpearofPaleolith.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SpearofPaleolith.png b/Projectiles/SpearofPaleolith.png new file mode 100644 index 0000000000..e1b80c6db9 Binary files /dev/null and b/Projectiles/SpearofPaleolith.png differ diff --git a/Projectiles/SpiritFlameCurse.cs b/Projectiles/SpiritFlameCurse.cs new file mode 100644 index 0000000000..4b430d61ce --- /dev/null +++ b/Projectiles/SpiritFlameCurse.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SpiritFlameCurse.png b/Projectiles/SpiritFlameCurse.png new file mode 100644 index 0000000000..b622eda5c0 Binary files /dev/null and b/Projectiles/SpiritFlameCurse.png differ diff --git a/Projectiles/SporeBomb.cs b/Projectiles/SporeBomb.cs new file mode 100644 index 0000000000..dd76c4adda --- /dev/null +++ b/Projectiles/SporeBomb.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/SporeBomb.png b/Projectiles/SporeBomb.png new file mode 100644 index 0000000000..f47982519d Binary files /dev/null and b/Projectiles/SporeBomb.png differ diff --git a/Projectiles/Spyker.cs b/Projectiles/Spyker.cs new file mode 100644 index 0000000000..91a6011681 --- /dev/null +++ b/Projectiles/Spyker.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Spyker.png b/Projectiles/Spyker.png new file mode 100644 index 0000000000..e2368dcfcd Binary files /dev/null and b/Projectiles/Spyker.png differ diff --git a/Projectiles/StandingFire.cs b/Projectiles/StandingFire.cs new file mode 100644 index 0000000000..381ff9667e --- /dev/null +++ b/Projectiles/StandingFire.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/StandingFire.png b/Projectiles/StandingFire.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/StandingFire.png differ diff --git a/Projectiles/StarCrystal.cs b/Projectiles/StarCrystal.cs new file mode 100644 index 0000000000..eac3c4ec9e --- /dev/null +++ b/Projectiles/StarCrystal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/StarCrystal.png b/Projectiles/StarCrystal.png new file mode 100644 index 0000000000..1925db3c36 Binary files /dev/null and b/Projectiles/StarCrystal.png differ diff --git a/Projectiles/Starblast.cs b/Projectiles/Starblast.cs new file mode 100644 index 0000000000..e04c05e86d --- /dev/null +++ b/Projectiles/Starblast.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Starblast.png b/Projectiles/Starblast.png new file mode 100644 index 0000000000..741535f961 Binary files /dev/null and b/Projectiles/Starblast.png differ diff --git a/Projectiles/StarfleetMK2.cs b/Projectiles/StarfleetMK2.cs new file mode 100644 index 0000000000..59ece50642 --- /dev/null +++ b/Projectiles/StarfleetMK2.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/StarfleetMK2.png b/Projectiles/StarfleetMK2.png new file mode 100644 index 0000000000..f6a9035595 Binary files /dev/null and b/Projectiles/StarfleetMK2.png differ diff --git a/Projectiles/StarnightBeam.cs b/Projectiles/StarnightBeam.cs new file mode 100644 index 0000000000..497a25f6c7 --- /dev/null +++ b/Projectiles/StarnightBeam.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/StarnightBeam.png b/Projectiles/StarnightBeam.png new file mode 100644 index 0000000000..4ebcbc8d89 Binary files /dev/null and b/Projectiles/StarnightBeam.png differ diff --git a/Projectiles/StarnightLanceProjectile.cs b/Projectiles/StarnightLanceProjectile.cs new file mode 100644 index 0000000000..5c1c017b48 --- /dev/null +++ b/Projectiles/StarnightLanceProjectile.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 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/StarnightLanceProjectile.png b/Projectiles/StarnightLanceProjectile.png new file mode 100644 index 0000000000..88c7bec4a3 Binary files /dev/null and b/Projectiles/StarnightLanceProjectile.png differ diff --git a/Projectiles/StickyFeather.cs b/Projectiles/StickyFeather.cs new file mode 100644 index 0000000000..bfd4754bd3 --- /dev/null +++ b/Projectiles/StickyFeather.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/StickyFeather.png b/Projectiles/StickyFeather.png new file mode 100644 index 0000000000..58b2a6a94a Binary files /dev/null and b/Projectiles/StickyFeather.png differ diff --git a/Projectiles/StickyFeatherAero.cs b/Projectiles/StickyFeatherAero.cs new file mode 100644 index 0000000000..8967e0b8dd --- /dev/null +++ b/Projectiles/StickyFeatherAero.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/StickyFeatherAero.png b/Projectiles/StickyFeatherAero.png new file mode 100644 index 0000000000..58b2a6a94a Binary files /dev/null and b/Projectiles/StickyFeatherAero.png differ diff --git a/Projectiles/StormBeam.cs b/Projectiles/StormBeam.cs new file mode 100644 index 0000000000..8a7f353cb3 --- /dev/null +++ b/Projectiles/StormBeam.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/StormBeam.png b/Projectiles/StormBeam.png new file mode 100644 index 0000000000..a90c41c0ab Binary files /dev/null and b/Projectiles/StormBeam.png differ diff --git a/Projectiles/StormBolt.cs b/Projectiles/StormBolt.cs new file mode 100644 index 0000000000..9138162631 --- /dev/null +++ b/Projectiles/StormBolt.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/StormBolt.png b/Projectiles/StormBolt.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/StormBolt.png differ diff --git a/Projectiles/StormMark.cs b/Projectiles/StormMark.cs new file mode 100644 index 0000000000..a4b29c1a46 --- /dev/null +++ b/Projectiles/StormMark.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/StormMark.png b/Projectiles/StormMark.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/StormMark.png differ diff --git a/Projectiles/StormMarkHostile.cs b/Projectiles/StormMarkHostile.cs new file mode 100644 index 0000000000..c0aee8cbbe --- /dev/null +++ b/Projectiles/StormMarkHostile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/StormMarkHostile.png b/Projectiles/StormMarkHostile.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/StormMarkHostile.png differ diff --git a/Projectiles/StormMarkSummon.cs b/Projectiles/StormMarkSummon.cs new file mode 100644 index 0000000000..3c97524237 --- /dev/null +++ b/Projectiles/StormMarkSummon.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/StormMarkSummon.png b/Projectiles/StormMarkSummon.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/StormMarkSummon.png differ diff --git a/Projectiles/StormRuler.cs b/Projectiles/StormRuler.cs new file mode 100644 index 0000000000..7a1f3d6158 --- /dev/null +++ b/Projectiles/StormRuler.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/StormRuler.png b/Projectiles/StormRuler.png new file mode 100644 index 0000000000..d62ee6f72c Binary files /dev/null and b/Projectiles/StormRuler.png differ diff --git a/Projectiles/StormSurge.cs b/Projectiles/StormSurge.cs new file mode 100644 index 0000000000..f627bce999 --- /dev/null +++ b/Projectiles/StormSurge.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/StormSurge.png b/Projectiles/StormSurge.png new file mode 100644 index 0000000000..c3b106595a Binary files /dev/null and b/Projectiles/StormSurge.png differ diff --git a/Projectiles/StreamGouge.cs b/Projectiles/StreamGouge.cs new file mode 100644 index 0000000000..d16b1d7ce1 --- /dev/null +++ b/Projectiles/StreamGouge.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 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/StreamGouge.png b/Projectiles/StreamGouge.png new file mode 100644 index 0000000000..ead1091ae3 Binary files /dev/null and b/Projectiles/StreamGouge.png differ diff --git a/Projectiles/SulphuricAcidCannon.cs b/Projectiles/SulphuricAcidCannon.cs new file mode 100644 index 0000000000..82e1780ff2 --- /dev/null +++ b/Projectiles/SulphuricAcidCannon.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SulphuricAcidCannon.png b/Projectiles/SulphuricAcidCannon.png new file mode 100644 index 0000000000..ce648b6fdf Binary files /dev/null and b/Projectiles/SulphuricAcidCannon.png differ diff --git a/Projectiles/SulphuricAcidCannon2.cs b/Projectiles/SulphuricAcidCannon2.cs new file mode 100644 index 0000000000..5f5c784d76 --- /dev/null +++ b/Projectiles/SulphuricAcidCannon2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SulphuricAcidCannon2.png b/Projectiles/SulphuricAcidCannon2.png new file mode 100644 index 0000000000..ce648b6fdf Binary files /dev/null and b/Projectiles/SulphuricAcidCannon2.png differ diff --git a/Projectiles/SulphuricAcidMist.cs b/Projectiles/SulphuricAcidMist.cs new file mode 100644 index 0000000000..ad84893b17 --- /dev/null +++ b/Projectiles/SulphuricAcidMist.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SulphuricAcidMist.png b/Projectiles/SulphuricAcidMist.png new file mode 100644 index 0000000000..ef3dd2b17d Binary files /dev/null and b/Projectiles/SulphuricAcidMist.png differ diff --git a/Projectiles/SulphuricAcidMist2.cs b/Projectiles/SulphuricAcidMist2.cs new file mode 100644 index 0000000000..199f51ceb1 --- /dev/null +++ b/Projectiles/SulphuricAcidMist2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/SulphuricAcidMist2.png b/Projectiles/SulphuricAcidMist2.png new file mode 100644 index 0000000000..ef3dd2b17d Binary files /dev/null and b/Projectiles/SulphuricAcidMist2.png differ diff --git a/Projectiles/SunlightBlade.cs b/Projectiles/SunlightBlade.cs new file mode 100644 index 0000000000..8f1ceba901 --- /dev/null +++ b/Projectiles/SunlightBlade.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/SunlightBlade.png b/Projectiles/SunlightBlade.png new file mode 100644 index 0000000000..6b995980e5 Binary files /dev/null and b/Projectiles/SunlightBlade.png differ diff --git a/Projectiles/SuperballBullet.cs b/Projectiles/SuperballBullet.cs new file mode 100644 index 0000000000..7cda9ec0b9 --- /dev/null +++ b/Projectiles/SuperballBullet.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SuperballBullet.png b/Projectiles/SuperballBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/SuperballBullet.png differ diff --git a/Projectiles/SupremeDustFlakProjectile.cs b/Projectiles/SupremeDustFlakProjectile.cs new file mode 100644 index 0000000000..f2f1c95ab9 --- /dev/null +++ b/Projectiles/SupremeDustFlakProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/SupremeDustFlakProjectile.png b/Projectiles/SupremeDustFlakProjectile.png new file mode 100644 index 0000000000..1018e8ebfd Binary files /dev/null and b/Projectiles/SupremeDustFlakProjectile.png differ diff --git a/Projectiles/SupremeDustProjectile.cs b/Projectiles/SupremeDustProjectile.cs new file mode 100644 index 0000000000..596b7d6035 --- /dev/null +++ b/Projectiles/SupremeDustProjectile.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/SupremeDustProjectile.png b/Projectiles/SupremeDustProjectile.png new file mode 100644 index 0000000000..4e6de362b3 Binary files /dev/null and b/Projectiles/SupremeDustProjectile.png differ diff --git a/Projectiles/T1000.cs b/Projectiles/T1000.cs new file mode 100644 index 0000000000..10b2589c27 --- /dev/null +++ b/Projectiles/T1000.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Projectiles/T1000.png b/Projectiles/T1000.png new file mode 100644 index 0000000000..755334ced5 Binary files /dev/null and b/Projectiles/T1000.png differ diff --git a/Projectiles/T1000Laser.cs b/Projectiles/T1000Laser.cs new file mode 100644 index 0000000000..b3b150cb57 --- /dev/null +++ b/Projectiles/T1000Laser.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/T1000Laser.png b/Projectiles/T1000Laser.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/T1000Laser.png differ diff --git a/Projectiles/TarraEnergy.cs b/Projectiles/TarraEnergy.cs new file mode 100644 index 0000000000..54b203540f --- /dev/null +++ b/Projectiles/TarraEnergy.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TarraEnergy.png b/Projectiles/TarraEnergy.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TarraEnergy.png differ diff --git a/Projectiles/TarragonThrowingDartProjectile.cs b/Projectiles/TarragonThrowingDartProjectile.cs new file mode 100644 index 0000000000..f436d27097 --- /dev/null +++ b/Projectiles/TarragonThrowingDartProjectile.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 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/TarragonThrowingDartProjectile.png b/Projectiles/TarragonThrowingDartProjectile.png new file mode 100644 index 0000000000..dd05cffad4 Binary files /dev/null and b/Projectiles/TarragonThrowingDartProjectile.png differ diff --git a/Projectiles/TealExoArrow.cs b/Projectiles/TealExoArrow.cs new file mode 100644 index 0000000000..91998b1f27 --- /dev/null +++ b/Projectiles/TealExoArrow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TealExoArrow.png b/Projectiles/TealExoArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/TealExoArrow.png differ diff --git a/Projectiles/TearsofHeavenProjectile.cs b/Projectiles/TearsofHeavenProjectile.cs new file mode 100644 index 0000000000..280fd36494 --- /dev/null +++ b/Projectiles/TearsofHeavenProjectile.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TearsofHeavenProjectile.png b/Projectiles/TearsofHeavenProjectile.png new file mode 100644 index 0000000000..73adbb5af7 Binary files /dev/null and b/Projectiles/TearsofHeavenProjectile.png differ diff --git a/Projectiles/TelluricGlare.cs b/Projectiles/TelluricGlare.cs new file mode 100644 index 0000000000..8be3035d7a --- /dev/null +++ b/Projectiles/TelluricGlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TelluricGlare.png b/Projectiles/TelluricGlare.png new file mode 100644 index 0000000000..9aab0bf1d7 Binary files /dev/null and b/Projectiles/TelluricGlare.png differ diff --git a/Projectiles/TemporalFloeSwordProjectile.cs b/Projectiles/TemporalFloeSwordProjectile.cs new file mode 100644 index 0000000000..92f00c148b --- /dev/null +++ b/Projectiles/TemporalFloeSwordProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TemporalFloeSwordProjectile.png b/Projectiles/TemporalFloeSwordProjectile.png new file mode 100644 index 0000000000..085638063a Binary files /dev/null and b/Projectiles/TemporalFloeSwordProjectile.png differ diff --git a/Projectiles/TerraArrow.cs b/Projectiles/TerraArrow.cs new file mode 100644 index 0000000000..5645317dcb --- /dev/null +++ b/Projectiles/TerraArrow.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraArrow.png b/Projectiles/TerraArrow.png new file mode 100644 index 0000000000..7f57db8ffc Binary files /dev/null and b/Projectiles/TerraArrow.png differ diff --git a/Projectiles/TerraArrow2.cs b/Projectiles/TerraArrow2.cs new file mode 100644 index 0000000000..bc0205ade9 --- /dev/null +++ b/Projectiles/TerraArrow2.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraArrow2.png b/Projectiles/TerraArrow2.png new file mode 100644 index 0000000000..7f57db8ffc Binary files /dev/null and b/Projectiles/TerraArrow2.png differ diff --git a/Projectiles/TerraBall.cs b/Projectiles/TerraBall.cs new file mode 100644 index 0000000000..d21b30d119 --- /dev/null +++ b/Projectiles/TerraBall.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 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/TerraBall.png b/Projectiles/TerraBall.png new file mode 100644 index 0000000000..139ef2e822 Binary files /dev/null and b/Projectiles/TerraBall.png differ diff --git a/Projectiles/TerraBallB.cs b/Projectiles/TerraBallB.cs new file mode 100644 index 0000000000..6c91ef6ac2 --- /dev/null +++ b/Projectiles/TerraBallB.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallB.png b/Projectiles/TerraBallB.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallB.png differ diff --git a/Projectiles/TerraBallG.cs b/Projectiles/TerraBallG.cs new file mode 100644 index 0000000000..b88514dc15 --- /dev/null +++ b/Projectiles/TerraBallG.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallG.png b/Projectiles/TerraBallG.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallG.png differ diff --git a/Projectiles/TerraBallI.cs b/Projectiles/TerraBallI.cs new file mode 100644 index 0000000000..0353980fb7 --- /dev/null +++ b/Projectiles/TerraBallI.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallI.png b/Projectiles/TerraBallI.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallI.png differ diff --git a/Projectiles/TerraBallO.cs b/Projectiles/TerraBallO.cs new file mode 100644 index 0000000000..9714498867 --- /dev/null +++ b/Projectiles/TerraBallO.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallO.png b/Projectiles/TerraBallO.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallO.png differ diff --git a/Projectiles/TerraBallR.cs b/Projectiles/TerraBallR.cs new file mode 100644 index 0000000000..3450f6232d --- /dev/null +++ b/Projectiles/TerraBallR.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallR.png b/Projectiles/TerraBallR.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallR.png differ diff --git a/Projectiles/TerraBallV.cs b/Projectiles/TerraBallV.cs new file mode 100644 index 0000000000..e451669f6f --- /dev/null +++ b/Projectiles/TerraBallV.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallV.png b/Projectiles/TerraBallV.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallV.png differ diff --git a/Projectiles/TerraBallY.cs b/Projectiles/TerraBallY.cs new file mode 100644 index 0000000000..672c4186f9 --- /dev/null +++ b/Projectiles/TerraBallY.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBallY.png b/Projectiles/TerraBallY.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBallY.png differ diff --git a/Projectiles/TerraBolt.cs b/Projectiles/TerraBolt.cs new file mode 100644 index 0000000000..04f4badd81 --- /dev/null +++ b/Projectiles/TerraBolt.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBolt.png b/Projectiles/TerraBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/TerraBolt.png differ diff --git a/Projectiles/TerraBolt2.cs b/Projectiles/TerraBolt2.cs new file mode 100644 index 0000000000..d25278c003 --- /dev/null +++ b/Projectiles/TerraBolt2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBolt2.png b/Projectiles/TerraBolt2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/TerraBolt2.png differ diff --git a/Projectiles/TerraBullet.cs b/Projectiles/TerraBullet.cs new file mode 100644 index 0000000000..cc2c0b4a88 --- /dev/null +++ b/Projectiles/TerraBullet.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBullet.png b/Projectiles/TerraBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBullet.png differ diff --git a/Projectiles/TerraBulletSplit.cs b/Projectiles/TerraBulletSplit.cs new file mode 100644 index 0000000000..3905c6fdd0 --- /dev/null +++ b/Projectiles/TerraBulletSplit.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraBulletSplit.png b/Projectiles/TerraBulletSplit.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TerraBulletSplit.png differ diff --git a/Projectiles/TerraEdgeBeam.cs b/Projectiles/TerraEdgeBeam.cs new file mode 100644 index 0000000000..00c05d4d66 --- /dev/null +++ b/Projectiles/TerraEdgeBeam.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TerraEdgeBeam.png b/Projectiles/TerraEdgeBeam.png new file mode 100644 index 0000000000..af966e4ddf Binary files /dev/null and b/Projectiles/TerraEdgeBeam.png differ diff --git a/Projectiles/TerraFireBlue.cs b/Projectiles/TerraFireBlue.cs new file mode 100644 index 0000000000..296c69cb0c --- /dev/null +++ b/Projectiles/TerraFireBlue.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TerraFireBlue.png b/Projectiles/TerraFireBlue.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/TerraFireBlue.png differ diff --git a/Projectiles/TerraFireGreen.cs b/Projectiles/TerraFireGreen.cs new file mode 100644 index 0000000000..90d84e4422 --- /dev/null +++ b/Projectiles/TerraFireGreen.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraFireGreen.png b/Projectiles/TerraFireGreen.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/TerraFireGreen.png differ diff --git a/Projectiles/TerraFireGreen2.cs b/Projectiles/TerraFireGreen2.cs new file mode 100644 index 0000000000..8f594ee7d7 --- /dev/null +++ b/Projectiles/TerraFireGreen2.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TerraFireGreen2.png b/Projectiles/TerraFireGreen2.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/TerraFireGreen2.png differ diff --git a/Projectiles/TerraFireRed.cs b/Projectiles/TerraFireRed.cs new file mode 100644 index 0000000000..4c087c0080 --- /dev/null +++ b/Projectiles/TerraFireRed.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TerraFireRed.png b/Projectiles/TerraFireRed.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/TerraFireRed.png differ diff --git a/Projectiles/TerraLanceProjectile.cs b/Projectiles/TerraLanceProjectile.cs new file mode 100644 index 0000000000..70611da6fa --- /dev/null +++ b/Projectiles/TerraLanceProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraLanceProjectile.png b/Projectiles/TerraLanceProjectile.png new file mode 100644 index 0000000000..86ea6e5004 Binary files /dev/null and b/Projectiles/TerraLanceProjectile.png differ diff --git a/Projectiles/TerraOrb.cs b/Projectiles/TerraOrb.cs new file mode 100644 index 0000000000..baa4325cb2 --- /dev/null +++ b/Projectiles/TerraOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraOrb.png b/Projectiles/TerraOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/TerraOrb.png differ diff --git a/Projectiles/TerraOrb2.cs b/Projectiles/TerraOrb2.cs new file mode 100644 index 0000000000..82c912ae00 --- /dev/null +++ b/Projectiles/TerraOrb2.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraOrb2.png b/Projectiles/TerraOrb2.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/TerraOrb2.png differ diff --git a/Projectiles/TerraRay.cs b/Projectiles/TerraRay.cs new file mode 100644 index 0000000000..54a05386a4 --- /dev/null +++ b/Projectiles/TerraRay.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraRay.png b/Projectiles/TerraRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/TerraRay.png differ diff --git a/Projectiles/TerraSpear.cs b/Projectiles/TerraSpear.cs new file mode 100644 index 0000000000..d6cee919f3 --- /dev/null +++ b/Projectiles/TerraSpear.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TerraSpear.png b/Projectiles/TerraSpear.png new file mode 100644 index 0000000000..498f350a4e Binary files /dev/null and b/Projectiles/TerraSpear.png differ diff --git a/Projectiles/Terracotta.cs b/Projectiles/Terracotta.cs new file mode 100644 index 0000000000..eeeb2d9502 --- /dev/null +++ b/Projectiles/Terracotta.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Terracotta.png b/Projectiles/Terracotta.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Terracotta.png differ diff --git a/Projectiles/TerracottaExplosion.cs b/Projectiles/TerracottaExplosion.cs new file mode 100644 index 0000000000..71814f096a --- /dev/null +++ b/Projectiles/TerracottaExplosion.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TerracottaExplosion.png b/Projectiles/TerracottaExplosion.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/TerracottaExplosion.png differ diff --git a/Projectiles/TerratomereProjectile.cs b/Projectiles/TerratomereProjectile.cs new file mode 100644 index 0000000000..add56ce014 --- /dev/null +++ b/Projectiles/TerratomereProjectile.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TerratomereProjectile.png b/Projectiles/TerratomereProjectile.png new file mode 100644 index 0000000000..8c86b00b20 Binary files /dev/null and b/Projectiles/TerratomereProjectile.png differ diff --git a/Projectiles/TerrorBeam.cs b/Projectiles/TerrorBeam.cs new file mode 100644 index 0000000000..59c21eed70 --- /dev/null +++ b/Projectiles/TerrorBeam.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerrorBeam.png b/Projectiles/TerrorBeam.png new file mode 100644 index 0000000000..6033712f0c Binary files /dev/null and b/Projectiles/TerrorBeam.png differ diff --git a/Projectiles/TerrorBoom.cs b/Projectiles/TerrorBoom.cs new file mode 100644 index 0000000000..4a52a382f3 --- /dev/null +++ b/Projectiles/TerrorBoom.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/TerrorBoom.png b/Projectiles/TerrorBoom.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/TerrorBoom.png differ diff --git a/Projectiles/TheDeadlyMicrobeProjectile.png b/Projectiles/TheDeadlyMicrobeProjectile.png new file mode 100644 index 0000000000..a2b8875ded Binary files /dev/null and b/Projectiles/TheDeadlyMicrobeProjectile.png differ diff --git a/Projectiles/TheEyeofCalamitasProjectile.cs b/Projectiles/TheEyeofCalamitasProjectile.cs new file mode 100644 index 0000000000..28145c5307 --- /dev/null +++ b/Projectiles/TheEyeofCalamitasProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TheEyeofCalamitasProjectile.png b/Projectiles/TheEyeofCalamitasProjectile.png new file mode 100644 index 0000000000..93ab753467 Binary files /dev/null and b/Projectiles/TheEyeofCalamitasProjectile.png differ diff --git a/Projectiles/TheGodsGambitProjectile.cs b/Projectiles/TheGodsGambitProjectile.cs new file mode 100644 index 0000000000..2ee8d5d421 --- /dev/null +++ b/Projectiles/TheGodsGambitProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TheGodsGambitProjectile.png b/Projectiles/TheGodsGambitProjectile.png new file mode 100644 index 0000000000..64bc4036d6 Binary files /dev/null and b/Projectiles/TheGodsGambitProjectile.png differ diff --git a/Projectiles/TheObliterator.cs b/Projectiles/TheObliterator.cs new file mode 100644 index 0000000000..e4d87c02c1 --- /dev/null +++ b/Projectiles/TheObliterator.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TheObliterator.png b/Projectiles/TheObliterator.png new file mode 100644 index 0000000000..357e5630d7 Binary files /dev/null and b/Projectiles/TheObliterator.png differ diff --git a/Projectiles/ThePlaguebringer.cs b/Projectiles/ThePlaguebringer.cs new file mode 100644 index 0000000000..a924006b6c --- /dev/null +++ b/Projectiles/ThePlaguebringer.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/ThePlaguebringer.png b/Projectiles/ThePlaguebringer.png new file mode 100644 index 0000000000..41afa12446 Binary files /dev/null and b/Projectiles/ThePlaguebringer.png differ diff --git a/Projectiles/TinyCrystal.cs b/Projectiles/TinyCrystal.cs new file mode 100644 index 0000000000..5a8baf1ec9 --- /dev/null +++ b/Projectiles/TinyCrystal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TinyCrystal.png b/Projectiles/TinyCrystal.png new file mode 100644 index 0000000000..8e19554cda Binary files /dev/null and b/Projectiles/TinyCrystal.png differ diff --git a/Projectiles/TinyFlare.cs b/Projectiles/TinyFlare.cs new file mode 100644 index 0000000000..6ebd640b1b --- /dev/null +++ b/Projectiles/TinyFlare.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/TinyFlare.png b/Projectiles/TinyFlare.png new file mode 100644 index 0000000000..1901e3c50d Binary files /dev/null and b/Projectiles/TinyFlare.png differ diff --git a/Projectiles/TitRail.cs b/Projectiles/TitRail.cs new file mode 100644 index 0000000000..21271eda9f --- /dev/null +++ b/Projectiles/TitRail.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TitRail.png b/Projectiles/TitRail.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/TitRail.png differ diff --git a/Projectiles/TitaniumShurikenProjectile.cs b/Projectiles/TitaniumShurikenProjectile.cs new file mode 100644 index 0000000000..d63c624e36 --- /dev/null +++ b/Projectiles/TitaniumShurikenProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TitaniumShurikenProjectile.png b/Projectiles/TitaniumShurikenProjectile.png new file mode 100644 index 0000000000..e3f185f3c3 Binary files /dev/null and b/Projectiles/TitaniumShurikenProjectile.png differ diff --git a/Projectiles/ToothBallProjectile.cs b/Projectiles/ToothBallProjectile.cs new file mode 100644 index 0000000000..2ba1f0b5d2 --- /dev/null +++ b/Projectiles/ToothBallProjectile.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/ToothBallProjectile.png b/Projectiles/ToothBallProjectile.png new file mode 100644 index 0000000000..c5c248dd8f Binary files /dev/null and b/Projectiles/ToothBallProjectile.png differ diff --git a/Projectiles/Tornado.cs b/Projectiles/Tornado.cs new file mode 100644 index 0000000000..2edc2b2a3c --- /dev/null +++ b/Projectiles/Tornado.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Tornado.png b/Projectiles/Tornado.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/Tornado.png differ diff --git a/Projectiles/TornadoHostile.cs b/Projectiles/TornadoHostile.cs new file mode 100644 index 0000000000..f74b91b311 --- /dev/null +++ b/Projectiles/TornadoHostile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TornadoHostile.png b/Projectiles/TornadoHostile.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/TornadoHostile.png differ diff --git a/Projectiles/TorrentialArrow.cs b/Projectiles/TorrentialArrow.cs new file mode 100644 index 0000000000..ba425739fa --- /dev/null +++ b/Projectiles/TorrentialArrow.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TorrentialArrow.png b/Projectiles/TorrentialArrow.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/TorrentialArrow.png differ diff --git a/Projectiles/ToxicMinnowCloud.cs b/Projectiles/ToxicMinnowCloud.cs new file mode 100644 index 0000000000..55ada1de09 --- /dev/null +++ b/Projectiles/ToxicMinnowCloud.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/ToxicMinnowCloud.png b/Projectiles/ToxicMinnowCloud.png new file mode 100644 index 0000000000..aafab6fe58 Binary files /dev/null and b/Projectiles/ToxicMinnowCloud.png differ diff --git a/Projectiles/TradewindsProjectile.cs b/Projectiles/TradewindsProjectile.cs new file mode 100644 index 0000000000..9a9cb780f1 --- /dev/null +++ b/Projectiles/TradewindsProjectile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TradewindsProjectile.png b/Projectiles/TradewindsProjectile.png new file mode 100644 index 0000000000..61b3ecd36c Binary files /dev/null and b/Projectiles/TradewindsProjectile.png differ diff --git a/Projectiles/TransfusionTrail.cs b/Projectiles/TransfusionTrail.cs new file mode 100644 index 0000000000..5c4ef3a141 --- /dev/null +++ b/Projectiles/TransfusionTrail.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TransfusionTrail.png b/Projectiles/TransfusionTrail.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/TransfusionTrail.png differ diff --git a/Projectiles/TriactisOPHammer.cs b/Projectiles/TriactisOPHammer.cs new file mode 100644 index 0000000000..5cd9320231 --- /dev/null +++ b/Projectiles/TriactisOPHammer.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TriactisOPHammer.png b/Projectiles/TriactisOPHammer.png new file mode 100644 index 0000000000..3f86fa3c6d Binary files /dev/null and b/Projectiles/TriactisOPHammer.png differ diff --git a/Projectiles/TriactisOPHammerMelee.cs b/Projectiles/TriactisOPHammerMelee.cs new file mode 100644 index 0000000000..7256e4d176 --- /dev/null +++ b/Projectiles/TriactisOPHammerMelee.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TriactisOPHammerMelee.png b/Projectiles/TriactisOPHammerMelee.png new file mode 100644 index 0000000000..3f86fa3c6d Binary files /dev/null and b/Projectiles/TriactisOPHammerMelee.png differ diff --git a/Projectiles/Triploon.cs b/Projectiles/Triploon.cs new file mode 100644 index 0000000000..8dd88676c8 --- /dev/null +++ b/Projectiles/Triploon.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Triploon.png b/Projectiles/Triploon.png new file mode 100644 index 0000000000..e3cad757f3 Binary files /dev/null and b/Projectiles/Triploon.png differ diff --git a/Projectiles/TrueBattleSpawn.cs b/Projectiles/TrueBattleSpawn.cs new file mode 100644 index 0000000000..ca4272765f --- /dev/null +++ b/Projectiles/TrueBattleSpawn.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TrueBattleSpawn.png b/Projectiles/TrueBattleSpawn.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/TrueBattleSpawn.png differ diff --git a/Projectiles/TrueBiomeOrb.cs b/Projectiles/TrueBiomeOrb.cs new file mode 100644 index 0000000000..27dd4a0c89 --- /dev/null +++ b/Projectiles/TrueBiomeOrb.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/TrueBiomeOrb.png b/Projectiles/TrueBiomeOrb.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/TrueBiomeOrb.png differ diff --git a/Projectiles/TrueCausticEdgeProjectile.cs b/Projectiles/TrueCausticEdgeProjectile.cs new file mode 100644 index 0000000000..c51859e694 --- /dev/null +++ b/Projectiles/TrueCausticEdgeProjectile.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TrueCausticEdgeProjectile.png b/Projectiles/TrueCausticEdgeProjectile.png new file mode 100644 index 0000000000..d10c891c7a Binary files /dev/null and b/Projectiles/TrueCausticEdgeProjectile.png differ diff --git a/Projectiles/Tumbleweed.cs b/Projectiles/Tumbleweed.cs new file mode 100644 index 0000000000..867431a888 --- /dev/null +++ b/Projectiles/Tumbleweed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Tumbleweed.png b/Projectiles/Tumbleweed.png new file mode 100644 index 0000000000..5d7925fa85 Binary files /dev/null and b/Projectiles/Tumbleweed.png differ diff --git a/Projectiles/TumbleweedRolling.cs b/Projectiles/TumbleweedRolling.cs new file mode 100644 index 0000000000..8153e3caba --- /dev/null +++ b/Projectiles/TumbleweedRolling.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TumbleweedRolling.png b/Projectiles/TumbleweedRolling.png new file mode 100644 index 0000000000..5d7925fa85 Binary files /dev/null and b/Projectiles/TumbleweedRolling.png differ diff --git a/Projectiles/TyphonsGreed.cs b/Projectiles/TyphonsGreed.cs new file mode 100644 index 0000000000..2391957933 --- /dev/null +++ b/Projectiles/TyphonsGreed.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/TyphonsGreed.png b/Projectiles/TyphonsGreed.png new file mode 100644 index 0000000000..e4e8f2d460 Binary files /dev/null and b/Projectiles/TyphonsGreed.png differ diff --git a/Projectiles/TyphonsGreedStaff.cs b/Projectiles/TyphonsGreedStaff.cs new file mode 100644 index 0000000000..45c66e61f7 --- /dev/null +++ b/Projectiles/TyphonsGreedStaff.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/TyphonsGreedStaff.png b/Projectiles/TyphonsGreedStaff.png new file mode 100644 index 0000000000..5704b3ca99 Binary files /dev/null and b/Projectiles/TyphonsGreedStaff.png differ diff --git a/Projectiles/TyphoonArrow.cs b/Projectiles/TyphoonArrow.cs new file mode 100644 index 0000000000..05d6429b39 --- /dev/null +++ b/Projectiles/TyphoonArrow.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TyphoonArrow.png b/Projectiles/TyphoonArrow.png new file mode 100644 index 0000000000..b7295645a5 Binary files /dev/null and b/Projectiles/TyphoonArrow.png differ diff --git a/Projectiles/TyphoonBubble.cs b/Projectiles/TyphoonBubble.cs new file mode 100644 index 0000000000..dcece716b7 --- /dev/null +++ b/Projectiles/TyphoonBubble.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/TyphoonBubble.png b/Projectiles/TyphoonBubble.png new file mode 100644 index 0000000000..90a422dbd8 Binary files /dev/null and b/Projectiles/TyphoonBubble.png differ diff --git a/Projectiles/UHFMurasama.png b/Projectiles/UHFMurasama.png new file mode 100644 index 0000000000..26800e8920 Binary files /dev/null and b/Projectiles/UHFMurasama.png differ diff --git a/Projectiles/UberBubble.cs b/Projectiles/UberBubble.cs new file mode 100644 index 0000000000..e8e236f120 --- /dev/null +++ b/Projectiles/UberBubble.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/UberBubble.png b/Projectiles/UberBubble.png new file mode 100644 index 0000000000..9810496aef Binary files /dev/null and b/Projectiles/UberBubble.png differ diff --git a/Projectiles/UndinesRetribution.cs b/Projectiles/UndinesRetribution.cs new file mode 100644 index 0000000000..4672484550 --- /dev/null +++ b/Projectiles/UndinesRetribution.cs @@ -0,0 +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(); + } + } +} \ No newline at end of file diff --git a/Projectiles/UndinesRetribution.png b/Projectiles/UndinesRetribution.png new file mode 100644 index 0000000000..3f335cf434 Binary files /dev/null and b/Projectiles/UndinesRetribution.png differ diff --git a/Projectiles/Urchin.cs b/Projectiles/Urchin.cs new file mode 100644 index 0000000000..b4c95c1462 --- /dev/null +++ b/Projectiles/Urchin.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Urchin.png b/Projectiles/Urchin.png new file mode 100644 index 0000000000..d9f072c4f9 Binary files /dev/null and b/Projectiles/Urchin.png differ diff --git a/Projectiles/UrchinSpearProjectile.cs b/Projectiles/UrchinSpearProjectile.cs new file mode 100644 index 0000000000..735d848207 --- /dev/null +++ b/Projectiles/UrchinSpearProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/UrchinSpearProjectile.png b/Projectiles/UrchinSpearProjectile.png new file mode 100644 index 0000000000..2436b8e48d Binary files /dev/null and b/Projectiles/UrchinSpearProjectile.png differ diff --git a/Projectiles/UrchinSpike.cs b/Projectiles/UrchinSpike.cs new file mode 100644 index 0000000000..16e5e048b4 --- /dev/null +++ b/Projectiles/UrchinSpike.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/UrchinSpike.png b/Projectiles/UrchinSpike.png new file mode 100644 index 0000000000..0d8e8c9ebf Binary files /dev/null and b/Projectiles/UrchinSpike.png differ diff --git a/Projectiles/UrchinSpikeFugu.cs b/Projectiles/UrchinSpikeFugu.cs new file mode 100644 index 0000000000..bb691868ab --- /dev/null +++ b/Projectiles/UrchinSpikeFugu.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/UrchinSpikeFugu.png b/Projectiles/UrchinSpikeFugu.png new file mode 100644 index 0000000000..0d8e8c9ebf Binary files /dev/null and b/Projectiles/UrchinSpikeFugu.png differ diff --git a/Projectiles/UrchinStinger.cs b/Projectiles/UrchinStinger.cs new file mode 100644 index 0000000000..8aee8fca09 --- /dev/null +++ b/Projectiles/UrchinStinger.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/UrchinStinger.png b/Projectiles/UrchinStinger.png new file mode 100644 index 0000000000..a5c38c11b9 Binary files /dev/null and b/Projectiles/UrchinStinger.png differ diff --git a/Projectiles/Valediction.cs b/Projectiles/Valediction.cs new file mode 100644 index 0000000000..77a435b0a9 --- /dev/null +++ b/Projectiles/Valediction.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Valediction.png b/Projectiles/Valediction.png new file mode 100644 index 0000000000..1c3cefaf35 Binary files /dev/null and b/Projectiles/Valediction.png differ diff --git a/Projectiles/Valkyrie.cs b/Projectiles/Valkyrie.cs new file mode 100644 index 0000000000..1b6f08dc00 --- /dev/null +++ b/Projectiles/Valkyrie.cs @@ -0,0 +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; + } + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Valkyrie.png b/Projectiles/Valkyrie.png new file mode 100644 index 0000000000..095fb07c95 Binary files /dev/null and b/Projectiles/Valkyrie.png differ diff --git a/Projectiles/VanquisherArrow.cs b/Projectiles/VanquisherArrow.cs new file mode 100644 index 0000000000..0d5fc033e2 --- /dev/null +++ b/Projectiles/VanquisherArrow.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/VanquisherArrow.png b/Projectiles/VanquisherArrow.png new file mode 100644 index 0000000000..b36e443e91 Binary files /dev/null and b/Projectiles/VanquisherArrow.png differ diff --git a/Projectiles/VanquisherArrow2.cs b/Projectiles/VanquisherArrow2.cs new file mode 100644 index 0000000000..9b1841334e --- /dev/null +++ b/Projectiles/VanquisherArrow2.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 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/VanquisherArrow2.png b/Projectiles/VanquisherArrow2.png new file mode 100644 index 0000000000..731c8458e1 Binary files /dev/null and b/Projectiles/VanquisherArrow2.png differ diff --git a/Projectiles/Vehemence.cs b/Projectiles/Vehemence.cs new file mode 100644 index 0000000000..723c38ff07 --- /dev/null +++ b/Projectiles/Vehemence.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Vehemence.png b/Projectiles/Vehemence.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/Vehemence.png differ diff --git a/Projectiles/VenusianBolt.cs b/Projectiles/VenusianBolt.cs new file mode 100644 index 0000000000..284589a172 --- /dev/null +++ b/Projectiles/VenusianBolt.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/VenusianBolt.png b/Projectiles/VenusianBolt.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/VenusianBolt.png differ diff --git a/Projectiles/VenusianExplosion.cs b/Projectiles/VenusianExplosion.cs new file mode 100644 index 0000000000..bb34c0ebec --- /dev/null +++ b/Projectiles/VenusianExplosion.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 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/VenusianExplosion.png b/Projectiles/VenusianExplosion.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/VenusianExplosion.png differ diff --git a/Projectiles/VenusianFlame.cs b/Projectiles/VenusianFlame.cs new file mode 100644 index 0000000000..0ee86080cb --- /dev/null +++ b/Projectiles/VenusianFlame.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/VenusianFlame.png b/Projectiles/VenusianFlame.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/VenusianFlame.png differ diff --git a/Projectiles/VerdantProjectile.cs b/Projectiles/VerdantProjectile.cs new file mode 100644 index 0000000000..00f4e15647 --- /dev/null +++ b/Projectiles/VerdantProjectile.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/VerdantProjectile.png b/Projectiles/VerdantProjectile.png new file mode 100644 index 0000000000..4bf427bb0e Binary files /dev/null and b/Projectiles/VerdantProjectile.png differ diff --git a/Projectiles/VeriumBullet.cs b/Projectiles/VeriumBullet.cs new file mode 100644 index 0000000000..180d262082 --- /dev/null +++ b/Projectiles/VeriumBullet.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/VeriumBullet.png b/Projectiles/VeriumBullet.png new file mode 100644 index 0000000000..e6c2d4b44a Binary files /dev/null and b/Projectiles/VeriumBullet.png differ diff --git a/Projectiles/Viscera.cs b/Projectiles/Viscera.cs new file mode 100644 index 0000000000..ada2a858e8 --- /dev/null +++ b/Projectiles/Viscera.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Viscera.png b/Projectiles/Viscera.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Viscera.png differ diff --git a/Projectiles/VividBolt.cs b/Projectiles/VividBolt.cs new file mode 100644 index 0000000000..fa657bb071 --- /dev/null +++ b/Projectiles/VividBolt.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/VividBolt.png b/Projectiles/VividBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/VividBolt.png differ diff --git a/Projectiles/VividClarity.cs b/Projectiles/VividClarity.cs new file mode 100644 index 0000000000..8a13f7e12b --- /dev/null +++ b/Projectiles/VividClarity.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/VividClarity.png b/Projectiles/VividClarity.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/VividClarity.png differ diff --git a/Projectiles/VividOrb.cs b/Projectiles/VividOrb.cs new file mode 100644 index 0000000000..308f9d1149 --- /dev/null +++ b/Projectiles/VividOrb.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/VividOrb.png b/Projectiles/VividOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/VividOrb.png differ diff --git a/Projectiles/Voidragon.cs b/Projectiles/Voidragon.cs new file mode 100644 index 0000000000..f8fb963cca --- /dev/null +++ b/Projectiles/Voidragon.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Voidragon.png b/Projectiles/Voidragon.png new file mode 100644 index 0000000000..fac11a2bd0 Binary files /dev/null and b/Projectiles/Voidragon.png differ diff --git a/Projectiles/Vortex.cs b/Projectiles/Vortex.cs new file mode 100644 index 0000000000..9f27d31657 --- /dev/null +++ b/Projectiles/Vortex.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/Vortex.png b/Projectiles/Vortex.png new file mode 100644 index 0000000000..97ffe3a3ac Binary files /dev/null and b/Projectiles/Vortex.png differ diff --git a/Projectiles/WaterSpearFriendly.cs b/Projectiles/WaterSpearFriendly.cs new file mode 100644 index 0000000000..d0d6a0b847 --- /dev/null +++ b/Projectiles/WaterSpearFriendly.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/WaterSpearFriendly.png b/Projectiles/WaterSpearFriendly.png new file mode 100644 index 0000000000..c5b595d096 Binary files /dev/null and b/Projectiles/WaterSpearFriendly.png differ diff --git a/Projectiles/WaterSpout.cs b/Projectiles/WaterSpout.cs new file mode 100644 index 0000000000..d53da04c9f --- /dev/null +++ b/Projectiles/WaterSpout.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/WaterSpout.png b/Projectiles/WaterSpout.png new file mode 100644 index 0000000000..5520ef5bf3 Binary files /dev/null and b/Projectiles/WaterSpout.png differ diff --git a/Projectiles/WaterStream.cs b/Projectiles/WaterStream.cs new file mode 100644 index 0000000000..40819eb723 --- /dev/null +++ b/Projectiles/WaterStream.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/WaterStream.png b/Projectiles/WaterStream.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/WaterStream.png differ diff --git a/Projectiles/WaterStream2.cs b/Projectiles/WaterStream2.cs new file mode 100644 index 0000000000..7bd5a44b76 --- /dev/null +++ b/Projectiles/WaterStream2.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/WaterStream2.png b/Projectiles/WaterStream2.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/WaterStream2.png differ diff --git a/Projectiles/WhiteBoltAura.cs b/Projectiles/WhiteBoltAura.cs new file mode 100644 index 0000000000..dade66202f --- /dev/null +++ b/Projectiles/WhiteBoltAura.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 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/WhiteBoltAura.png b/Projectiles/WhiteBoltAura.png new file mode 100644 index 0000000000..0ad8904064 Binary files /dev/null and b/Projectiles/WhiteBoltAura.png differ diff --git a/Projectiles/WhiteBoltAuraBlah.cs b/Projectiles/WhiteBoltAuraBlah.cs new file mode 100644 index 0000000000..17f0f7d90c --- /dev/null +++ b/Projectiles/WhiteBoltAuraBlah.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 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/WhiteBoltAuraBlah.png b/Projectiles/WhiteBoltAuraBlah.png new file mode 100644 index 0000000000..0ad8904064 Binary files /dev/null and b/Projectiles/WhiteBoltAuraBlah.png differ diff --git a/Projectiles/WhiteFlame.cs b/Projectiles/WhiteFlame.cs new file mode 100644 index 0000000000..9ea3266ca7 --- /dev/null +++ b/Projectiles/WhiteFlame.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/WhiteFlame.png b/Projectiles/WhiteFlame.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/WhiteFlame.png differ diff --git a/Projectiles/WhiteFlame2.cs b/Projectiles/WhiteFlame2.cs new file mode 100644 index 0000000000..1d26a534fd --- /dev/null +++ b/Projectiles/WhiteFlame2.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/WhiteFlame2.png b/Projectiles/WhiteFlame2.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/WhiteFlame2.png differ diff --git a/Projectiles/WhiteOrb.cs b/Projectiles/WhiteOrb.cs new file mode 100644 index 0000000000..a6818f704a --- /dev/null +++ b/Projectiles/WhiteOrb.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/WhiteOrb.png b/Projectiles/WhiteOrb.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/WhiteOrb.png differ diff --git a/Projectiles/WhiteOrbBlah.cs b/Projectiles/WhiteOrbBlah.cs new file mode 100644 index 0000000000..8a273c7c05 --- /dev/null +++ b/Projectiles/WhiteOrbBlah.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/WhiteOrbBlah.png b/Projectiles/WhiteOrbBlah.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/WhiteOrbBlah.png differ diff --git a/Projectiles/Whiterain.cs b/Projectiles/Whiterain.cs new file mode 100644 index 0000000000..03030ec3dc --- /dev/null +++ b/Projectiles/Whiterain.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 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/Whiterain.png b/Projectiles/Whiterain.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Whiterain.png differ diff --git a/Projectiles/WhiterainBlah.cs b/Projectiles/WhiterainBlah.cs new file mode 100644 index 0000000000..b0041d64ad --- /dev/null +++ b/Projectiles/WhiterainBlah.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 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/WhiterainBlah.png b/Projectiles/WhiterainBlah.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/WhiterainBlah.png differ diff --git a/Projectiles/WintersFury.cs b/Projectiles/WintersFury.cs new file mode 100644 index 0000000000..0e922eeadc --- /dev/null +++ b/Projectiles/WintersFury.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/WintersFury.png b/Projectiles/WintersFury.png new file mode 100644 index 0000000000..00b1ef9ae1 Binary files /dev/null and b/Projectiles/WintersFury.png differ diff --git a/Projectiles/WulfrumBolt.cs b/Projectiles/WulfrumBolt.cs new file mode 100644 index 0000000000..880f87cf3c --- /dev/null +++ b/Projectiles/WulfrumBolt.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/WulfrumBolt.png b/Projectiles/WulfrumBolt.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/WulfrumBolt.png differ diff --git a/Projectiles/WulfrumDroid.png b/Projectiles/WulfrumDroid.png new file mode 100644 index 0000000000..6b6ffe4e72 Binary files /dev/null and b/Projectiles/WulfrumDroid.png differ diff --git a/Projectiles/WulfrumKnife.cs b/Projectiles/WulfrumKnife.cs new file mode 100644 index 0000000000..232bca858e --- /dev/null +++ b/Projectiles/WulfrumKnife.cs @@ -0,0 +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")); + } + } + } +} \ No newline at end of file diff --git a/Projectiles/WulfrumKnife.png b/Projectiles/WulfrumKnife.png new file mode 100644 index 0000000000..aab1bf448c Binary files /dev/null and b/Projectiles/WulfrumKnife.png differ diff --git a/Projectiles/XerocBlast.cs b/Projectiles/XerocBlast.cs new file mode 100644 index 0000000000..ce1828b455 --- /dev/null +++ b/Projectiles/XerocBlast.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/XerocBlast.png b/Projectiles/XerocBlast.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/XerocBlast.png differ diff --git a/Projectiles/XerocBubble.cs b/Projectiles/XerocBubble.cs new file mode 100644 index 0000000000..56472503f5 --- /dev/null +++ b/Projectiles/XerocBubble.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 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/XerocBubble.png b/Projectiles/XerocBubble.png new file mode 100644 index 0000000000..637b8391b1 Binary files /dev/null and b/Projectiles/XerocBubble.png differ diff --git a/Projectiles/XerocFire.cs b/Projectiles/XerocFire.cs new file mode 100644 index 0000000000..d9ecb39a4c --- /dev/null +++ b/Projectiles/XerocFire.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 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/XerocFire.png b/Projectiles/XerocFire.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/XerocFire.png differ diff --git a/Projectiles/XerocHealOrb.cs b/Projectiles/XerocHealOrb.cs new file mode 100644 index 0000000000..b311ba28b1 --- /dev/null +++ b/Projectiles/XerocHealOrb.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/XerocHealOrb.png b/Projectiles/XerocHealOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/XerocHealOrb.png differ diff --git a/Projectiles/XerocOrb.cs b/Projectiles/XerocOrb.cs new file mode 100644 index 0000000000..b6ac6bbc6c --- /dev/null +++ b/Projectiles/XerocOrb.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/XerocOrb.png b/Projectiles/XerocOrb.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/XerocOrb.png differ diff --git a/Projectiles/XerocPitchforkProjectile.cs b/Projectiles/XerocPitchforkProjectile.cs new file mode 100644 index 0000000000..7dcd85e995 --- /dev/null +++ b/Projectiles/XerocPitchforkProjectile.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 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/XerocPitchforkProjectile.png b/Projectiles/XerocPitchforkProjectile.png new file mode 100644 index 0000000000..5ff0fa6cf6 Binary files /dev/null and b/Projectiles/XerocPitchforkProjectile.png differ diff --git a/Projectiles/XerocStar.cs b/Projectiles/XerocStar.cs new file mode 100644 index 0000000000..889fab30fb --- /dev/null +++ b/Projectiles/XerocStar.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + 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/XerocStar.png b/Projectiles/XerocStar.png new file mode 100644 index 0000000000..454174ef8a Binary files /dev/null and b/Projectiles/XerocStar.png differ diff --git a/Projectiles/YharimsCrystal.cs b/Projectiles/YharimsCrystal.cs new file mode 100644 index 0000000000..e9bf44f9b0 --- /dev/null +++ b/Projectiles/YharimsCrystal.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Projectiles/YharimsCrystal.png b/Projectiles/YharimsCrystal.png new file mode 100644 index 0000000000..5b6217dcfe Binary files /dev/null and b/Projectiles/YharimsCrystal.png differ diff --git a/Projectiles/YharimsCrystalBeam.cs b/Projectiles/YharimsCrystalBeam.cs new file mode 100644 index 0000000000..2f3b3b706a --- /dev/null +++ b/Projectiles/YharimsCrystalBeam.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Projectiles/YharimsCrystalBeam.png b/Projectiles/YharimsCrystalBeam.png new file mode 100644 index 0000000000..4bcb09bbf2 Binary files /dev/null and b/Projectiles/YharimsCrystalBeam.png differ diff --git a/Projectiles/YinYo.cs b/Projectiles/YinYo.cs new file mode 100644 index 0000000000..82e3db824d --- /dev/null +++ b/Projectiles/YinYo.cs @@ -0,0 +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; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/YinYo.png b/Projectiles/YinYo.png new file mode 100644 index 0000000000..50643ceb0a Binary files /dev/null and b/Projectiles/YinYo.png differ diff --git a/Sounds/Custom/AngryDogGrowl.cs b/Sounds/Custom/AngryDogGrowl.cs new file mode 100644 index 0000000000..28934cf2b0 --- /dev/null +++ b/Sounds/Custom/AngryDogGrowl.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AngryDogGrowl : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/AngryDogGrowl.wav b/Sounds/Custom/AngryDogGrowl.wav new file mode 100644 index 0000000000..5153be8b37 Binary files /dev/null and b/Sounds/Custom/AngryDogGrowl.wav differ diff --git a/Sounds/Custom/CorvinaScream.cs b/Sounds/Custom/CorvinaScream.cs new file mode 100644 index 0000000000..e1f8af8af4 --- /dev/null +++ b/Sounds/Custom/CorvinaScream.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class CovirnaScream : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/CorvinaScream.wav b/Sounds/Custom/CorvinaScream.wav new file mode 100644 index 0000000000..5a97f98f7b Binary files /dev/null and b/Sounds/Custom/CorvinaScream.wav differ diff --git a/Sounds/Custom/EidolonWyrmRoarClose.cs b/Sounds/Custom/EidolonWyrmRoarClose.cs new file mode 100644 index 0000000000..c3e10f492f --- /dev/null +++ b/Sounds/Custom/EidolonWyrmRoarClose.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class EidolonWyrmRoarClose : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/EidolonWyrmRoarClose.wav b/Sounds/Custom/EidolonWyrmRoarClose.wav new file mode 100644 index 0000000000..28962f3ae0 Binary files /dev/null and b/Sounds/Custom/EidolonWyrmRoarClose.wav differ diff --git a/Sounds/Custom/GreatSandSharkRoar.cs b/Sounds/Custom/GreatSandSharkRoar.cs new file mode 100644 index 0000000000..b95844442d --- /dev/null +++ b/Sounds/Custom/GreatSandSharkRoar.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class GreatSandSharkRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/GreatSandSharkRoar.wav b/Sounds/Custom/GreatSandSharkRoar.wav new file mode 100644 index 0000000000..75b6801ccc Binary files /dev/null and b/Sounds/Custom/GreatSandSharkRoar.wav differ diff --git a/Sounds/Custom/LegStomp.cs b/Sounds/Custom/LegStomp.cs new file mode 100644 index 0000000000..9afe666602 --- /dev/null +++ b/Sounds/Custom/LegStomp.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class LegStomp : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/LegStomp.wav b/Sounds/Custom/LegStomp.wav new file mode 100644 index 0000000000..aa9b6aa01b Binary files /dev/null and b/Sounds/Custom/LegStomp.wav differ diff --git a/Sounds/Custom/MaulerRoar.cs b/Sounds/Custom/MaulerRoar.cs new file mode 100644 index 0000000000..b863e0dd94 --- /dev/null +++ b/Sounds/Custom/MaulerRoar.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Custom/MaulerRoar.wav b/Sounds/Custom/MaulerRoar.wav new file mode 100644 index 0000000000..ffe1cb55f1 Binary files /dev/null and b/Sounds/Custom/MaulerRoar.wav differ diff --git a/Sounds/Custom/ReaperEnragedRoar.cs b/Sounds/Custom/ReaperEnragedRoar.cs new file mode 100644 index 0000000000..3f0aefb522 --- /dev/null +++ b/Sounds/Custom/ReaperEnragedRoar.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Custom/ReaperEnragedRoar.wav b/Sounds/Custom/ReaperEnragedRoar.wav new file mode 100644 index 0000000000..dda464857e Binary files /dev/null and b/Sounds/Custom/ReaperEnragedRoar.wav differ diff --git a/Sounds/Custom/ReaperSearchRoar.cs b/Sounds/Custom/ReaperSearchRoar.cs new file mode 100644 index 0000000000..37ff2750eb --- /dev/null +++ b/Sounds/Custom/ReaperSearchRoar.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Custom/ReaperSearchRoar.wav b/Sounds/Custom/ReaperSearchRoar.wav new file mode 100644 index 0000000000..60e3a9e5a0 Binary files /dev/null and b/Sounds/Custom/ReaperSearchRoar.wav differ diff --git a/Sounds/Custom/WyrmScream.cs b/Sounds/Custom/WyrmScream.cs new file mode 100644 index 0000000000..5a3d9c55c2 --- /dev/null +++ b/Sounds/Custom/WyrmScream.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Custom/WyrmScream.wav b/Sounds/Custom/WyrmScream.wav new file mode 100644 index 0000000000..ecfbf23871 Binary files /dev/null and b/Sounds/Custom/WyrmScream.wav differ diff --git a/Sounds/Custom/YharonRoar.cs b/Sounds/Custom/YharonRoar.cs new file mode 100644 index 0000000000..9709462f83 --- /dev/null +++ b/Sounds/Custom/YharonRoar.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class YharonRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Custom/YharonRoar.wav b/Sounds/Custom/YharonRoar.wav new file mode 100644 index 0000000000..6766e957f3 Binary files /dev/null and b/Sounds/Custom/YharonRoar.wav differ diff --git a/Sounds/Item/FlareSound.cs b/Sounds/Item/FlareSound.cs new file mode 100644 index 0000000000..ea8a8c2842 --- /dev/null +++ b/Sounds/Item/FlareSound.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Item/FlareSound.wav b/Sounds/Item/FlareSound.wav new file mode 100644 index 0000000000..bb1bdb6be2 Binary files /dev/null and b/Sounds/Item/FlareSound.wav differ diff --git a/Sounds/Item/IronHeartDeath.cs b/Sounds/Item/IronHeartDeath.cs new file mode 100644 index 0000000000..73b31868a1 --- /dev/null +++ b/Sounds/Item/IronHeartDeath.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class IronHeartDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Item/IronHeartDeath.wav b/Sounds/Item/IronHeartDeath.wav new file mode 100644 index 0000000000..74fe61cfda Binary files /dev/null and b/Sounds/Item/IronHeartDeath.wav differ diff --git a/Sounds/Item/LaserCannon.cs b/Sounds/Item/LaserCannon.cs new file mode 100644 index 0000000000..a7f08b7159 --- /dev/null +++ b/Sounds/Item/LaserCannon.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Item/LaserCannon.wav b/Sounds/Item/LaserCannon.wav new file mode 100644 index 0000000000..6127c92f78 Binary files /dev/null and b/Sounds/Item/LaserCannon.wav differ diff --git a/Sounds/Item/OpalStrike.cs b/Sounds/Item/OpalStrike.cs new file mode 100644 index 0000000000..a706d14c3a --- /dev/null +++ b/Sounds/Item/OpalStrike.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Item/OpalStrike.wav b/Sounds/Item/OpalStrike.wav new file mode 100644 index 0000000000..6ec1dd7a90 Binary files /dev/null and b/Sounds/Item/OpalStrike.wav differ diff --git a/Sounds/Item/PlasmaBlast.cs b/Sounds/Item/PlasmaBlast.cs new file mode 100644 index 0000000000..bd773fa994 --- /dev/null +++ b/Sounds/Item/PlasmaBlast.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Item/PlasmaBlast.wav b/Sounds/Item/PlasmaBlast.wav new file mode 100644 index 0000000000..081a364cb1 Binary files /dev/null and b/Sounds/Item/PlasmaBlast.wav differ diff --git a/Sounds/Item/PlasmaBolt.cs b/Sounds/Item/PlasmaBolt.cs new file mode 100644 index 0000000000..64a791b559 --- /dev/null +++ b/Sounds/Item/PlasmaBolt.cs @@ -0,0 +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; + } + } +} diff --git a/Sounds/Item/PlasmaBolt.wav b/Sounds/Item/PlasmaBolt.wav new file mode 100644 index 0000000000..d63b4f6a20 Binary files /dev/null and b/Sounds/Item/PlasmaBolt.wav differ diff --git a/Sounds/Music/AquaticScourge.mp3 b/Sounds/Music/AquaticScourge.mp3 new file mode 100644 index 0000000000..2f2ad8aedb Binary files /dev/null and b/Sounds/Music/AquaticScourge.mp3 differ diff --git a/Sounds/Music/Astrageldon.mp3 b/Sounds/Music/Astrageldon.mp3 new file mode 100644 index 0000000000..2f4f60c9a7 Binary files /dev/null and b/Sounds/Music/Astrageldon.mp3 differ diff --git a/Sounds/Music/Astral.mp3 b/Sounds/Music/Astral.mp3 new file mode 100644 index 0000000000..19d9916880 Binary files /dev/null and b/Sounds/Music/Astral.mp3 differ diff --git a/Sounds/Music/AstrumDeus.mp3 b/Sounds/Music/AstrumDeus.mp3 new file mode 100644 index 0000000000..e65fc2ebdc Binary files /dev/null and b/Sounds/Music/AstrumDeus.mp3 differ diff --git a/Sounds/Music/BloodCoagulant.mp3 b/Sounds/Music/BloodCoagulant.mp3 new file mode 100644 index 0000000000..80a57e214d Binary files /dev/null and b/Sounds/Music/BloodCoagulant.mp3 differ diff --git a/Sounds/Music/Calamitas.mp3 b/Sounds/Music/Calamitas.mp3 new file mode 100644 index 0000000000..417ac15a9b Binary files /dev/null and b/Sounds/Music/Calamitas.mp3 differ diff --git a/Sounds/Music/Calamity.mp3 b/Sounds/Music/Calamity.mp3 new file mode 100644 index 0000000000..f1805bcad7 Binary files /dev/null and b/Sounds/Music/Calamity.mp3 differ diff --git a/Sounds/Music/Crabulon.mp3 b/Sounds/Music/Crabulon.mp3 new file mode 100644 index 0000000000..d09a35d0d9 Binary files /dev/null and b/Sounds/Music/Crabulon.mp3 differ diff --git a/Sounds/Music/Crag.mp3 b/Sounds/Music/Crag.mp3 new file mode 100644 index 0000000000..34a1273576 Binary files /dev/null and b/Sounds/Music/Crag.mp3 differ diff --git a/Sounds/Music/Cryogen.mp3 b/Sounds/Music/Cryogen.mp3 new file mode 100644 index 0000000000..a9b8bc2e97 Binary files /dev/null and b/Sounds/Music/Cryogen.mp3 differ diff --git a/Sounds/Music/DesertScourge.mp3 b/Sounds/Music/DesertScourge.mp3 new file mode 100644 index 0000000000..5c45c6543f Binary files /dev/null and b/Sounds/Music/DesertScourge.mp3 differ diff --git a/Sounds/Music/Doomsayer.mp3 b/Sounds/Music/Doomsayer.mp3 new file mode 100644 index 0000000000..3bd7600c8d Binary files /dev/null and b/Sounds/Music/Doomsayer.mp3 differ diff --git a/Sounds/Music/DragonGod.mp3 b/Sounds/Music/DragonGod.mp3 new file mode 100644 index 0000000000..c3ac03cd4b Binary files /dev/null and b/Sounds/Music/DragonGod.mp3 differ diff --git a/Sounds/Music/Guardians.mp3 b/Sounds/Music/Guardians.mp3 new file mode 100644 index 0000000000..9e50ac63fc Binary files /dev/null and b/Sounds/Music/Guardians.mp3 differ diff --git a/Sounds/Music/HiveMind.mp3 b/Sounds/Music/HiveMind.mp3 new file mode 100644 index 0000000000..5aae657360 Binary files /dev/null and b/Sounds/Music/HiveMind.mp3 differ diff --git a/Sounds/Music/LeftAlone.mp3 b/Sounds/Music/LeftAlone.mp3 new file mode 100644 index 0000000000..1da1de3d6b Binary files /dev/null and b/Sounds/Music/LeftAlone.mp3 differ diff --git a/Sounds/Music/LeviathanAndSiren.mp3 b/Sounds/Music/LeviathanAndSiren.mp3 new file mode 100644 index 0000000000..3924f09261 Binary files /dev/null and b/Sounds/Music/LeviathanAndSiren.mp3 differ diff --git a/Sounds/Music/Murderswarm.mp3 b/Sounds/Music/Murderswarm.mp3 new file mode 100644 index 0000000000..0f6283b110 Binary files /dev/null and b/Sounds/Music/Murderswarm.mp3 differ diff --git a/Sounds/Music/PlaguebringerGoliath.mp3 b/Sounds/Music/PlaguebringerGoliath.mp3 new file mode 100644 index 0000000000..ae8a61daf9 Binary files /dev/null and b/Sounds/Music/PlaguebringerGoliath.mp3 differ diff --git a/Sounds/Music/ProvidenceTheme.mp3 b/Sounds/Music/ProvidenceTheme.mp3 new file mode 100644 index 0000000000..9aac33bf29 Binary files /dev/null and b/Sounds/Music/ProvidenceTheme.mp3 differ diff --git a/Sounds/Music/RUIN.mp3 b/Sounds/Music/RUIN.mp3 new file mode 100644 index 0000000000..571b990ce2 Binary files /dev/null and b/Sounds/Music/RUIN.mp3 differ diff --git a/Sounds/Music/Ravager.mp3 b/Sounds/Music/Ravager.mp3 new file mode 100644 index 0000000000..e60725ab77 Binary files /dev/null and b/Sounds/Music/Ravager.mp3 differ diff --git a/Sounds/Music/SC1.mp3 b/Sounds/Music/SC1.mp3 new file mode 100644 index 0000000000..0684478b82 Binary files /dev/null and b/Sounds/Music/SC1.mp3 differ diff --git a/Sounds/Music/SC2.mp3 b/Sounds/Music/SC2.mp3 new file mode 100644 index 0000000000..8664fa4ec6 Binary files /dev/null and b/Sounds/Music/SC2.mp3 differ diff --git a/Sounds/Music/SC3.mp3 b/Sounds/Music/SC3.mp3 new file mode 100644 index 0000000000..bd0afeb102 Binary files /dev/null and b/Sounds/Music/SC3.mp3 differ diff --git a/Sounds/Music/ScourgeofTheUniverse.mp3 b/Sounds/Music/ScourgeofTheUniverse.mp3 new file mode 100644 index 0000000000..43af800d3e Binary files /dev/null and b/Sounds/Music/ScourgeofTheUniverse.mp3 differ diff --git a/Sounds/Music/Signus.mp3 b/Sounds/Music/Signus.mp3 new file mode 100644 index 0000000000..cd72818b5f Binary files /dev/null and b/Sounds/Music/Signus.mp3 differ diff --git a/Sounds/Music/Siren.mp3 b/Sounds/Music/Siren.mp3 new file mode 100644 index 0000000000..92b9164f7f Binary files /dev/null and b/Sounds/Music/Siren.mp3 differ diff --git a/Sounds/Music/SirenLure.mp3 b/Sounds/Music/SirenLure.mp3 new file mode 100644 index 0000000000..330c77b3c4 Binary files /dev/null and b/Sounds/Music/SirenLure.mp3 differ diff --git a/Sounds/Music/SlimeGod.mp3 b/Sounds/Music/SlimeGod.mp3 new file mode 100644 index 0000000000..083bd76435 Binary files /dev/null and b/Sounds/Music/SlimeGod.mp3 differ diff --git a/Sounds/Music/Sulphur.mp3 b/Sounds/Music/Sulphur.mp3 new file mode 100644 index 0000000000..da09ff7264 Binary files /dev/null and b/Sounds/Music/Sulphur.mp3 differ diff --git a/Sounds/Music/TheAbyss.mp3 b/Sounds/Music/TheAbyss.mp3 new file mode 100644 index 0000000000..4f8ce94d22 Binary files /dev/null and b/Sounds/Music/TheAbyss.mp3 differ diff --git a/Sounds/Music/TheDeepAbyss.mp3 b/Sounds/Music/TheDeepAbyss.mp3 new file mode 100644 index 0000000000..a271eb9e6c Binary files /dev/null and b/Sounds/Music/TheDeepAbyss.mp3 differ diff --git a/Sounds/Music/UniversalCollapse.mp3 b/Sounds/Music/UniversalCollapse.mp3 new file mode 100644 index 0000000000..bb5aca2a71 Binary files /dev/null and b/Sounds/Music/UniversalCollapse.mp3 differ diff --git a/Sounds/Music/Void.mp3 b/Sounds/Music/Void.mp3 new file mode 100644 index 0000000000..172cf2df83 Binary files /dev/null and b/Sounds/Music/Void.mp3 differ diff --git a/Sounds/Music/Weaver.mp3 b/Sounds/Music/Weaver.mp3 new file mode 100644 index 0000000000..901f258c97 Binary files /dev/null and b/Sounds/Music/Weaver.mp3 differ diff --git a/Sounds/Music/YHARON.mp3 b/Sounds/Music/YHARON.mp3 new file mode 100644 index 0000000000..4de1f36539 Binary files /dev/null and b/Sounds/Music/YHARON.mp3 differ diff --git a/Sounds/Music/YHARONREBIRTH.mp3 b/Sounds/Music/YHARONREBIRTH.mp3 new file mode 100644 index 0000000000..70e52eaee6 Binary files /dev/null and b/Sounds/Music/YHARONREBIRTH.mp3 differ diff --git a/Sounds/NPCDeath/Sunskater.cs b/Sounds/NPCDeath/Sunskater.cs new file mode 100644 index 0000000000..2e1959e401 --- /dev/null +++ b/Sounds/NPCDeath/Sunskater.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCDeath +{ + public class Sunskater : 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/NPCDeath/Sunskater.wav b/Sounds/NPCDeath/Sunskater.wav new file mode 100644 index 0000000000..cad3914464 Binary files /dev/null and b/Sounds/NPCDeath/Sunskater.wav differ diff --git a/Sounds/NPCHit/AngryDogHit.cs b/Sounds/NPCHit/AngryDogHit.cs new file mode 100644 index 0000000000..3123a60cb2 --- /dev/null +++ b/Sounds/NPCHit/AngryDogHit.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCHit +{ + public class AngryDogHit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/NPCHit/AngryDogHit.wav b/Sounds/NPCHit/AngryDogHit.wav new file mode 100644 index 0000000000..81aa3094e0 Binary files /dev/null and b/Sounds/NPCHit/AngryDogHit.wav differ diff --git a/Sounds/NPCHit/AstrumAureusHit.cs b/Sounds/NPCHit/AstrumAureusHit.cs new file mode 100644 index 0000000000..42e5953511 --- /dev/null +++ b/Sounds/NPCHit/AstrumAureusHit.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Sounds/NPCHit/AstrumAureusHit.wav b/Sounds/NPCHit/AstrumAureusHit.wav new file mode 100644 index 0000000000..eff0e1a7b3 Binary files /dev/null and b/Sounds/NPCHit/AstrumAureusHit.wav differ diff --git a/Tiles/AbyssBath.cs b/Tiles/AbyssBath.cs new file mode 100644 index 0000000000..5638a6ffd3 --- /dev/null +++ b/Tiles/AbyssBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssBath.png b/Tiles/AbyssBath.png new file mode 100644 index 0000000000..268b397f7d Binary files /dev/null and b/Tiles/AbyssBath.png differ diff --git a/Tiles/AbyssBed.cs b/Tiles/AbyssBed.cs new file mode 100644 index 0000000000..90c8362bb1 --- /dev/null +++ b/Tiles/AbyssBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssBed.png b/Tiles/AbyssBed.png new file mode 100644 index 0000000000..6984bcb44d Binary files /dev/null and b/Tiles/AbyssBed.png differ diff --git a/Tiles/AbyssBed_Highlight.png b/Tiles/AbyssBed_Highlight.png new file mode 100644 index 0000000000..2b30771f84 Binary files /dev/null and b/Tiles/AbyssBed_Highlight.png differ diff --git a/Tiles/AbyssBookcase.cs b/Tiles/AbyssBookcase.cs new file mode 100644 index 0000000000..95d0731424 --- /dev/null +++ b/Tiles/AbyssBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssBookcase.png b/Tiles/AbyssBookcase.png new file mode 100644 index 0000000000..2b182dcd56 Binary files /dev/null and b/Tiles/AbyssBookcase.png differ diff --git a/Tiles/AbyssCandelabra.cs b/Tiles/AbyssCandelabra.cs new file mode 100644 index 0000000000..9eb0dd957a --- /dev/null +++ b/Tiles/AbyssCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssCandelabra.png b/Tiles/AbyssCandelabra.png new file mode 100644 index 0000000000..e819742df1 Binary files /dev/null and b/Tiles/AbyssCandelabra.png differ diff --git a/Tiles/AbyssCandle.cs b/Tiles/AbyssCandle.cs new file mode 100644 index 0000000000..7fb4164f37 --- /dev/null +++ b/Tiles/AbyssCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssCandle.png b/Tiles/AbyssCandle.png new file mode 100644 index 0000000000..ba55878032 Binary files /dev/null and b/Tiles/AbyssCandle.png differ diff --git a/Tiles/AbyssChair.cs b/Tiles/AbyssChair.cs new file mode 100644 index 0000000000..1db5e85dac --- /dev/null +++ b/Tiles/AbyssChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssChair.png b/Tiles/AbyssChair.png new file mode 100644 index 0000000000..c7a8077c47 Binary files /dev/null and b/Tiles/AbyssChair.png differ diff --git a/Tiles/AbyssChandelier.cs b/Tiles/AbyssChandelier.cs new file mode 100644 index 0000000000..c7d8e09c6e --- /dev/null +++ b/Tiles/AbyssChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssChandelier.png b/Tiles/AbyssChandelier.png new file mode 100644 index 0000000000..38cc9497a7 Binary files /dev/null and b/Tiles/AbyssChandelier.png differ diff --git a/Tiles/AbyssChest.cs b/Tiles/AbyssChest.cs new file mode 100644 index 0000000000..0139e12633 --- /dev/null +++ b/Tiles/AbyssChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssChest.png b/Tiles/AbyssChest.png new file mode 100644 index 0000000000..ea9d0c40ae Binary files /dev/null and b/Tiles/AbyssChest.png differ diff --git a/Tiles/AbyssChestLocked.png b/Tiles/AbyssChestLocked.png new file mode 100644 index 0000000000..a6ae6b2726 Binary files /dev/null and b/Tiles/AbyssChestLocked.png differ diff --git a/Tiles/AbyssChest_Highlight.png b/Tiles/AbyssChest_Highlight.png new file mode 100644 index 0000000000..3516e481ce Binary files /dev/null and b/Tiles/AbyssChest_Highlight.png differ diff --git a/Tiles/AbyssClock.cs b/Tiles/AbyssClock.cs new file mode 100644 index 0000000000..7c246820f9 --- /dev/null +++ b/Tiles/AbyssClock.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssClock.png b/Tiles/AbyssClock.png new file mode 100644 index 0000000000..1cfa23cedf Binary files /dev/null and b/Tiles/AbyssClock.png differ diff --git a/Tiles/AbyssClock_Highlight.png b/Tiles/AbyssClock_Highlight.png new file mode 100644 index 0000000000..d6b078b0b8 Binary files /dev/null and b/Tiles/AbyssClock_Highlight.png differ diff --git a/Tiles/AbyssDoorClosed.cs b/Tiles/AbyssDoorClosed.cs new file mode 100644 index 0000000000..8a274846e4 --- /dev/null +++ b/Tiles/AbyssDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssDoorClosed.png b/Tiles/AbyssDoorClosed.png new file mode 100644 index 0000000000..a5ba9a1864 Binary files /dev/null and b/Tiles/AbyssDoorClosed.png differ diff --git a/Tiles/AbyssDoorClosed_Highlight.png b/Tiles/AbyssDoorClosed_Highlight.png new file mode 100644 index 0000000000..1eef954a5c Binary files /dev/null and b/Tiles/AbyssDoorClosed_Highlight.png differ diff --git a/Tiles/AbyssDoorOpen.cs b/Tiles/AbyssDoorOpen.cs new file mode 100644 index 0000000000..fd31cbdc2b --- /dev/null +++ b/Tiles/AbyssDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssDoorOpen.png b/Tiles/AbyssDoorOpen.png new file mode 100644 index 0000000000..4d8201314a Binary files /dev/null and b/Tiles/AbyssDoorOpen.png differ diff --git a/Tiles/AbyssDoorOpen_Highlight.png b/Tiles/AbyssDoorOpen_Highlight.png new file mode 100644 index 0000000000..e0fab1a785 Binary files /dev/null and b/Tiles/AbyssDoorOpen_Highlight.png differ diff --git a/Tiles/AbyssDresser.cs b/Tiles/AbyssDresser.cs new file mode 100644 index 0000000000..4a43d55263 --- /dev/null +++ b/Tiles/AbyssDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssDresser.png b/Tiles/AbyssDresser.png new file mode 100644 index 0000000000..102efbb667 Binary files /dev/null and b/Tiles/AbyssDresser.png differ diff --git a/Tiles/AbyssDresser_Highlight.png b/Tiles/AbyssDresser_Highlight.png new file mode 100644 index 0000000000..93cbe48cd2 Binary files /dev/null and b/Tiles/AbyssDresser_Highlight.png differ diff --git a/Tiles/AbyssGravel.cs b/Tiles/AbyssGravel.cs new file mode 100644 index 0000000000..870bd938fe --- /dev/null +++ b/Tiles/AbyssGravel.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssGravel.png b/Tiles/AbyssGravel.png new file mode 100644 index 0000000000..4257b79674 Binary files /dev/null and b/Tiles/AbyssGravel.png differ diff --git a/Tiles/AbyssLamp.cs b/Tiles/AbyssLamp.cs new file mode 100644 index 0000000000..ecd1e6704a --- /dev/null +++ b/Tiles/AbyssLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssLamp.png b/Tiles/AbyssLamp.png new file mode 100644 index 0000000000..345f1810ac Binary files /dev/null and b/Tiles/AbyssLamp.png differ diff --git a/Tiles/AbyssLantern.cs b/Tiles/AbyssLantern.cs new file mode 100644 index 0000000000..5cac1a8dc5 --- /dev/null +++ b/Tiles/AbyssLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AbyssLantern.png b/Tiles/AbyssLantern.png new file mode 100644 index 0000000000..34f3c3e621 Binary files /dev/null and b/Tiles/AbyssLantern.png differ diff --git a/Tiles/AbyssPiano.cs b/Tiles/AbyssPiano.cs new file mode 100644 index 0000000000..3137139894 --- /dev/null +++ b/Tiles/AbyssPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssPiano.png b/Tiles/AbyssPiano.png new file mode 100644 index 0000000000..c25b118196 Binary files /dev/null and b/Tiles/AbyssPiano.png differ diff --git a/Tiles/AbyssPiles.png b/Tiles/AbyssPiles.png new file mode 100644 index 0000000000..0995c09509 Binary files /dev/null and b/Tiles/AbyssPiles.png differ diff --git a/Tiles/AbyssSink.cs b/Tiles/AbyssSink.cs new file mode 100644 index 0000000000..ecc81a7e7d --- /dev/null +++ b/Tiles/AbyssSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssSink.png b/Tiles/AbyssSink.png new file mode 100644 index 0000000000..c048fe1fd9 Binary files /dev/null and b/Tiles/AbyssSink.png differ diff --git a/Tiles/AbyssSofa.cs b/Tiles/AbyssSofa.cs new file mode 100644 index 0000000000..09543f46f1 --- /dev/null +++ b/Tiles/AbyssSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssSofa.png b/Tiles/AbyssSofa.png new file mode 100644 index 0000000000..27b32dfb38 Binary files /dev/null and b/Tiles/AbyssSofa.png differ diff --git a/Tiles/AbyssTable.cs b/Tiles/AbyssTable.cs new file mode 100644 index 0000000000..c5eaa20b85 --- /dev/null +++ b/Tiles/AbyssTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AbyssTable.png b/Tiles/AbyssTable.png new file mode 100644 index 0000000000..fe5efbbd6c Binary files /dev/null and b/Tiles/AbyssTable.png differ diff --git a/Tiles/AbyssTorch.cs b/Tiles/AbyssTorch.cs new file mode 100644 index 0000000000..5cb7a9debd --- /dev/null +++ b/Tiles/AbyssTorch.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssTorch.png b/Tiles/AbyssTorch.png new file mode 100644 index 0000000000..7640a5aec0 Binary files /dev/null and b/Tiles/AbyssTorch.png differ diff --git a/Tiles/AbyssUpperMusicbox.png b/Tiles/AbyssUpperMusicbox.png new file mode 100644 index 0000000000..3f57457992 Binary files /dev/null and b/Tiles/AbyssUpperMusicbox.png differ diff --git a/Tiles/AbyssWorkbench.cs b/Tiles/AbyssWorkbench.cs new file mode 100644 index 0000000000..efcf2f3466 --- /dev/null +++ b/Tiles/AbyssWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AbyssWorkbench.png b/Tiles/AbyssWorkbench.png new file mode 100644 index 0000000000..e131391880 Binary files /dev/null and b/Tiles/AbyssWorkbench.png differ diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs new file mode 100644 index 0000000000..e5ecdfe09a --- /dev/null +++ b/Tiles/AerialiteBrick.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AerialiteBrick.png b/Tiles/AerialiteBrick.png new file mode 100644 index 0000000000..2031ae856e Binary files /dev/null and b/Tiles/AerialiteBrick.png differ diff --git a/Tiles/AerialiteOre.cs b/Tiles/AerialiteOre.cs new file mode 100644 index 0000000000..ae6e116acc --- /dev/null +++ b/Tiles/AerialiteOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AerialiteOre.png b/Tiles/AerialiteOre.png new file mode 100644 index 0000000000..76240f69bc Binary files /dev/null and b/Tiles/AerialiteOre.png differ diff --git a/Tiles/AncientAltar.cs b/Tiles/AncientAltar.cs new file mode 100644 index 0000000000..1587672b69 --- /dev/null +++ b/Tiles/AncientAltar.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientAltar.png b/Tiles/AncientAltar.png new file mode 100644 index 0000000000..323afd5f7b Binary files /dev/null and b/Tiles/AncientAltar.png differ diff --git a/Tiles/AncientBasin.cs b/Tiles/AncientBasin.cs new file mode 100644 index 0000000000..96881ccf9a --- /dev/null +++ b/Tiles/AncientBasin.cs @@ -0,0 +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); + } + } + } +} diff --git a/Tiles/AncientBasin.png b/Tiles/AncientBasin.png new file mode 100644 index 0000000000..56c4c3216b Binary files /dev/null and b/Tiles/AncientBasin.png differ diff --git a/Tiles/AncientBath.cs b/Tiles/AncientBath.cs new file mode 100644 index 0000000000..e7e980b3ba --- /dev/null +++ b/Tiles/AncientBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientBath.png b/Tiles/AncientBath.png new file mode 100644 index 0000000000..29125e9c40 Binary files /dev/null and b/Tiles/AncientBath.png differ diff --git a/Tiles/AncientBed.cs b/Tiles/AncientBed.cs new file mode 100644 index 0000000000..c94c3349fc --- /dev/null +++ b/Tiles/AncientBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientBed.png b/Tiles/AncientBed.png new file mode 100644 index 0000000000..e122d820d6 Binary files /dev/null and b/Tiles/AncientBed.png differ diff --git a/Tiles/AncientBed_Highlight.png b/Tiles/AncientBed_Highlight.png new file mode 100644 index 0000000000..a364db6954 Binary files /dev/null and b/Tiles/AncientBed_Highlight.png differ diff --git a/Tiles/AncientBookcase.cs b/Tiles/AncientBookcase.cs new file mode 100644 index 0000000000..911175afa3 --- /dev/null +++ b/Tiles/AncientBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientBookcase.png b/Tiles/AncientBookcase.png new file mode 100644 index 0000000000..1db70e85e0 Binary files /dev/null and b/Tiles/AncientBookcase.png differ diff --git a/Tiles/AncientChair.cs b/Tiles/AncientChair.cs new file mode 100644 index 0000000000..e94aafef37 --- /dev/null +++ b/Tiles/AncientChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientChair.png b/Tiles/AncientChair.png new file mode 100644 index 0000000000..7787bf0d39 Binary files /dev/null and b/Tiles/AncientChair.png differ diff --git a/Tiles/AncientChandelier.cs b/Tiles/AncientChandelier.cs new file mode 100644 index 0000000000..9993426a14 --- /dev/null +++ b/Tiles/AncientChandelier.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientChandelier.png b/Tiles/AncientChandelier.png new file mode 100644 index 0000000000..32e71c9dbd Binary files /dev/null and b/Tiles/AncientChandelier.png differ diff --git a/Tiles/AncientDoorClosed.cs b/Tiles/AncientDoorClosed.cs new file mode 100644 index 0000000000..ea924b7f78 --- /dev/null +++ b/Tiles/AncientDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientDoorClosed.png b/Tiles/AncientDoorClosed.png new file mode 100644 index 0000000000..87e2be4419 Binary files /dev/null and b/Tiles/AncientDoorClosed.png differ diff --git a/Tiles/AncientDoorClosed_Highlight.png b/Tiles/AncientDoorClosed_Highlight.png new file mode 100644 index 0000000000..9a7e447ce4 Binary files /dev/null and b/Tiles/AncientDoorClosed_Highlight.png differ diff --git a/Tiles/AncientDoorOpen.cs b/Tiles/AncientDoorOpen.cs new file mode 100644 index 0000000000..beba8f7cf6 --- /dev/null +++ b/Tiles/AncientDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientDoorOpen.png b/Tiles/AncientDoorOpen.png new file mode 100644 index 0000000000..16b9aab459 Binary files /dev/null and b/Tiles/AncientDoorOpen.png differ diff --git a/Tiles/AncientDoorOpen_Highlight.png b/Tiles/AncientDoorOpen_Highlight.png new file mode 100644 index 0000000000..1a6f2d3c53 Binary files /dev/null and b/Tiles/AncientDoorOpen_Highlight.png differ diff --git a/Tiles/AncientDresser.cs b/Tiles/AncientDresser.cs new file mode 100644 index 0000000000..e9bac0e3e0 --- /dev/null +++ b/Tiles/AncientDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AncientDresser.png b/Tiles/AncientDresser.png new file mode 100644 index 0000000000..343ac2fd9c Binary files /dev/null and b/Tiles/AncientDresser.png differ diff --git a/Tiles/AncientDresser_Highlight.png b/Tiles/AncientDresser_Highlight.png new file mode 100644 index 0000000000..d035bb35ae Binary files /dev/null and b/Tiles/AncientDresser_Highlight.png differ diff --git a/Tiles/AncientLamp.cs b/Tiles/AncientLamp.cs new file mode 100644 index 0000000000..aac8307927 --- /dev/null +++ b/Tiles/AncientLamp.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientLamp.png b/Tiles/AncientLamp.png new file mode 100644 index 0000000000..30cca7e793 Binary files /dev/null and b/Tiles/AncientLamp.png differ diff --git a/Tiles/AncientLantern.cs b/Tiles/AncientLantern.cs new file mode 100644 index 0000000000..68aa276961 --- /dev/null +++ b/Tiles/AncientLantern.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientLantern.png b/Tiles/AncientLantern.png new file mode 100644 index 0000000000..8ca920e58e Binary files /dev/null and b/Tiles/AncientLantern.png differ diff --git a/Tiles/AncientMonolith.cs b/Tiles/AncientMonolith.cs new file mode 100644 index 0000000000..30897c1834 --- /dev/null +++ b/Tiles/AncientMonolith.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientMonolith.png b/Tiles/AncientMonolith.png new file mode 100644 index 0000000000..7ccdf36314 Binary files /dev/null and b/Tiles/AncientMonolith.png differ diff --git a/Tiles/AncientPiano.cs b/Tiles/AncientPiano.cs new file mode 100644 index 0000000000..ac37064001 --- /dev/null +++ b/Tiles/AncientPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientPiano.png b/Tiles/AncientPiano.png new file mode 100644 index 0000000000..cee4861a6c Binary files /dev/null and b/Tiles/AncientPiano.png differ diff --git a/Tiles/AncientSink.cs b/Tiles/AncientSink.cs new file mode 100644 index 0000000000..dd0a2864e4 --- /dev/null +++ b/Tiles/AncientSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientSink.png b/Tiles/AncientSink.png new file mode 100644 index 0000000000..6a5dbf87b0 Binary files /dev/null and b/Tiles/AncientSink.png differ diff --git a/Tiles/AncientSofa.cs b/Tiles/AncientSofa.cs new file mode 100644 index 0000000000..c21bbf6d5a --- /dev/null +++ b/Tiles/AncientSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientSofa.png b/Tiles/AncientSofa.png new file mode 100644 index 0000000000..d9b0265980 Binary files /dev/null and b/Tiles/AncientSofa.png differ diff --git a/Tiles/AncientTable.cs b/Tiles/AncientTable.cs new file mode 100644 index 0000000000..21bc2a1d2e --- /dev/null +++ b/Tiles/AncientTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AncientTable.png b/Tiles/AncientTable.png new file mode 100644 index 0000000000..3ef4a43343 Binary files /dev/null and b/Tiles/AncientTable.png differ diff --git a/Tiles/AncientWorkbench.cs b/Tiles/AncientWorkbench.cs new file mode 100644 index 0000000000..0b95f1b386 --- /dev/null +++ b/Tiles/AncientWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AncientWorkbench.png b/Tiles/AncientWorkbench.png new file mode 100644 index 0000000000..bec2f9e42c Binary files /dev/null and b/Tiles/AncientWorkbench.png differ diff --git a/Tiles/AquaticScourgeMusicbox.cs b/Tiles/AquaticScourgeMusicbox.cs new file mode 100644 index 0000000000..8e8e0e9155 --- /dev/null +++ b/Tiles/AquaticScourgeMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AquaticScourgeMusicbox.png b/Tiles/AquaticScourgeMusicbox.png new file mode 100644 index 0000000000..9b692ecb55 Binary files /dev/null and b/Tiles/AquaticScourgeMusicbox.png differ diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs new file mode 100644 index 0000000000..b2ac5689c4 --- /dev/null +++ b/Tiles/ArenaTile.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/ArenaTile.png b/Tiles/ArenaTile.png new file mode 100644 index 0000000000..58b56c18ae Binary files /dev/null and b/Tiles/ArenaTile.png differ diff --git a/Tiles/AshenAltar.cs b/Tiles/AshenAltar.cs new file mode 100644 index 0000000000..060e0cd184 --- /dev/null +++ b/Tiles/AshenAltar.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenAltar.png b/Tiles/AshenAltar.png new file mode 100644 index 0000000000..97efd831b9 Binary files /dev/null and b/Tiles/AshenAltar.png differ diff --git a/Tiles/AshenBasin.cs b/Tiles/AshenBasin.cs new file mode 100644 index 0000000000..3e5fba6aac --- /dev/null +++ b/Tiles/AshenBasin.cs @@ -0,0 +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); + } + } + } +} diff --git a/Tiles/AshenBasin.png b/Tiles/AshenBasin.png new file mode 100644 index 0000000000..612af949b0 Binary files /dev/null and b/Tiles/AshenBasin.png differ diff --git a/Tiles/AshenBath.cs b/Tiles/AshenBath.cs new file mode 100644 index 0000000000..1c7c8d3daa --- /dev/null +++ b/Tiles/AshenBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenBath.png b/Tiles/AshenBath.png new file mode 100644 index 0000000000..8765339efb Binary files /dev/null and b/Tiles/AshenBath.png differ diff --git a/Tiles/AshenBed.cs b/Tiles/AshenBed.cs new file mode 100644 index 0000000000..a06e8fc994 --- /dev/null +++ b/Tiles/AshenBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenBed.png b/Tiles/AshenBed.png new file mode 100644 index 0000000000..dad8763cba Binary files /dev/null and b/Tiles/AshenBed.png differ diff --git a/Tiles/AshenBed_Highlight.png b/Tiles/AshenBed_Highlight.png new file mode 100644 index 0000000000..18a837cbea Binary files /dev/null and b/Tiles/AshenBed_Highlight.png differ diff --git a/Tiles/AshenBookcase.cs b/Tiles/AshenBookcase.cs new file mode 100644 index 0000000000..1b6f8ec4f7 --- /dev/null +++ b/Tiles/AshenBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenBookcase.png b/Tiles/AshenBookcase.png new file mode 100644 index 0000000000..80e1dd2c19 Binary files /dev/null and b/Tiles/AshenBookcase.png differ diff --git a/Tiles/AshenCandelabra.cs b/Tiles/AshenCandelabra.cs new file mode 100644 index 0000000000..cb9d433ae8 --- /dev/null +++ b/Tiles/AshenCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenCandelabra.png b/Tiles/AshenCandelabra.png new file mode 100644 index 0000000000..a4e438ec95 Binary files /dev/null and b/Tiles/AshenCandelabra.png differ diff --git a/Tiles/AshenCandle.cs b/Tiles/AshenCandle.cs new file mode 100644 index 0000000000..221398e46a --- /dev/null +++ b/Tiles/AshenCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenCandle.png b/Tiles/AshenCandle.png new file mode 100644 index 0000000000..a80034ed8d Binary files /dev/null and b/Tiles/AshenCandle.png differ diff --git a/Tiles/AshenChair.cs b/Tiles/AshenChair.cs new file mode 100644 index 0000000000..c20e0ca924 --- /dev/null +++ b/Tiles/AshenChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenChair.png b/Tiles/AshenChair.png new file mode 100644 index 0000000000..72fadd93e4 Binary files /dev/null and b/Tiles/AshenChair.png differ diff --git a/Tiles/AshenChandelier.cs b/Tiles/AshenChandelier.cs new file mode 100644 index 0000000000..4a5490b4a3 --- /dev/null +++ b/Tiles/AshenChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenChandelier.png b/Tiles/AshenChandelier.png new file mode 100644 index 0000000000..04da9e68c4 Binary files /dev/null and b/Tiles/AshenChandelier.png differ diff --git a/Tiles/AshenChest.cs b/Tiles/AshenChest.cs new file mode 100644 index 0000000000..bc172f6863 --- /dev/null +++ b/Tiles/AshenChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/AshenChest.png b/Tiles/AshenChest.png new file mode 100644 index 0000000000..4f114cfc5a Binary files /dev/null and b/Tiles/AshenChest.png differ diff --git a/Tiles/AshenChestLocked.cs b/Tiles/AshenChestLocked.cs new file mode 100644 index 0000000000..08a6f20850 --- /dev/null +++ b/Tiles/AshenChestLocked.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/AshenChestLocked.png b/Tiles/AshenChestLocked.png new file mode 100644 index 0000000000..2f8ff114e4 Binary files /dev/null and b/Tiles/AshenChestLocked.png differ diff --git a/Tiles/AshenChestLocked_Highlight.png b/Tiles/AshenChestLocked_Highlight.png new file mode 100644 index 0000000000..13fa03f85b Binary files /dev/null and b/Tiles/AshenChestLocked_Highlight.png differ diff --git a/Tiles/AshenChest_Highlight.png b/Tiles/AshenChest_Highlight.png new file mode 100644 index 0000000000..764a5c54ae Binary files /dev/null and b/Tiles/AshenChest_Highlight.png differ diff --git a/Tiles/AshenDoorClosed.cs b/Tiles/AshenDoorClosed.cs new file mode 100644 index 0000000000..0a85e8a832 --- /dev/null +++ b/Tiles/AshenDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenDoorClosed.png b/Tiles/AshenDoorClosed.png new file mode 100644 index 0000000000..44a3e17725 Binary files /dev/null and b/Tiles/AshenDoorClosed.png differ diff --git a/Tiles/AshenDoorClosed_Highlight.png b/Tiles/AshenDoorClosed_Highlight.png new file mode 100644 index 0000000000..743f07f534 Binary files /dev/null and b/Tiles/AshenDoorClosed_Highlight.png differ diff --git a/Tiles/AshenDoorOpen.cs b/Tiles/AshenDoorOpen.cs new file mode 100644 index 0000000000..54c85f3dea --- /dev/null +++ b/Tiles/AshenDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenDoorOpen.png b/Tiles/AshenDoorOpen.png new file mode 100644 index 0000000000..22e92fcf8f Binary files /dev/null and b/Tiles/AshenDoorOpen.png differ diff --git a/Tiles/AshenDoorOpen_Highlight.png b/Tiles/AshenDoorOpen_Highlight.png new file mode 100644 index 0000000000..e7a5d2afcb Binary files /dev/null and b/Tiles/AshenDoorOpen_Highlight.png differ diff --git a/Tiles/AshenDresser.cs b/Tiles/AshenDresser.cs new file mode 100644 index 0000000000..b87dfdb0dd --- /dev/null +++ b/Tiles/AshenDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenDresser.png b/Tiles/AshenDresser.png new file mode 100644 index 0000000000..67ec075d5b Binary files /dev/null and b/Tiles/AshenDresser.png differ diff --git a/Tiles/AshenDresser_Highlight.png b/Tiles/AshenDresser_Highlight.png new file mode 100644 index 0000000000..a600929a47 Binary files /dev/null and b/Tiles/AshenDresser_Highlight.png differ diff --git a/Tiles/AshenLamp.cs b/Tiles/AshenLamp.cs new file mode 100644 index 0000000000..62c2a6be85 --- /dev/null +++ b/Tiles/AshenLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenLamp.png b/Tiles/AshenLamp.png new file mode 100644 index 0000000000..504a43e12c Binary files /dev/null and b/Tiles/AshenLamp.png differ diff --git a/Tiles/AshenLantern.cs b/Tiles/AshenLantern.cs new file mode 100644 index 0000000000..eae3cac0e5 --- /dev/null +++ b/Tiles/AshenLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/AshenLantern.png b/Tiles/AshenLantern.png new file mode 100644 index 0000000000..2af3caec8b Binary files /dev/null and b/Tiles/AshenLantern.png differ diff --git a/Tiles/AshenMonolith.cs b/Tiles/AshenMonolith.cs new file mode 100644 index 0000000000..f54a631168 --- /dev/null +++ b/Tiles/AshenMonolith.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenMonolith.png b/Tiles/AshenMonolith.png new file mode 100644 index 0000000000..bf77a8d07e Binary files /dev/null and b/Tiles/AshenMonolith.png differ diff --git a/Tiles/AshenPiano.cs b/Tiles/AshenPiano.cs new file mode 100644 index 0000000000..4c1ab3a306 --- /dev/null +++ b/Tiles/AshenPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenPiano.png b/Tiles/AshenPiano.png new file mode 100644 index 0000000000..505f9fe98e Binary files /dev/null and b/Tiles/AshenPiano.png differ diff --git a/Tiles/AshenPlatform.cs b/Tiles/AshenPlatform.cs new file mode 100644 index 0000000000..ff617615c4 --- /dev/null +++ b/Tiles/AshenPlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AshenPlatform.png b/Tiles/AshenPlatform.png new file mode 100644 index 0000000000..2ec8741d0f Binary files /dev/null and b/Tiles/AshenPlatform.png differ diff --git a/Tiles/AshenSink.cs b/Tiles/AshenSink.cs new file mode 100644 index 0000000000..09905de9a4 --- /dev/null +++ b/Tiles/AshenSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenSink.png b/Tiles/AshenSink.png new file mode 100644 index 0000000000..d5f86aa88c Binary files /dev/null and b/Tiles/AshenSink.png differ diff --git a/Tiles/AshenSlab.cs b/Tiles/AshenSlab.cs new file mode 100644 index 0000000000..516338ee34 --- /dev/null +++ b/Tiles/AshenSlab.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AshenSlab.png b/Tiles/AshenSlab.png new file mode 100644 index 0000000000..62ac5ecea7 Binary files /dev/null and b/Tiles/AshenSlab.png differ diff --git a/Tiles/AshenSofa.cs b/Tiles/AshenSofa.cs new file mode 100644 index 0000000000..8d6c02ddfe --- /dev/null +++ b/Tiles/AshenSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenSofa.png b/Tiles/AshenSofa.png new file mode 100644 index 0000000000..84703a314e Binary files /dev/null and b/Tiles/AshenSofa.png differ diff --git a/Tiles/AshenTable.cs b/Tiles/AshenTable.cs new file mode 100644 index 0000000000..8b81155132 --- /dev/null +++ b/Tiles/AshenTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/AshenTable.png b/Tiles/AshenTable.png new file mode 100644 index 0000000000..d2feb5325a Binary files /dev/null and b/Tiles/AshenTable.png differ diff --git a/Tiles/AshenWorkbench.cs b/Tiles/AshenWorkbench.cs new file mode 100644 index 0000000000..1041318294 --- /dev/null +++ b/Tiles/AshenWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/AshenWorkbench.png b/Tiles/AshenWorkbench.png new file mode 100644 index 0000000000..448b44172b Binary files /dev/null and b/Tiles/AshenWorkbench.png differ diff --git a/Tiles/AstrageldonMusicbox.cs b/Tiles/AstrageldonMusicbox.cs new file mode 100644 index 0000000000..5c3bdcfa97 --- /dev/null +++ b/Tiles/AstrageldonMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AstrageldonMusicbox.png b/Tiles/AstrageldonMusicbox.png new file mode 100644 index 0000000000..671ad56029 Binary files /dev/null and b/Tiles/AstrageldonMusicbox.png differ diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs new file mode 100644 index 0000000000..2329540a98 --- /dev/null +++ b/Tiles/AstralBrick.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AstralBrick.png b/Tiles/AstralBrick.png new file mode 100644 index 0000000000..b01b3c2310 Binary files /dev/null and b/Tiles/AstralBrick.png differ diff --git a/Tiles/AstralMusicbox.cs b/Tiles/AstralMusicbox.cs new file mode 100644 index 0000000000..c211becfda --- /dev/null +++ b/Tiles/AstralMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/AstralMusicbox.png b/Tiles/AstralMusicbox.png new file mode 100644 index 0000000000..3b4c233818 Binary files /dev/null and b/Tiles/AstralMusicbox.png differ diff --git a/Tiles/AstralOre.cs b/Tiles/AstralOre.cs new file mode 100644 index 0000000000..372094c193 --- /dev/null +++ b/Tiles/AstralOre.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AstralOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 700; + minPick = 199; + dustType = 173; + drop = mod.ItemType("AstralOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Ore"); + AddMapEntry(new Color(255, 153, 255), name); + mineResist = 5f; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return CalamityWorld.downedStarGod; + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedStarGod; + } + + 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/AstralOre.png b/Tiles/AstralOre.png new file mode 100644 index 0000000000..7e595eb939 Binary files /dev/null and b/Tiles/AstralOre.png differ diff --git a/Tiles/AuricOre.cs b/Tiles/AuricOre.cs new file mode 100644 index 0000000000..506fbba23e --- /dev/null +++ b/Tiles/AuricOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/AuricOre.png b/Tiles/AuricOre.png new file mode 100644 index 0000000000..b61dcaafe6 Binary files /dev/null and b/Tiles/AuricOre.png differ diff --git a/Tiles/BossTrophy.cs b/Tiles/BossTrophy.cs new file mode 100644 index 0000000000..e198815ae6 --- /dev/null +++ b/Tiles/BossTrophy.cs @@ -0,0 +1,103 @@ +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; + } + if (item > 0) + { + Item.NewItem(i * 16, j * 16, 48, 48, item); + } + } + } +} \ No newline at end of file diff --git a/Tiles/BossTrophy.png b/Tiles/BossTrophy.png new file mode 100644 index 0000000000..af61e592cb Binary files /dev/null and b/Tiles/BossTrophy.png differ diff --git a/Tiles/BrimstoneSlag.cs b/Tiles/BrimstoneSlag.cs new file mode 100644 index 0000000000..35e9a59ac7 --- /dev/null +++ b/Tiles/BrimstoneSlag.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/BrimstoneSlag.png b/Tiles/BrimstoneSlag.png new file mode 100644 index 0000000000..b605ca56a9 Binary files /dev/null and b/Tiles/BrimstoneSlag.png differ diff --git a/Tiles/CalamitasMusicbox.cs b/Tiles/CalamitasMusicbox.cs new file mode 100644 index 0000000000..de5ae2f287 --- /dev/null +++ b/Tiles/CalamitasMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CalamitasMusicbox.png b/Tiles/CalamitasMusicbox.png new file mode 100644 index 0000000000..518c458a6b Binary files /dev/null and b/Tiles/CalamitasMusicbox.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs new file mode 100644 index 0000000000..f98f5c3816 --- /dev/null +++ b/Tiles/CalamityGlobalTile.cs @@ -0,0 +1,446 @@ +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 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); + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/Tiles/CeaselessVoidMusicbox.cs b/Tiles/CeaselessVoidMusicbox.cs new file mode 100644 index 0000000000..3e07f984cb --- /dev/null +++ b/Tiles/CeaselessVoidMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CeaselessVoidMusicbox.png b/Tiles/CeaselessVoidMusicbox.png new file mode 100644 index 0000000000..a3fe8be322 Binary files /dev/null and b/Tiles/CeaselessVoidMusicbox.png differ diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs new file mode 100644 index 0000000000..c9ffbb95bd --- /dev/null +++ b/Tiles/ChaoticBrick.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ChaoticBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 105; + drop = mod.ItemType("ChaoticBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Brick"); + AddMapEntry(new Color(255, 0, 0), name); + soundType = 21; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.04f; + g = 0.00f; + b = 0.00f; + } + } +} \ No newline at end of file diff --git a/Tiles/ChaoticBrick.png b/Tiles/ChaoticBrick.png new file mode 100644 index 0000000000..214ef48da6 Binary files /dev/null and b/Tiles/ChaoticBrick.png differ diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs new file mode 100644 index 0000000000..4c62905a9f --- /dev/null +++ b/Tiles/ChaoticOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/ChaoticOre.png b/Tiles/ChaoticOre.png new file mode 100644 index 0000000000..16c7a065f0 Binary files /dev/null and b/Tiles/ChaoticOre.png differ diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs new file mode 100644 index 0000000000..6ffb490bcc --- /dev/null +++ b/Tiles/CharredOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/CharredOre.png b/Tiles/CharredOre.png new file mode 100644 index 0000000000..da18419e16 Binary files /dev/null and b/Tiles/CharredOre.png differ diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs new file mode 100644 index 0000000000..cea9f5f437 --- /dev/null +++ b/Tiles/Cinderplate.cs @@ -0,0 +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; + } + } +} diff --git a/Tiles/Cinderplate.png b/Tiles/Cinderplate.png new file mode 100644 index 0000000000..616f5e4692 Binary files /dev/null and b/Tiles/Cinderplate.png differ diff --git a/Tiles/CosmiliteBath.cs b/Tiles/CosmiliteBath.cs new file mode 100644 index 0000000000..d9eba79ae0 --- /dev/null +++ b/Tiles/CosmiliteBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmiliteBath.png b/Tiles/CosmiliteBath.png new file mode 100644 index 0000000000..8b4b5d2f61 Binary files /dev/null and b/Tiles/CosmiliteBath.png differ diff --git a/Tiles/CosmiliteBed.cs b/Tiles/CosmiliteBed.cs new file mode 100644 index 0000000000..774bc9bfe8 --- /dev/null +++ b/Tiles/CosmiliteBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteBed.png b/Tiles/CosmiliteBed.png new file mode 100644 index 0000000000..44951b1a63 Binary files /dev/null and b/Tiles/CosmiliteBed.png differ diff --git a/Tiles/CosmiliteBed_Highlight.png b/Tiles/CosmiliteBed_Highlight.png new file mode 100644 index 0000000000..db66dd9665 Binary files /dev/null and b/Tiles/CosmiliteBed_Highlight.png differ diff --git a/Tiles/CosmiliteBookcase.cs b/Tiles/CosmiliteBookcase.cs new file mode 100644 index 0000000000..c3bdeecfa7 --- /dev/null +++ b/Tiles/CosmiliteBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmiliteBookcase.png b/Tiles/CosmiliteBookcase.png new file mode 100644 index 0000000000..0ad2fce371 Binary files /dev/null and b/Tiles/CosmiliteBookcase.png differ diff --git a/Tiles/CosmiliteBrick.cs b/Tiles/CosmiliteBrick.cs new file mode 100644 index 0000000000..67259bb310 --- /dev/null +++ b/Tiles/CosmiliteBrick.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteBrick.png b/Tiles/CosmiliteBrick.png new file mode 100644 index 0000000000..07d00683b2 Binary files /dev/null and b/Tiles/CosmiliteBrick.png differ diff --git a/Tiles/CosmiliteCandelabra.cs b/Tiles/CosmiliteCandelabra.cs new file mode 100644 index 0000000000..df7bb7e2e5 --- /dev/null +++ b/Tiles/CosmiliteCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteCandelabra.png b/Tiles/CosmiliteCandelabra.png new file mode 100644 index 0000000000..e59fbb6a81 Binary files /dev/null and b/Tiles/CosmiliteCandelabra.png differ diff --git a/Tiles/CosmiliteCandle.cs b/Tiles/CosmiliteCandle.cs new file mode 100644 index 0000000000..6a0e6bef44 --- /dev/null +++ b/Tiles/CosmiliteCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteCandle.png b/Tiles/CosmiliteCandle.png new file mode 100644 index 0000000000..b3448de130 Binary files /dev/null and b/Tiles/CosmiliteCandle.png differ diff --git a/Tiles/CosmiliteChair.cs b/Tiles/CosmiliteChair.cs new file mode 100644 index 0000000000..bdfdf62bd0 --- /dev/null +++ b/Tiles/CosmiliteChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteChair.png b/Tiles/CosmiliteChair.png new file mode 100644 index 0000000000..079a927051 Binary files /dev/null and b/Tiles/CosmiliteChair.png differ diff --git a/Tiles/CosmiliteChandelier.cs b/Tiles/CosmiliteChandelier.cs new file mode 100644 index 0000000000..5b0a7b6fa9 --- /dev/null +++ b/Tiles/CosmiliteChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteChandelier.png b/Tiles/CosmiliteChandelier.png new file mode 100644 index 0000000000..c0f5f3565c Binary files /dev/null and b/Tiles/CosmiliteChandelier.png differ diff --git a/Tiles/CosmiliteChest.cs b/Tiles/CosmiliteChest.cs new file mode 100644 index 0000000000..7931725847 --- /dev/null +++ b/Tiles/CosmiliteChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteChest.png b/Tiles/CosmiliteChest.png new file mode 100644 index 0000000000..2abba49572 Binary files /dev/null and b/Tiles/CosmiliteChest.png differ diff --git a/Tiles/CosmiliteChest_Highlight.png b/Tiles/CosmiliteChest_Highlight.png new file mode 100644 index 0000000000..a20468f66f Binary files /dev/null and b/Tiles/CosmiliteChest_Highlight.png differ diff --git a/Tiles/CosmiliteClock.cs b/Tiles/CosmiliteClock.cs new file mode 100644 index 0000000000..c88a928dae --- /dev/null +++ b/Tiles/CosmiliteClock.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteClock.png b/Tiles/CosmiliteClock.png new file mode 100644 index 0000000000..cc876e8246 Binary files /dev/null and b/Tiles/CosmiliteClock.png differ diff --git a/Tiles/CosmiliteDoorClosed.cs b/Tiles/CosmiliteDoorClosed.cs new file mode 100644 index 0000000000..d0df303271 --- /dev/null +++ b/Tiles/CosmiliteDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteDoorClosed.png b/Tiles/CosmiliteDoorClosed.png new file mode 100644 index 0000000000..e815c08308 Binary files /dev/null and b/Tiles/CosmiliteDoorClosed.png differ diff --git a/Tiles/CosmiliteDoorClosed_Highlight.png b/Tiles/CosmiliteDoorClosed_Highlight.png new file mode 100644 index 0000000000..1efe62c53d Binary files /dev/null and b/Tiles/CosmiliteDoorClosed_Highlight.png differ diff --git a/Tiles/CosmiliteDoorOpen.cs b/Tiles/CosmiliteDoorOpen.cs new file mode 100644 index 0000000000..1bd58f7065 --- /dev/null +++ b/Tiles/CosmiliteDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteDoorOpen.png b/Tiles/CosmiliteDoorOpen.png new file mode 100644 index 0000000000..940c3388ee Binary files /dev/null and b/Tiles/CosmiliteDoorOpen.png differ diff --git a/Tiles/CosmiliteDoorOpen_Highlight.png b/Tiles/CosmiliteDoorOpen_Highlight.png new file mode 100644 index 0000000000..329f723ad6 Binary files /dev/null and b/Tiles/CosmiliteDoorOpen_Highlight.png differ diff --git a/Tiles/CosmiliteDresser.cs b/Tiles/CosmiliteDresser.cs new file mode 100644 index 0000000000..58003383a5 --- /dev/null +++ b/Tiles/CosmiliteDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteDresser.png b/Tiles/CosmiliteDresser.png new file mode 100644 index 0000000000..25a3d5861e Binary files /dev/null and b/Tiles/CosmiliteDresser.png differ diff --git a/Tiles/CosmiliteDresser_Highlight.png b/Tiles/CosmiliteDresser_Highlight.png new file mode 100644 index 0000000000..0b4f7c7b91 Binary files /dev/null and b/Tiles/CosmiliteDresser_Highlight.png differ diff --git a/Tiles/CosmiliteLamp.cs b/Tiles/CosmiliteLamp.cs new file mode 100644 index 0000000000..17d1802d98 --- /dev/null +++ b/Tiles/CosmiliteLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteLamp.png b/Tiles/CosmiliteLamp.png new file mode 100644 index 0000000000..a5be123eaf Binary files /dev/null and b/Tiles/CosmiliteLamp.png differ diff --git a/Tiles/CosmiliteLantern.cs b/Tiles/CosmiliteLantern.cs new file mode 100644 index 0000000000..ddcf709884 --- /dev/null +++ b/Tiles/CosmiliteLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/CosmiliteLantern.png b/Tiles/CosmiliteLantern.png new file mode 100644 index 0000000000..dace9af46d Binary files /dev/null and b/Tiles/CosmiliteLantern.png differ diff --git a/Tiles/CosmilitePiano.cs b/Tiles/CosmilitePiano.cs new file mode 100644 index 0000000000..c1134290bd --- /dev/null +++ b/Tiles/CosmilitePiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmilitePiano.png b/Tiles/CosmilitePiano.png new file mode 100644 index 0000000000..3a6918e5cd Binary files /dev/null and b/Tiles/CosmilitePiano.png differ diff --git a/Tiles/CosmilitePlatform.cs b/Tiles/CosmilitePlatform.cs new file mode 100644 index 0000000000..d76a937a80 --- /dev/null +++ b/Tiles/CosmilitePlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/CosmilitePlatform.png b/Tiles/CosmilitePlatform.png new file mode 100644 index 0000000000..32db5094b4 Binary files /dev/null and b/Tiles/CosmilitePlatform.png differ diff --git a/Tiles/CosmiliteSink.cs b/Tiles/CosmiliteSink.cs new file mode 100644 index 0000000000..be8f0a780f --- /dev/null +++ b/Tiles/CosmiliteSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmiliteSink.png b/Tiles/CosmiliteSink.png new file mode 100644 index 0000000000..1c73eddaff Binary files /dev/null and b/Tiles/CosmiliteSink.png differ diff --git a/Tiles/CosmiliteSofa.cs b/Tiles/CosmiliteSofa.cs new file mode 100644 index 0000000000..d6323425d6 --- /dev/null +++ b/Tiles/CosmiliteSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmiliteSofa.png b/Tiles/CosmiliteSofa.png new file mode 100644 index 0000000000..8a37e7e91f Binary files /dev/null and b/Tiles/CosmiliteSofa.png differ diff --git a/Tiles/CosmiliteTable.cs b/Tiles/CosmiliteTable.cs new file mode 100644 index 0000000000..487815d76d --- /dev/null +++ b/Tiles/CosmiliteTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/CosmiliteTable.png b/Tiles/CosmiliteTable.png new file mode 100644 index 0000000000..cba7b192b0 Binary files /dev/null and b/Tiles/CosmiliteTable.png differ diff --git a/Tiles/CosmiliteWorkbench.cs b/Tiles/CosmiliteWorkbench.cs new file mode 100644 index 0000000000..2495d88bd0 --- /dev/null +++ b/Tiles/CosmiliteWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/CosmiliteWorkbench.png b/Tiles/CosmiliteWorkbench.png new file mode 100644 index 0000000000..ab88f2148e Binary files /dev/null and b/Tiles/CosmiliteWorkbench.png differ diff --git a/Tiles/CrabulonMusicbox.cs b/Tiles/CrabulonMusicbox.cs new file mode 100644 index 0000000000..d34568f796 --- /dev/null +++ b/Tiles/CrabulonMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CrabulonMusicbox.png b/Tiles/CrabulonMusicbox.png new file mode 100644 index 0000000000..e887c2b4cf Binary files /dev/null and b/Tiles/CrabulonMusicbox.png differ diff --git a/Tiles/CryogenMusicbox.cs b/Tiles/CryogenMusicbox.cs new file mode 100644 index 0000000000..634743e74a --- /dev/null +++ b/Tiles/CryogenMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/CryogenMusicbox.png b/Tiles/CryogenMusicbox.png new file mode 100644 index 0000000000..7630266fea Binary files /dev/null and b/Tiles/CryogenMusicbox.png differ diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs new file mode 100644 index 0000000000..a23aa9d22d --- /dev/null +++ b/Tiles/CryonicBrick.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/CryonicBrick.png b/Tiles/CryonicBrick.png new file mode 100644 index 0000000000..b9c335fe4d Binary files /dev/null and b/Tiles/CryonicBrick.png differ diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs new file mode 100644 index 0000000000..8a5d4a8294 --- /dev/null +++ b/Tiles/CryonicOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/CryonicOre.png b/Tiles/CryonicOre.png new file mode 100644 index 0000000000..8c8bd42042 Binary files /dev/null and b/Tiles/CryonicOre.png differ diff --git a/Tiles/DesertScourgeMusicbox.cs b/Tiles/DesertScourgeMusicbox.cs new file mode 100644 index 0000000000..531672833e --- /dev/null +++ b/Tiles/DesertScourgeMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/DesertScourgeMusicbox.png b/Tiles/DesertScourgeMusicbox.png new file mode 100644 index 0000000000..82ec1a3227 Binary files /dev/null and b/Tiles/DesertScourgeMusicbox.png differ diff --git a/Tiles/DoGMusicbox.cs b/Tiles/DoGMusicbox.cs new file mode 100644 index 0000000000..ded0aa1d14 --- /dev/null +++ b/Tiles/DoGMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/DoGMusicbox.png b/Tiles/DoGMusicbox.png new file mode 100644 index 0000000000..2827827de0 Binary files /dev/null and b/Tiles/DoGMusicbox.png differ diff --git a/Tiles/DraedonsForge.cs b/Tiles/DraedonsForge.cs new file mode 100644 index 0000000000..575e7359fc --- /dev/null +++ b/Tiles/DraedonsForge.cs @@ -0,0 +1,53 @@ +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 }; + } + + 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/DraedonsForge.png b/Tiles/DraedonsForge.png new file mode 100644 index 0000000000..c61bdd80c5 Binary files /dev/null and b/Tiles/DraedonsForge.png differ diff --git a/Tiles/EutrophicSand.cs b/Tiles/EutrophicSand.cs new file mode 100644 index 0000000000..f2b96a38ec --- /dev/null +++ b/Tiles/EutrophicSand.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/EutrophicSand.png b/Tiles/EutrophicSand.png new file mode 100644 index 0000000000..603cc1b751 Binary files /dev/null and b/Tiles/EutrophicSand.png differ diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs new file mode 100644 index 0000000000..c6a9c29bce --- /dev/null +++ b/Tiles/ExodiumOre.cs @@ -0,0 +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; + } + } +} diff --git a/Tiles/ExodiumOre.png b/Tiles/ExodiumOre.png new file mode 100644 index 0000000000..d18de4c920 Binary files /dev/null and b/Tiles/ExodiumOre.png differ diff --git a/Tiles/HigherAbyssMusicbox.cs b/Tiles/HigherAbyssMusicbox.cs new file mode 100644 index 0000000000..4ed6763c29 --- /dev/null +++ b/Tiles/HigherAbyssMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/HigherAbyssMusicbox.png b/Tiles/HigherAbyssMusicbox.png new file mode 100644 index 0000000000..3e150c84ec Binary files /dev/null and b/Tiles/HigherAbyssMusicbox.png differ diff --git a/Tiles/HiveMindMusicbox.cs b/Tiles/HiveMindMusicbox.cs new file mode 100644 index 0000000000..7582f036f4 --- /dev/null +++ b/Tiles/HiveMindMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/HiveMindMusicbox.png b/Tiles/HiveMindMusicbox.png new file mode 100644 index 0000000000..d9c45801cb Binary files /dev/null and b/Tiles/HiveMindMusicbox.png differ diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs new file mode 100644 index 0000000000..ad41be4bec --- /dev/null +++ b/Tiles/PerennialBrick.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/PerennialBrick.png b/Tiles/PerennialBrick.png new file mode 100644 index 0000000000..9f7cba5415 Binary files /dev/null and b/Tiles/PerennialBrick.png differ diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs new file mode 100644 index 0000000000..ae21ec8be2 --- /dev/null +++ b/Tiles/PerennialOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/PerennialOre.png b/Tiles/PerennialOre.png new file mode 100644 index 0000000000..e381504d28 Binary files /dev/null and b/Tiles/PerennialOre.png differ diff --git a/Tiles/PerforatorMusicbox.cs b/Tiles/PerforatorMusicbox.cs new file mode 100644 index 0000000000..4283915d74 --- /dev/null +++ b/Tiles/PerforatorMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/PerforatorMusicbox.png b/Tiles/PerforatorMusicbox.png new file mode 100644 index 0000000000..d0181bf1f9 Binary files /dev/null and b/Tiles/PerforatorMusicbox.png differ diff --git a/Tiles/PlaguebringerMusicbox.cs b/Tiles/PlaguebringerMusicbox.cs new file mode 100644 index 0000000000..5be4578e40 --- /dev/null +++ b/Tiles/PlaguebringerMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/PlaguebringerMusicbox.png b/Tiles/PlaguebringerMusicbox.png new file mode 100644 index 0000000000..aca89d5e80 Binary files /dev/null and b/Tiles/PlaguebringerMusicbox.png differ diff --git a/Tiles/PlantyMush.cs b/Tiles/PlantyMush.cs new file mode 100644 index 0000000000..76232c53aa --- /dev/null +++ b/Tiles/PlantyMush.cs @@ -0,0 +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); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/PlantyMush.png b/Tiles/PlantyMush.png new file mode 100644 index 0000000000..4342ec2884 Binary files /dev/null and b/Tiles/PlantyMush.png differ diff --git a/Tiles/PolterghastMusicbox.cs b/Tiles/PolterghastMusicbox.cs new file mode 100644 index 0000000000..8d5488668b --- /dev/null +++ b/Tiles/PolterghastMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/PolterghastMusicbox.png b/Tiles/PolterghastMusicbox.png new file mode 100644 index 0000000000..9d0c758b18 Binary files /dev/null and b/Tiles/PolterghastMusicbox.png differ diff --git a/Tiles/ProfanedBath.cs b/Tiles/ProfanedBath.cs new file mode 100644 index 0000000000..09128563ef --- /dev/null +++ b/Tiles/ProfanedBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedBath.png b/Tiles/ProfanedBath.png new file mode 100644 index 0000000000..a0556a768d Binary files /dev/null and b/Tiles/ProfanedBath.png differ diff --git a/Tiles/ProfanedBed.cs b/Tiles/ProfanedBed.cs new file mode 100644 index 0000000000..bf4e760541 --- /dev/null +++ b/Tiles/ProfanedBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedBed.png b/Tiles/ProfanedBed.png new file mode 100644 index 0000000000..fbca11e14e Binary files /dev/null and b/Tiles/ProfanedBed.png differ diff --git a/Tiles/ProfanedBed_Highlight.png b/Tiles/ProfanedBed_Highlight.png new file mode 100644 index 0000000000..2506b6f412 Binary files /dev/null and b/Tiles/ProfanedBed_Highlight.png differ diff --git a/Tiles/ProfanedBench.cs b/Tiles/ProfanedBench.cs new file mode 100644 index 0000000000..06694fc410 --- /dev/null +++ b/Tiles/ProfanedBench.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedBench.png b/Tiles/ProfanedBench.png new file mode 100644 index 0000000000..a68d7df692 Binary files /dev/null and b/Tiles/ProfanedBench.png differ diff --git a/Tiles/ProfanedBookcase.cs b/Tiles/ProfanedBookcase.cs new file mode 100644 index 0000000000..fa87d0b2fd --- /dev/null +++ b/Tiles/ProfanedBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedBookcase.png b/Tiles/ProfanedBookcase.png new file mode 100644 index 0000000000..34fdc5342e Binary files /dev/null and b/Tiles/ProfanedBookcase.png differ diff --git a/Tiles/ProfanedCandelabra.cs b/Tiles/ProfanedCandelabra.cs new file mode 100644 index 0000000000..aa632129a3 --- /dev/null +++ b/Tiles/ProfanedCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedCandelabra.png b/Tiles/ProfanedCandelabra.png new file mode 100644 index 0000000000..8e5a6df0af Binary files /dev/null and b/Tiles/ProfanedCandelabra.png differ diff --git a/Tiles/ProfanedCandle.cs b/Tiles/ProfanedCandle.cs new file mode 100644 index 0000000000..290e681d7c --- /dev/null +++ b/Tiles/ProfanedCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedCandle.png b/Tiles/ProfanedCandle.png new file mode 100644 index 0000000000..a6ef62cb04 Binary files /dev/null and b/Tiles/ProfanedCandle.png differ diff --git a/Tiles/ProfanedChair.cs b/Tiles/ProfanedChair.cs new file mode 100644 index 0000000000..aff116a60a --- /dev/null +++ b/Tiles/ProfanedChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedChair.png b/Tiles/ProfanedChair.png new file mode 100644 index 0000000000..db114d0eb4 Binary files /dev/null and b/Tiles/ProfanedChair.png differ diff --git a/Tiles/ProfanedChandelier.cs b/Tiles/ProfanedChandelier.cs new file mode 100644 index 0000000000..ab19eeb698 --- /dev/null +++ b/Tiles/ProfanedChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedChandelier.png b/Tiles/ProfanedChandelier.png new file mode 100644 index 0000000000..b90c59d4d4 Binary files /dev/null and b/Tiles/ProfanedChandelier.png differ diff --git a/Tiles/ProfanedChest.cs b/Tiles/ProfanedChest.cs new file mode 100644 index 0000000000..68cbb16e10 --- /dev/null +++ b/Tiles/ProfanedChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedChest.png b/Tiles/ProfanedChest.png new file mode 100644 index 0000000000..9b6d61f7fa Binary files /dev/null and b/Tiles/ProfanedChest.png differ diff --git a/Tiles/ProfanedChest_Highlight.png b/Tiles/ProfanedChest_Highlight.png new file mode 100644 index 0000000000..8c4e6f91ea Binary files /dev/null and b/Tiles/ProfanedChest_Highlight.png differ diff --git a/Tiles/ProfanedClock.cs b/Tiles/ProfanedClock.cs new file mode 100644 index 0000000000..9a68c51b6a --- /dev/null +++ b/Tiles/ProfanedClock.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedClock.png b/Tiles/ProfanedClock.png new file mode 100644 index 0000000000..8f5c0098eb Binary files /dev/null and b/Tiles/ProfanedClock.png differ diff --git a/Tiles/ProfanedCrystal.cs b/Tiles/ProfanedCrystal.cs new file mode 100644 index 0000000000..fbc723f203 --- /dev/null +++ b/Tiles/ProfanedCrystal.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedCrystal.png b/Tiles/ProfanedCrystal.png new file mode 100644 index 0000000000..0659980702 Binary files /dev/null and b/Tiles/ProfanedCrystal.png differ diff --git a/Tiles/ProfanedDoorClosed.cs b/Tiles/ProfanedDoorClosed.cs new file mode 100644 index 0000000000..00904812ae --- /dev/null +++ b/Tiles/ProfanedDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedDoorClosed.png b/Tiles/ProfanedDoorClosed.png new file mode 100644 index 0000000000..db729a1e60 Binary files /dev/null and b/Tiles/ProfanedDoorClosed.png differ diff --git a/Tiles/ProfanedDoorClosed_Highlight.png b/Tiles/ProfanedDoorClosed_Highlight.png new file mode 100644 index 0000000000..9dcd402c0b Binary files /dev/null and b/Tiles/ProfanedDoorClosed_Highlight.png differ diff --git a/Tiles/ProfanedDoorOpen.cs b/Tiles/ProfanedDoorOpen.cs new file mode 100644 index 0000000000..0768da6295 --- /dev/null +++ b/Tiles/ProfanedDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedDoorOpen.png b/Tiles/ProfanedDoorOpen.png new file mode 100644 index 0000000000..72ce481a57 Binary files /dev/null and b/Tiles/ProfanedDoorOpen.png differ diff --git a/Tiles/ProfanedDoorOpen_Highlight.png b/Tiles/ProfanedDoorOpen_Highlight.png new file mode 100644 index 0000000000..1f725efb92 Binary files /dev/null and b/Tiles/ProfanedDoorOpen_Highlight.png differ diff --git a/Tiles/ProfanedDresser.cs b/Tiles/ProfanedDresser.cs new file mode 100644 index 0000000000..74764c2954 --- /dev/null +++ b/Tiles/ProfanedDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedDresser.png b/Tiles/ProfanedDresser.png new file mode 100644 index 0000000000..3f5a7ef6c1 Binary files /dev/null and b/Tiles/ProfanedDresser.png differ diff --git a/Tiles/ProfanedDresser_Highlight.png b/Tiles/ProfanedDresser_Highlight.png new file mode 100644 index 0000000000..cf03b5e1a3 Binary files /dev/null and b/Tiles/ProfanedDresser_Highlight.png differ diff --git a/Tiles/ProfanedGuardianMusicbox.cs b/Tiles/ProfanedGuardianMusicbox.cs new file mode 100644 index 0000000000..24bbbde9a5 --- /dev/null +++ b/Tiles/ProfanedGuardianMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedGuardianMusicbox.png b/Tiles/ProfanedGuardianMusicbox.png new file mode 100644 index 0000000000..2392df1389 Binary files /dev/null and b/Tiles/ProfanedGuardianMusicbox.png differ diff --git a/Tiles/ProfanedLamp.cs b/Tiles/ProfanedLamp.cs new file mode 100644 index 0000000000..6b60f24bda --- /dev/null +++ b/Tiles/ProfanedLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedLamp.png b/Tiles/ProfanedLamp.png new file mode 100644 index 0000000000..92cf7b627b Binary files /dev/null and b/Tiles/ProfanedLamp.png differ diff --git a/Tiles/ProfanedLantern.cs b/Tiles/ProfanedLantern.cs new file mode 100644 index 0000000000..5299b98ba2 --- /dev/null +++ b/Tiles/ProfanedLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/ProfanedLantern.png b/Tiles/ProfanedLantern.png new file mode 100644 index 0000000000..fae6a6e98a Binary files /dev/null and b/Tiles/ProfanedLantern.png differ diff --git a/Tiles/ProfanedPiano.cs b/Tiles/ProfanedPiano.cs new file mode 100644 index 0000000000..61a1575ee0 --- /dev/null +++ b/Tiles/ProfanedPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedPiano.png b/Tiles/ProfanedPiano.png new file mode 100644 index 0000000000..69d08405a1 Binary files /dev/null and b/Tiles/ProfanedPiano.png differ diff --git a/Tiles/ProfanedPlatform.cs b/Tiles/ProfanedPlatform.cs new file mode 100644 index 0000000000..566c94763f --- /dev/null +++ b/Tiles/ProfanedPlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedPlatform.png b/Tiles/ProfanedPlatform.png new file mode 100644 index 0000000000..0a2f53c570 Binary files /dev/null and b/Tiles/ProfanedPlatform.png differ diff --git a/Tiles/ProfanedRock.cs b/Tiles/ProfanedRock.cs new file mode 100644 index 0000000000..f8b833fe05 --- /dev/null +++ b/Tiles/ProfanedRock.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedRock.png b/Tiles/ProfanedRock.png new file mode 100644 index 0000000000..f2806929fd Binary files /dev/null and b/Tiles/ProfanedRock.png differ diff --git a/Tiles/ProfanedSink.cs b/Tiles/ProfanedSink.cs new file mode 100644 index 0000000000..2422823e9e --- /dev/null +++ b/Tiles/ProfanedSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedSink.png b/Tiles/ProfanedSink.png new file mode 100644 index 0000000000..7008f9ec75 Binary files /dev/null and b/Tiles/ProfanedSink.png differ diff --git a/Tiles/ProfanedSlab.cs b/Tiles/ProfanedSlab.cs new file mode 100644 index 0000000000..80995fc80a --- /dev/null +++ b/Tiles/ProfanedSlab.cs @@ -0,0 +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; + // } + // } + //} + } +} \ No newline at end of file diff --git a/Tiles/ProfanedSlab.png b/Tiles/ProfanedSlab.png new file mode 100644 index 0000000000..eb09a0b13e Binary files /dev/null and b/Tiles/ProfanedSlab.png differ diff --git a/Tiles/ProfanedTable.cs b/Tiles/ProfanedTable.cs new file mode 100644 index 0000000000..6c3c40c09f --- /dev/null +++ b/Tiles/ProfanedTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/ProfanedTable.png b/Tiles/ProfanedTable.png new file mode 100644 index 0000000000..daf03ad6df Binary files /dev/null and b/Tiles/ProfanedTable.png differ diff --git a/Tiles/ProfanedWorkbench.cs b/Tiles/ProfanedWorkbench.cs new file mode 100644 index 0000000000..bd2fca5779 --- /dev/null +++ b/Tiles/ProfanedWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/ProfanedWorkbench.png b/Tiles/ProfanedWorkbench.png new file mode 100644 index 0000000000..e0ae9df84f Binary files /dev/null and b/Tiles/ProfanedWorkbench.png differ diff --git a/Tiles/ProvidenceMusicbox.cs b/Tiles/ProvidenceMusicbox.cs new file mode 100644 index 0000000000..e1457df8d0 --- /dev/null +++ b/Tiles/ProvidenceMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/ProvidenceMusicbox.png b/Tiles/ProvidenceMusicbox.png new file mode 100644 index 0000000000..79b332f1a9 Binary files /dev/null and b/Tiles/ProvidenceMusicbox.png differ diff --git a/Tiles/RavagerMusicbox.cs b/Tiles/RavagerMusicbox.cs new file mode 100644 index 0000000000..b131dc4120 --- /dev/null +++ b/Tiles/RavagerMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/RavagerMusicbox.png b/Tiles/RavagerMusicbox.png new file mode 100644 index 0000000000..2fdbee2622 Binary files /dev/null and b/Tiles/RavagerMusicbox.png differ diff --git a/Tiles/RunicProfanedBrick.cs b/Tiles/RunicProfanedBrick.cs new file mode 100644 index 0000000000..187345634f --- /dev/null +++ b/Tiles/RunicProfanedBrick.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/RunicProfanedBrick.png b/Tiles/RunicProfanedBrick.png new file mode 100644 index 0000000000..c8b948dbbc Binary files /dev/null and b/Tiles/RunicProfanedBrick.png differ diff --git a/Tiles/SeaPrism.cs b/Tiles/SeaPrism.cs new file mode 100644 index 0000000000..1da54d3cb8 --- /dev/null +++ b/Tiles/SeaPrism.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/SeaPrism.png b/Tiles/SeaPrism.png new file mode 100644 index 0000000000..a99275ea3d Binary files /dev/null and b/Tiles/SeaPrism.png differ diff --git a/Tiles/SignusMusicbox.cs b/Tiles/SignusMusicbox.cs new file mode 100644 index 0000000000..13722d9ccc --- /dev/null +++ b/Tiles/SignusMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/SignusMusicbox.png b/Tiles/SignusMusicbox.png new file mode 100644 index 0000000000..79728d7e65 Binary files /dev/null and b/Tiles/SignusMusicbox.png differ diff --git a/Tiles/SlimeGodMusicbox.cs b/Tiles/SlimeGodMusicbox.cs new file mode 100644 index 0000000000..6b107819ab --- /dev/null +++ b/Tiles/SlimeGodMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/SlimeGodMusicbox.png b/Tiles/SlimeGodMusicbox.png new file mode 100644 index 0000000000..767519cb9d Binary files /dev/null and b/Tiles/SlimeGodMusicbox.png differ diff --git a/Tiles/SmoothAbyssGravel.cs b/Tiles/SmoothAbyssGravel.cs new file mode 100644 index 0000000000..c0aed9a394 --- /dev/null +++ b/Tiles/SmoothAbyssGravel.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/SmoothAbyssGravel.png b/Tiles/SmoothAbyssGravel.png new file mode 100644 index 0000000000..336ef18951 Binary files /dev/null and b/Tiles/SmoothAbyssGravel.png differ diff --git a/Tiles/SmoothAbyssGravelPlatform.cs b/Tiles/SmoothAbyssGravelPlatform.cs new file mode 100644 index 0000000000..e392afa12b --- /dev/null +++ b/Tiles/SmoothAbyssGravelPlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/SmoothAbyssGravelPlatform.png b/Tiles/SmoothAbyssGravelPlatform.png new file mode 100644 index 0000000000..034a1c3a78 Binary files /dev/null and b/Tiles/SmoothAbyssGravelPlatform.png differ diff --git a/Tiles/SmoothBrimstoneSlag.cs b/Tiles/SmoothBrimstoneSlag.cs new file mode 100644 index 0000000000..159e6608c2 --- /dev/null +++ b/Tiles/SmoothBrimstoneSlag.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/SmoothBrimstoneSlag.png b/Tiles/SmoothBrimstoneSlag.png new file mode 100644 index 0000000000..cf4934e67d Binary files /dev/null and b/Tiles/SmoothBrimstoneSlag.png differ diff --git a/Tiles/SmoothVoidstone.cs b/Tiles/SmoothVoidstone.cs new file mode 100644 index 0000000000..76d55cd16f --- /dev/null +++ b/Tiles/SmoothVoidstone.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/SmoothVoidstone.png b/Tiles/SmoothVoidstone.png new file mode 100644 index 0000000000..411349478d Binary files /dev/null and b/Tiles/SmoothVoidstone.png differ diff --git a/Tiles/SmoothVoidstonePlatform.cs b/Tiles/SmoothVoidstonePlatform.cs new file mode 100644 index 0000000000..1ce7832eac --- /dev/null +++ b/Tiles/SmoothVoidstonePlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/SmoothVoidstonePlatform.png b/Tiles/SmoothVoidstonePlatform.png new file mode 100644 index 0000000000..ef16a3b01d Binary files /dev/null and b/Tiles/SmoothVoidstonePlatform.png differ diff --git a/Tiles/StaticRefiner.cs b/Tiles/StaticRefiner.cs new file mode 100644 index 0000000000..2fd250ed52 --- /dev/null +++ b/Tiles/StaticRefiner.cs @@ -0,0 +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(); + // } + //} +} diff --git a/Tiles/StaticRefiner.png b/Tiles/StaticRefiner.png new file mode 100644 index 0000000000..9ec5321fe8 Binary files /dev/null and b/Tiles/StaticRefiner.png differ diff --git a/Tiles/StatigelBath.cs b/Tiles/StatigelBath.cs new file mode 100644 index 0000000000..10c58de18d --- /dev/null +++ b/Tiles/StatigelBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelBath.png b/Tiles/StatigelBath.png new file mode 100644 index 0000000000..0a48f85cbc Binary files /dev/null and b/Tiles/StatigelBath.png differ diff --git a/Tiles/StatigelBed.cs b/Tiles/StatigelBed.cs new file mode 100644 index 0000000000..932369174e --- /dev/null +++ b/Tiles/StatigelBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelBed.png b/Tiles/StatigelBed.png new file mode 100644 index 0000000000..f335592e84 Binary files /dev/null and b/Tiles/StatigelBed.png differ diff --git a/Tiles/StatigelBed_Highlight.png b/Tiles/StatigelBed_Highlight.png new file mode 100644 index 0000000000..6958e21ed4 Binary files /dev/null and b/Tiles/StatigelBed_Highlight.png differ diff --git a/Tiles/StatigelBlock.cs b/Tiles/StatigelBlock.cs new file mode 100644 index 0000000000..20ed9dd025 --- /dev/null +++ b/Tiles/StatigelBlock.cs @@ -0,0 +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)); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelBlock.png b/Tiles/StatigelBlock.png new file mode 100644 index 0000000000..2449c7c6d2 Binary files /dev/null and b/Tiles/StatigelBlock.png differ diff --git a/Tiles/StatigelBookcase.cs b/Tiles/StatigelBookcase.cs new file mode 100644 index 0000000000..f7b87b1947 --- /dev/null +++ b/Tiles/StatigelBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelBookcase.png b/Tiles/StatigelBookcase.png new file mode 100644 index 0000000000..a5c6ff2402 Binary files /dev/null and b/Tiles/StatigelBookcase.png differ diff --git a/Tiles/StatigelCandelabra.cs b/Tiles/StatigelCandelabra.cs new file mode 100644 index 0000000000..937e06ff0e --- /dev/null +++ b/Tiles/StatigelCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelCandelabra.png b/Tiles/StatigelCandelabra.png new file mode 100644 index 0000000000..7ff4a37262 Binary files /dev/null and b/Tiles/StatigelCandelabra.png differ diff --git a/Tiles/StatigelCandle.cs b/Tiles/StatigelCandle.cs new file mode 100644 index 0000000000..12795205bc --- /dev/null +++ b/Tiles/StatigelCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelCandle.png b/Tiles/StatigelCandle.png new file mode 100644 index 0000000000..c943a06c2f Binary files /dev/null and b/Tiles/StatigelCandle.png differ diff --git a/Tiles/StatigelChair.cs b/Tiles/StatigelChair.cs new file mode 100644 index 0000000000..7c5ec1212b --- /dev/null +++ b/Tiles/StatigelChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelChair.png b/Tiles/StatigelChair.png new file mode 100644 index 0000000000..59e0bd277a Binary files /dev/null and b/Tiles/StatigelChair.png differ diff --git a/Tiles/StatigelChandelier.cs b/Tiles/StatigelChandelier.cs new file mode 100644 index 0000000000..90375fee07 --- /dev/null +++ b/Tiles/StatigelChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelChandelier.png b/Tiles/StatigelChandelier.png new file mode 100644 index 0000000000..6d5a92cc93 Binary files /dev/null and b/Tiles/StatigelChandelier.png differ diff --git a/Tiles/StatigelChest.cs b/Tiles/StatigelChest.cs new file mode 100644 index 0000000000..4cd08f36c9 --- /dev/null +++ b/Tiles/StatigelChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelChest.png b/Tiles/StatigelChest.png new file mode 100644 index 0000000000..e17cc238dc Binary files /dev/null and b/Tiles/StatigelChest.png differ diff --git a/Tiles/StatigelChest_Highlight.png b/Tiles/StatigelChest_Highlight.png new file mode 100644 index 0000000000..49df01543c Binary files /dev/null and b/Tiles/StatigelChest_Highlight.png differ diff --git a/Tiles/StatigelClock.cs b/Tiles/StatigelClock.cs new file mode 100644 index 0000000000..c16f755f5e --- /dev/null +++ b/Tiles/StatigelClock.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelClock.png b/Tiles/StatigelClock.png new file mode 100644 index 0000000000..eb3e2581f0 Binary files /dev/null and b/Tiles/StatigelClock.png differ diff --git a/Tiles/StatigelDoorClosed.cs b/Tiles/StatigelDoorClosed.cs new file mode 100644 index 0000000000..9b07a295ec --- /dev/null +++ b/Tiles/StatigelDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelDoorClosed.png b/Tiles/StatigelDoorClosed.png new file mode 100644 index 0000000000..2d4648767d Binary files /dev/null and b/Tiles/StatigelDoorClosed.png differ diff --git a/Tiles/StatigelDoorClosed_Highlight.png b/Tiles/StatigelDoorClosed_Highlight.png new file mode 100644 index 0000000000..903d1bd0f8 Binary files /dev/null and b/Tiles/StatigelDoorClosed_Highlight.png differ diff --git a/Tiles/StatigelDoorOpen.cs b/Tiles/StatigelDoorOpen.cs new file mode 100644 index 0000000000..a9d17442f8 --- /dev/null +++ b/Tiles/StatigelDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelDoorOpen.png b/Tiles/StatigelDoorOpen.png new file mode 100644 index 0000000000..1e7fdd50d1 Binary files /dev/null and b/Tiles/StatigelDoorOpen.png differ diff --git a/Tiles/StatigelDoorOpen_Highlight.png b/Tiles/StatigelDoorOpen_Highlight.png new file mode 100644 index 0000000000..0dedd6241a Binary files /dev/null and b/Tiles/StatigelDoorOpen_Highlight.png differ diff --git a/Tiles/StatigelDresser.cs b/Tiles/StatigelDresser.cs new file mode 100644 index 0000000000..a856e99343 --- /dev/null +++ b/Tiles/StatigelDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelDresser.png b/Tiles/StatigelDresser.png new file mode 100644 index 0000000000..9ede7f6a85 Binary files /dev/null and b/Tiles/StatigelDresser.png differ diff --git a/Tiles/StatigelDresser_Highlight.png b/Tiles/StatigelDresser_Highlight.png new file mode 100644 index 0000000000..d6989d3203 Binary files /dev/null and b/Tiles/StatigelDresser_Highlight.png differ diff --git a/Tiles/StatigelLamp.cs b/Tiles/StatigelLamp.cs new file mode 100644 index 0000000000..b1076a512e --- /dev/null +++ b/Tiles/StatigelLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelLamp.png b/Tiles/StatigelLamp.png new file mode 100644 index 0000000000..73143c2856 Binary files /dev/null and b/Tiles/StatigelLamp.png differ diff --git a/Tiles/StatigelLantern.cs b/Tiles/StatigelLantern.cs new file mode 100644 index 0000000000..74ce4a04a0 --- /dev/null +++ b/Tiles/StatigelLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/StatigelLantern.png b/Tiles/StatigelLantern.png new file mode 100644 index 0000000000..b3981fc7be Binary files /dev/null and b/Tiles/StatigelLantern.png differ diff --git a/Tiles/StatigelPiano.cs b/Tiles/StatigelPiano.cs new file mode 100644 index 0000000000..c22ce9dd61 --- /dev/null +++ b/Tiles/StatigelPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelPiano.png b/Tiles/StatigelPiano.png new file mode 100644 index 0000000000..f2f6160af6 Binary files /dev/null and b/Tiles/StatigelPiano.png differ diff --git a/Tiles/StatigelPlatform.cs b/Tiles/StatigelPlatform.cs new file mode 100644 index 0000000000..0e5db62695 --- /dev/null +++ b/Tiles/StatigelPlatform.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelPlatform.png b/Tiles/StatigelPlatform.png new file mode 100644 index 0000000000..12613c1eca Binary files /dev/null and b/Tiles/StatigelPlatform.png differ diff --git a/Tiles/StatigelSink.cs b/Tiles/StatigelSink.cs new file mode 100644 index 0000000000..dd03e2e9a7 --- /dev/null +++ b/Tiles/StatigelSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelSink.png b/Tiles/StatigelSink.png new file mode 100644 index 0000000000..e2bf973b1f Binary files /dev/null and b/Tiles/StatigelSink.png differ diff --git a/Tiles/StatigelSofa.cs b/Tiles/StatigelSofa.cs new file mode 100644 index 0000000000..d8e4d3c668 --- /dev/null +++ b/Tiles/StatigelSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelSofa.png b/Tiles/StatigelSofa.png new file mode 100644 index 0000000000..da275c4a96 Binary files /dev/null and b/Tiles/StatigelSofa.png differ diff --git a/Tiles/StatigelTable.cs b/Tiles/StatigelTable.cs new file mode 100644 index 0000000000..99154deb4f --- /dev/null +++ b/Tiles/StatigelTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/StatigelTable.png b/Tiles/StatigelTable.png new file mode 100644 index 0000000000..ee328bd86d Binary files /dev/null and b/Tiles/StatigelTable.png differ diff --git a/Tiles/StatigelWorkbench.cs b/Tiles/StatigelWorkbench.cs new file mode 100644 index 0000000000..e72643487e --- /dev/null +++ b/Tiles/StatigelWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/StatigelWorkbench.png b/Tiles/StatigelWorkbench.png new file mode 100644 index 0000000000..36fa265b25 Binary files /dev/null and b/Tiles/StatigelWorkbench.png differ diff --git a/Tiles/StormWeaverMusicbox.cs b/Tiles/StormWeaverMusicbox.cs new file mode 100644 index 0000000000..63b5d2d83b --- /dev/null +++ b/Tiles/StormWeaverMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/StormWeaverMusicbox.png b/Tiles/StormWeaverMusicbox.png new file mode 100644 index 0000000000..2e719ce030 Binary files /dev/null and b/Tiles/StormWeaverMusicbox.png differ diff --git a/Tiles/SulphurousMusicbox.cs b/Tiles/SulphurousMusicbox.cs new file mode 100644 index 0000000000..ad2353470d --- /dev/null +++ b/Tiles/SulphurousMusicbox.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/SulphurousMusicbox.png b/Tiles/SulphurousMusicbox.png new file mode 100644 index 0000000000..92366b8bc3 Binary files /dev/null and b/Tiles/SulphurousMusicbox.png differ diff --git a/Tiles/SulphurousSand.cs b/Tiles/SulphurousSand.cs new file mode 100644 index 0000000000..c984cdfbea --- /dev/null +++ b/Tiles/SulphurousSand.cs @@ -0,0 +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); + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/SulphurousSand.png b/Tiles/SulphurousSand.png new file mode 100644 index 0000000000..5e9a1bf07b Binary files /dev/null and b/Tiles/SulphurousSand.png differ diff --git a/Tiles/Tenebris.cs b/Tiles/Tenebris.cs new file mode 100644 index 0000000000..6a8587ed8e --- /dev/null +++ b/Tiles/Tenebris.cs @@ -0,0 +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); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/Tenebris.png b/Tiles/Tenebris.png new file mode 100644 index 0000000000..99e60a282d Binary files /dev/null and b/Tiles/Tenebris.png differ diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs new file mode 100644 index 0000000000..8b54adc7e9 --- /dev/null +++ b/Tiles/UelibloomBrick.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/UelibloomBrick.png b/Tiles/UelibloomBrick.png new file mode 100644 index 0000000000..0ffe3faa84 Binary files /dev/null and b/Tiles/UelibloomBrick.png differ diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs new file mode 100644 index 0000000000..2a96d9fc8a --- /dev/null +++ b/Tiles/UelibloomOre.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/UelibloomOre.png b/Tiles/UelibloomOre.png new file mode 100644 index 0000000000..f3f3a968cf Binary files /dev/null and b/Tiles/UelibloomOre.png differ diff --git a/Tiles/ViperVines.cs b/Tiles/ViperVines.cs new file mode 100644 index 0000000000..5fc6456c86 --- /dev/null +++ b/Tiles/ViperVines.cs @@ -0,0 +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); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/ViperVines.png b/Tiles/ViperVines.png new file mode 100644 index 0000000000..b9fad1a574 Binary files /dev/null and b/Tiles/ViperVines.png differ diff --git a/Tiles/VoidBath.cs b/Tiles/VoidBath.cs new file mode 100644 index 0000000000..ad715614ee --- /dev/null +++ b/Tiles/VoidBath.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidBath.png b/Tiles/VoidBath.png new file mode 100644 index 0000000000..2e8f4a505a Binary files /dev/null and b/Tiles/VoidBath.png differ diff --git a/Tiles/VoidBed.cs b/Tiles/VoidBed.cs new file mode 100644 index 0000000000..58ad310f2e --- /dev/null +++ b/Tiles/VoidBed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidBed.png b/Tiles/VoidBed.png new file mode 100644 index 0000000000..02b7d4f615 Binary files /dev/null and b/Tiles/VoidBed.png differ diff --git a/Tiles/VoidBed_Highlight.png b/Tiles/VoidBed_Highlight.png new file mode 100644 index 0000000000..607f2e4083 Binary files /dev/null and b/Tiles/VoidBed_Highlight.png differ diff --git a/Tiles/VoidBookcase.cs b/Tiles/VoidBookcase.cs new file mode 100644 index 0000000000..1ed6b50edb --- /dev/null +++ b/Tiles/VoidBookcase.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidBookcase.png b/Tiles/VoidBookcase.png new file mode 100644 index 0000000000..fb64da53ee Binary files /dev/null and b/Tiles/VoidBookcase.png differ diff --git a/Tiles/VoidCandelabra.cs b/Tiles/VoidCandelabra.cs new file mode 100644 index 0000000000..673d011cc1 --- /dev/null +++ b/Tiles/VoidCandelabra.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidCandelabra.png b/Tiles/VoidCandelabra.png new file mode 100644 index 0000000000..a0adab10e7 Binary files /dev/null and b/Tiles/VoidCandelabra.png differ diff --git a/Tiles/VoidCandle.cs b/Tiles/VoidCandle.cs new file mode 100644 index 0000000000..1e8170c2d6 --- /dev/null +++ b/Tiles/VoidCandle.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidCandle.png b/Tiles/VoidCandle.png new file mode 100644 index 0000000000..3febb02854 Binary files /dev/null and b/Tiles/VoidCandle.png differ diff --git a/Tiles/VoidChair.cs b/Tiles/VoidChair.cs new file mode 100644 index 0000000000..17e7b0937b --- /dev/null +++ b/Tiles/VoidChair.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidChair.png b/Tiles/VoidChair.png new file mode 100644 index 0000000000..3ff7115400 Binary files /dev/null and b/Tiles/VoidChair.png differ diff --git a/Tiles/VoidChandelier.cs b/Tiles/VoidChandelier.cs new file mode 100644 index 0000000000..460737fe09 --- /dev/null +++ b/Tiles/VoidChandelier.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidChandelier.png b/Tiles/VoidChandelier.png new file mode 100644 index 0000000000..6c64eac4e7 Binary files /dev/null and b/Tiles/VoidChandelier.png differ diff --git a/Tiles/VoidChest.cs b/Tiles/VoidChest.cs new file mode 100644 index 0000000000..2bb47a9a68 --- /dev/null +++ b/Tiles/VoidChest.cs @@ -0,0 +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; + } + } + } +} \ No newline at end of file diff --git a/Tiles/VoidChest.png b/Tiles/VoidChest.png new file mode 100644 index 0000000000..d1977498b7 Binary files /dev/null and b/Tiles/VoidChest.png differ diff --git a/Tiles/VoidChest_Highlight.png b/Tiles/VoidChest_Highlight.png new file mode 100644 index 0000000000..88b1a6264c Binary files /dev/null and b/Tiles/VoidChest_Highlight.png differ diff --git a/Tiles/VoidClock.cs b/Tiles/VoidClock.cs new file mode 100644 index 0000000000..0886fb8bd8 --- /dev/null +++ b/Tiles/VoidClock.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidClock.png b/Tiles/VoidClock.png new file mode 100644 index 0000000000..35ca8cdfdf Binary files /dev/null and b/Tiles/VoidClock.png differ diff --git a/Tiles/VoidClock_Highlight.png b/Tiles/VoidClock_Highlight.png new file mode 100644 index 0000000000..70251f1435 Binary files /dev/null and b/Tiles/VoidClock_Highlight.png differ diff --git a/Tiles/VoidCondenser.cs b/Tiles/VoidCondenser.cs new file mode 100644 index 0000000000..769ca114c2 --- /dev/null +++ b/Tiles/VoidCondenser.cs @@ -0,0 +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(); + // } + //} +} diff --git a/Tiles/VoidCondenser.png b/Tiles/VoidCondenser.png new file mode 100644 index 0000000000..e8cadda56d Binary files /dev/null and b/Tiles/VoidCondenser.png differ diff --git a/Tiles/VoidDoorClosed.cs b/Tiles/VoidDoorClosed.cs new file mode 100644 index 0000000000..b5e6e803cb --- /dev/null +++ b/Tiles/VoidDoorClosed.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidDoorClosed.png b/Tiles/VoidDoorClosed.png new file mode 100644 index 0000000000..67e4f6925d Binary files /dev/null and b/Tiles/VoidDoorClosed.png differ diff --git a/Tiles/VoidDoorClosed_Highlight.png b/Tiles/VoidDoorClosed_Highlight.png new file mode 100644 index 0000000000..e392bbe097 Binary files /dev/null and b/Tiles/VoidDoorClosed_Highlight.png differ diff --git a/Tiles/VoidDoorOpen.cs b/Tiles/VoidDoorOpen.cs new file mode 100644 index 0000000000..9015fa4003 --- /dev/null +++ b/Tiles/VoidDoorOpen.cs @@ -0,0 +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"); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidDoorOpen.png b/Tiles/VoidDoorOpen.png new file mode 100644 index 0000000000..b4598f2bfd Binary files /dev/null and b/Tiles/VoidDoorOpen.png differ diff --git a/Tiles/VoidDoorOpen_Highlight.png b/Tiles/VoidDoorOpen_Highlight.png new file mode 100644 index 0000000000..a1adcf98c1 Binary files /dev/null and b/Tiles/VoidDoorOpen_Highlight.png differ diff --git a/Tiles/VoidDresser.cs b/Tiles/VoidDresser.cs new file mode 100644 index 0000000000..a0ec0f677e --- /dev/null +++ b/Tiles/VoidDresser.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidDresser.png b/Tiles/VoidDresser.png new file mode 100644 index 0000000000..2b42cf3f14 Binary files /dev/null and b/Tiles/VoidDresser.png differ diff --git a/Tiles/VoidDresser_Highlight.png b/Tiles/VoidDresser_Highlight.png new file mode 100644 index 0000000000..e365224338 Binary files /dev/null and b/Tiles/VoidDresser_Highlight.png differ diff --git a/Tiles/VoidLamp.cs b/Tiles/VoidLamp.cs new file mode 100644 index 0000000000..3a4de7ee8f --- /dev/null +++ b/Tiles/VoidLamp.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidLamp.png b/Tiles/VoidLamp.png new file mode 100644 index 0000000000..c5e0cfa480 Binary files /dev/null and b/Tiles/VoidLamp.png differ diff --git a/Tiles/VoidLantern.cs b/Tiles/VoidLantern.cs new file mode 100644 index 0000000000..887bb95ace --- /dev/null +++ b/Tiles/VoidLantern.cs @@ -0,0 +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); + } + } +} diff --git a/Tiles/VoidLantern.png b/Tiles/VoidLantern.png new file mode 100644 index 0000000000..088769ea22 Binary files /dev/null and b/Tiles/VoidLantern.png differ diff --git a/Tiles/VoidPiano.cs b/Tiles/VoidPiano.cs new file mode 100644 index 0000000000..a28012bebd --- /dev/null +++ b/Tiles/VoidPiano.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidPiano.png b/Tiles/VoidPiano.png new file mode 100644 index 0000000000..a4723c3804 Binary files /dev/null and b/Tiles/VoidPiano.png differ diff --git a/Tiles/VoidSink.cs b/Tiles/VoidSink.cs new file mode 100644 index 0000000000..4201b1df66 --- /dev/null +++ b/Tiles/VoidSink.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidSink.png b/Tiles/VoidSink.png new file mode 100644 index 0000000000..2ebdae0850 Binary files /dev/null and b/Tiles/VoidSink.png differ diff --git a/Tiles/VoidSofa.cs b/Tiles/VoidSofa.cs new file mode 100644 index 0000000000..72ee505a1d --- /dev/null +++ b/Tiles/VoidSofa.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidSofa.png b/Tiles/VoidSofa.png new file mode 100644 index 0000000000..f352a378ff Binary files /dev/null and b/Tiles/VoidSofa.png differ diff --git a/Tiles/VoidTable.cs b/Tiles/VoidTable.cs new file mode 100644 index 0000000000..5c7f7b29ba --- /dev/null +++ b/Tiles/VoidTable.cs @@ -0,0 +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")); + } + } +} diff --git a/Tiles/VoidTable.png b/Tiles/VoidTable.png new file mode 100644 index 0000000000..c7f028fc6c Binary files /dev/null and b/Tiles/VoidTable.png differ diff --git a/Tiles/VoidWorkbench.cs b/Tiles/VoidWorkbench.cs new file mode 100644 index 0000000000..0c6c82273c --- /dev/null +++ b/Tiles/VoidWorkbench.cs @@ -0,0 +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")); + } + } +} \ No newline at end of file diff --git a/Tiles/VoidWorkbench.png b/Tiles/VoidWorkbench.png new file mode 100644 index 0000000000..6f4b146096 Binary files /dev/null and b/Tiles/VoidWorkbench.png differ diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs new file mode 100644 index 0000000000..634cb1e0d8 --- /dev/null +++ b/Tiles/Voidstone.cs @@ -0,0 +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); + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/Voidstone.png b/Tiles/Voidstone.png new file mode 100644 index 0000000000..36e81efe68 Binary files /dev/null and b/Tiles/Voidstone.png differ diff --git a/Tiles/VoidstoneSlab.cs b/Tiles/VoidstoneSlab.cs new file mode 100644 index 0000000000..d22aaca325 --- /dev/null +++ b/Tiles/VoidstoneSlab.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Tiles/VoidstoneSlab.png b/Tiles/VoidstoneSlab.png new file mode 100644 index 0000000000..410a266232 Binary files /dev/null and b/Tiles/VoidstoneSlab.png differ diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs new file mode 100644 index 0000000000..3017b32620 --- /dev/null +++ b/UI/AstralArcanumUI.cs @@ -0,0 +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()); + } + } + } +} diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs new file mode 100644 index 0000000000..fe0c58d91c --- /dev/null +++ b/UI/BossHealthBarManager.cs @@ -0,0 +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; + } + } + } +} diff --git a/UI/UIBar.cs b/UI/UIBar.cs new file mode 100644 index 0000000000..52c690d182 --- /dev/null +++ b/UI/UIBar.cs @@ -0,0 +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(); + } + } + } +} \ No newline at end of file diff --git a/UI/UIBar2.cs b/UI/UIBar2.cs new file mode 100644 index 0000000000..90a4027401 --- /dev/null +++ b/UI/UIBar2.cs @@ -0,0 +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(); + } + } + } +} \ No newline at end of file diff --git a/UI/UIImage.cs b/UI/UIImage.cs new file mode 100644 index 0000000000..214f6a16eb --- /dev/null +++ b/UI/UIImage.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.GameContent.UI.Elements; +using Terraria.UI; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class UIImage : UIElement + { + public Texture2D texture = null; + + public UIImage(Texture2D tex, int width = -1, int height = -1) : base() + { + texture = tex; + this.Width.Set(width == -1 ? tex.Width : width, 0f); + this.Height.Set(height == -1 ? tex.Height : height, 0f); + } + + protected override void DrawSelf(SpriteBatch spriteBatch) + { + CalculatedStyle dimensions = base.GetDimensions(); + Color color = Color.White; + //base.IsMouseHovering ? Color.White : Color.Silver; //uncomment this to produce it getting brighter if hovered over. + int width = (int)dimensions.Width, height = (int)dimensions.Height; + spriteBatch.Draw(texture, new Rectangle((int)dimensions.X, (int)dimensions.Y, width, height), new Rectangle(0, 0, width, height), color); + } + } +} \ No newline at end of file diff --git a/UIHandler.cs b/UIHandler.cs new file mode 100644 index 0000000000..9b9b0a37f6 --- /dev/null +++ b/UIHandler.cs @@ -0,0 +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); + } + } +} \ No newline at end of file diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs new file mode 100644 index 0000000000..76c21df637 --- /dev/null +++ b/Walls/AbyssGravelWall.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AbyssGravelWall : ModWall + { + public override void SetDefaults() + { + dustType = 33; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} \ No newline at end of file diff --git a/Walls/AbyssGravelWall.png b/Walls/AbyssGravelWall.png new file mode 100644 index 0000000000..3af77f5171 Binary files /dev/null and b/Walls/AbyssGravelWall.png differ diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs new file mode 100644 index 0000000000..5489709a28 --- /dev/null +++ b/Walls/AerialiteBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/AerialiteBrickWall.png b/Walls/AerialiteBrickWall.png new file mode 100644 index 0000000000..a1132aff85 Binary files /dev/null and b/Walls/AerialiteBrickWall.png differ diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs new file mode 100644 index 0000000000..d66d6fc710 --- /dev/null +++ b/Walls/AstralBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/AstralBrickWall.png b/Walls/AstralBrickWall.png new file mode 100644 index 0000000000..0de711fa7d Binary files /dev/null and b/Walls/AstralBrickWall.png differ diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs new file mode 100644 index 0000000000..20d0e9b9da --- /dev/null +++ b/Walls/BrimstoneSlagWall.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class BrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("BrimstoneSlagWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brimstone Slag Wall"); + AddMapEntry(new Color(20, 20, 20), name); + dustType = 53; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} \ No newline at end of file diff --git a/Walls/BrimstoneSlagWall.png b/Walls/BrimstoneSlagWall.png new file mode 100644 index 0000000000..f24861d913 Binary files /dev/null and b/Walls/BrimstoneSlagWall.png differ diff --git a/Walls/ChaoticBrickWall.cs b/Walls/ChaoticBrickWall.cs new file mode 100644 index 0000000000..280b3ac9e4 --- /dev/null +++ b/Walls/ChaoticBrickWall.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ChaoticBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("ChaoticBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Brick Wall"); + AddMapEntry(new Color(255, 0, 0), name); + dustType = 105; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} \ No newline at end of file diff --git a/Walls/ChaoticBrickWall.png b/Walls/ChaoticBrickWall.png new file mode 100644 index 0000000000..bd92e1da57 Binary files /dev/null and b/Walls/ChaoticBrickWall.png differ diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs new file mode 100644 index 0000000000..add85c5e27 --- /dev/null +++ b/Walls/CinderplateWall.cs @@ -0,0 +1,22 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class CinderplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CinderplateWall"); + AddMapEntry(new Color(5, 5, 5)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} \ No newline at end of file diff --git a/Walls/CinderplateWall.png b/Walls/CinderplateWall.png new file mode 100644 index 0000000000..adf2216853 Binary files /dev/null and b/Walls/CinderplateWall.png differ diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs new file mode 100644 index 0000000000..f8a9503673 --- /dev/null +++ b/Walls/CosmiliteBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/CosmiliteBrickWall.png b/Walls/CosmiliteBrickWall.png new file mode 100644 index 0000000000..a469c07927 Binary files /dev/null and b/Walls/CosmiliteBrickWall.png differ diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs new file mode 100644 index 0000000000..4cb14e4201 --- /dev/null +++ b/Walls/CryonicBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/CryonicBrickWall.png b/Walls/CryonicBrickWall.png new file mode 100644 index 0000000000..3762261eef Binary files /dev/null and b/Walls/CryonicBrickWall.png differ diff --git a/Walls/MossyGravelWall.cs b/Walls/MossyGravelWall.cs new file mode 100644 index 0000000000..734343fe94 --- /dev/null +++ b/Walls/MossyGravelWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class MossyGravelWall : ModWall + { + public override void SetDefaults() + { + dustType = 2; + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} \ No newline at end of file diff --git a/Walls/MossyGravelWall.png b/Walls/MossyGravelWall.png new file mode 100644 index 0000000000..c13ef8afaf Binary files /dev/null and b/Walls/MossyGravelWall.png differ diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs new file mode 100644 index 0000000000..82b012cd71 --- /dev/null +++ b/Walls/PerennialBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/PerennialBrickWall.png b/Walls/PerennialBrickWall.png new file mode 100644 index 0000000000..3f5408c7e1 Binary files /dev/null and b/Walls/PerennialBrickWall.png differ diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs new file mode 100644 index 0000000000..39903946c9 --- /dev/null +++ b/Walls/ProfanedCrystalWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/ProfanedCrystalWall.png b/Walls/ProfanedCrystalWall.png new file mode 100644 index 0000000000..4ae4bc4cad Binary files /dev/null and b/Walls/ProfanedCrystalWall.png differ diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs new file mode 100644 index 0000000000..447b0f2d3e --- /dev/null +++ b/Walls/ProfanedRockWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/ProfanedRockWall.png b/Walls/ProfanedRockWall.png new file mode 100644 index 0000000000..948c6ef1d4 Binary files /dev/null and b/Walls/ProfanedRockWall.png differ diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs new file mode 100644 index 0000000000..f6831b3d1e --- /dev/null +++ b/Walls/ProfanedSlabWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/ProfanedSlabWall.png b/Walls/ProfanedSlabWall.png new file mode 100644 index 0000000000..721b557efd Binary files /dev/null and b/Walls/ProfanedSlabWall.png differ diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs new file mode 100644 index 0000000000..a83de191d2 --- /dev/null +++ b/Walls/RunicProfanedBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/RunicProfanedBrickWall.png b/Walls/RunicProfanedBrickWall.png new file mode 100644 index 0000000000..0193637971 Binary files /dev/null and b/Walls/RunicProfanedBrickWall.png differ diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs new file mode 100644 index 0000000000..b0cd882e73 --- /dev/null +++ b/Walls/SmoothAbyssGravelWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/SmoothAbyssGravelWall.png b/Walls/SmoothAbyssGravelWall.png new file mode 100644 index 0000000000..687756a981 Binary files /dev/null and b/Walls/SmoothAbyssGravelWall.png differ diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs new file mode 100644 index 0000000000..52dc06f688 --- /dev/null +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/SmoothBrimstoneSlagWall.png b/Walls/SmoothBrimstoneSlagWall.png new file mode 100644 index 0000000000..17af1feb21 Binary files /dev/null and b/Walls/SmoothBrimstoneSlagWall.png differ diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs new file mode 100644 index 0000000000..0083e2ab06 --- /dev/null +++ b/Walls/SmoothVoidstoneWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/SmoothVoidstoneWall.png b/Walls/SmoothVoidstoneWall.png new file mode 100644 index 0000000000..4ba3bd549e Binary files /dev/null and b/Walls/SmoothVoidstoneWall.png differ diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs new file mode 100644 index 0000000000..c0511e4d50 --- /dev/null +++ b/Walls/StatigelWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/StatigelWall.png b/Walls/StatigelWall.png new file mode 100644 index 0000000000..0e05d6a60d Binary files /dev/null and b/Walls/StatigelWall.png differ diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs new file mode 100644 index 0000000000..f5fe737b39 --- /dev/null +++ b/Walls/UelibloomBrickWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/UelibloomBrickWall.png b/Walls/UelibloomBrickWall.png new file mode 100644 index 0000000000..0917c35f4a Binary files /dev/null and b/Walls/UelibloomBrickWall.png differ diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs new file mode 100644 index 0000000000..07940f5268 --- /dev/null +++ b/Walls/VoidstoneWall.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Walls/VoidstoneWall.png b/Walls/VoidstoneWall.png new file mode 100644 index 0000000000..641f018c8b Binary files /dev/null and b/Walls/VoidstoneWall.png differ diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs new file mode 100644 index 0000000000..b0deea0c47 --- /dev/null +++ b/Walls/VoidstoneWallUnsafe.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class VoidstoneWallUnsafe : ModWall + { + public override void SetDefaults() + { + dustType = 187; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} \ No newline at end of file diff --git a/Walls/VoidstoneWallUnsafe.png b/Walls/VoidstoneWallUnsafe.png new file mode 100644 index 0000000000..641f018c8b Binary files /dev/null and b/Walls/VoidstoneWallUnsafe.png differ diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs new file mode 100644 index 0000000000..2a0378155c --- /dev/null +++ b/Waters/AbyssWater.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class AbyssWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneAbyss; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("AbyssWaterflow"); + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Blue; + } + } +} \ No newline at end of file diff --git a/Waters/AbyssWater.png b/Waters/AbyssWater.png new file mode 100644 index 0000000000..34877ba767 Binary files /dev/null and b/Waters/AbyssWater.png differ diff --git a/Waters/AbyssWater_Block.png b/Waters/AbyssWater_Block.png new file mode 100644 index 0000000000..e67fa261a9 Binary files /dev/null and b/Waters/AbyssWater_Block.png differ diff --git a/Waters/AbyssWaterflow.cs b/Waters/AbyssWaterflow.cs new file mode 100644 index 0000000000..f4192e988d --- /dev/null +++ b/Waters/AbyssWaterflow.cs @@ -0,0 +1,10 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class AbyssWaterflow : ModWaterfallStyle + { + + } +} \ No newline at end of file diff --git a/Waters/AbyssWaterflow.png b/Waters/AbyssWaterflow.png new file mode 100644 index 0000000000..a397ea2ebc Binary files /dev/null and b/Waters/AbyssWaterflow.png differ diff --git a/Waters/GreatSeaWater.cs b/Waters/GreatSeaWater.cs new file mode 100644 index 0000000000..2f750de4ce --- /dev/null +++ b/Waters/GreatSeaWater.cs @@ -0,0 +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; + } + } +} \ No newline at end of file diff --git a/Waters/GreatSeaWater.png b/Waters/GreatSeaWater.png new file mode 100644 index 0000000000..62e9093972 Binary files /dev/null and b/Waters/GreatSeaWater.png differ diff --git a/Waters/GreatSeaWater_Block.png b/Waters/GreatSeaWater_Block.png new file mode 100644 index 0000000000..0adc5583cb Binary files /dev/null and b/Waters/GreatSeaWater_Block.png differ diff --git a/Waters/GreatSeaWaterflow.cs b/Waters/GreatSeaWaterflow.cs new file mode 100644 index 0000000000..d8066783b1 --- /dev/null +++ b/Waters/GreatSeaWaterflow.cs @@ -0,0 +1,10 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class GreatSeaWaterflow : ModWaterfallStyle + { + + } +} \ No newline at end of file diff --git a/Waters/GreatSeaWaterflow.png b/Waters/GreatSeaWaterflow.png new file mode 100644 index 0000000000..22a2918f2c Binary files /dev/null and b/Waters/GreatSeaWaterflow.png differ diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs new file mode 100644 index 0000000000..60fcf75fab --- /dev/null +++ b/Waters/SulphuricWater.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneSulphur; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("SulphuricWaterflow"); + } + + public override int GetSplashDust() + { + return 102; + } + + public override int GetDropletGore() + { + return 711; + } + + public override Color BiomeHairColor() + { + return Color.Yellow; + } + } +} \ No newline at end of file diff --git a/Waters/SulphuricWater.png b/Waters/SulphuricWater.png new file mode 100644 index 0000000000..4538f2067a Binary files /dev/null and b/Waters/SulphuricWater.png differ diff --git a/Waters/SulphuricWater_Block.png b/Waters/SulphuricWater_Block.png new file mode 100644 index 0000000000..77af969291 Binary files /dev/null and b/Waters/SulphuricWater_Block.png differ diff --git a/Waters/SulphuricWaterflow.cs b/Waters/SulphuricWaterflow.cs new file mode 100644 index 0000000000..32e39a5c2c --- /dev/null +++ b/Waters/SulphuricWaterflow.cs @@ -0,0 +1,10 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricWaterflow : ModWaterfallStyle + { + + } +} \ No newline at end of file diff --git a/Waters/SulphuricWaterflow.png b/Waters/SulphuricWaterflow.png new file mode 100644 index 0000000000..23f74979f6 Binary files /dev/null and b/Waters/SulphuricWaterflow.png differ diff --git a/World/CustomActions.cs b/World/CustomActions.cs new file mode 100644 index 0000000000..79449bd64b --- /dev/null +++ b/World/CustomActions.cs @@ -0,0 +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; + } + } + } +} diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs new file mode 100644 index 0000000000..3f7e73499e --- /dev/null +++ b/World/CustomConditions.cs @@ -0,0 +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; + } + } + } +} diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs new file mode 100644 index 0000000000..01f8d7c3b9 --- /dev/null +++ b/World/Planets/GrassPlanet.cs @@ -0,0 +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 }) + })); + } + } +} diff --git a/World/Planets/HeartPlanet.cs b/World/Planets/HeartPlanet.cs new file mode 100644 index 0000000000..f28d12c2a8 --- /dev/null +++ b/World/Planets/HeartPlanet.cs @@ -0,0 +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); + } + } +} diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs new file mode 100644 index 0000000000..ecd8ea3e63 --- /dev/null +++ b/World/Planets/MainPlanet.cs @@ -0,0 +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; + } + } + } + } +} diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs new file mode 100644 index 0000000000..c5a28d5065 --- /dev/null +++ b/World/Planets/MudPlanet.cs @@ -0,0 +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); + } + + } + } +} diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs new file mode 100644 index 0000000000..df4cd64cda --- /dev/null +++ b/World/Planets/Planetoid.cs @@ -0,0 +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; + } + } +} diff --git a/build.txt b/build.txt new file mode 100644 index 0000000000..03c5322de8 --- /dev/null +++ b/build.txt @@ -0,0 +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 +includePDB = false \ No newline at end of file diff --git a/description.txt b/description.txt new file mode 100644 index 0000000000..9b3fd8a94a --- /dev/null +++ b/description.txt @@ -0,0 +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 +Cross-content support for GRealm \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000..9d20e17e1b Binary files /dev/null and b/icon.png differ