diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 31c99b11cb..766515593a 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -77,37 +78,37 @@ namespace CalamityMod.Buffs public override void ModifyBuffTip(int type, ref string tip, ref int rare) { - if (type == BuffID.NebulaUpDmg1) - tip = "7.5% increased damage"; - else if (type == BuffID.NebulaUpDmg2) - tip = "15% increased damage"; - else if (type == BuffID.NebulaUpDmg3) - tip = "22.5% increased damage"; - else if (type == BuffID.WeaponImbueVenom || type == BuffID.WeaponImbueCursedFlames || type == BuffID.WeaponImbueFire || type == BuffID.WeaponImbueGold || - type == BuffID.WeaponImbueIchor || type == BuffID.WeaponImbueNanites || type == BuffID.WeaponImbuePoison) - tip = "Rogue and " + tip; - else if (type == BuffID.WeaponImbueConfetti) - tip = "All attacks cause confetti to appear"; - else if (type == BuffID.IceBarrier) - tip = "Damage taken is reduced by 15%"; - else if (type == BuffID.ChaosState) - tip = "Rod of Discord teleports are disabled"; - else if (type == BuffID.Ichor) + if (type == BuffID.NebulaUpDmg1) + tip = "7.5% increased damage"; + else if (type == BuffID.NebulaUpDmg2) + tip = "15% increased damage"; + else if (type == BuffID.NebulaUpDmg3) + tip = "22.5% increased damage"; + else if (type == BuffID.WeaponImbueVenom || type == BuffID.WeaponImbueCursedFlames || type == BuffID.WeaponImbueFire || type == BuffID.WeaponImbueGold || + type == BuffID.WeaponImbueIchor || type == BuffID.WeaponImbueNanites || type == BuffID.WeaponImbuePoison) + tip = "Rogue and " + tip; + else if (type == BuffID.WeaponImbueConfetti) + tip = "All attacks cause confetti to appear"; + else if (type == BuffID.IceBarrier) + tip = "Damage taken is reduced by 15%"; + else if (type == BuffID.ChaosState) + tip = "Rod of Discord teleports are disabled"; + else if (type == BuffID.Ichor) + { + tip = "Defense reduced by 20"; + if (CalamityWorld.revenge) + tip += ". All damage taken increased by 25%"; + } + else if (type == BuffID.CursedInferno && CalamityWorld.revenge) + tip += ". All damage taken increased by 20%"; + else if (type == BuffID.Warmth) { - tip = "Defense reduced by 20"; - if (CalamityWorld.revenge) - tip += ". All damage taken increased by 25%"; - } - else if (type == BuffID.CursedInferno && CalamityWorld.revenge) - tip += ". All damage taken increased by 20%"; - else if (type == BuffID.Warmth) - { - tip += ". Immunity to the Chilled, Frozen, and Glacial State debuffs"; + tip += ". Immunity to the Chilled, Frozen, and Glacial State debuffs"; if (CalamityWorld.death) tip += ". Provides cold protection in Death Mode"; } - else if (type == BuffID.Invisibility) - tip += ". Grants rogue bonuses while holding certain rogue weapons"; + else if (type == BuffID.Invisibility) + tip += ". Grants rogue bonuses while holding certain rogue weapons"; else if (type == BuffID.ObsidianSkin && CalamityWorld.death) tip += ". Provides heat protection in Death Mode"; else if (type == BuffID.Inferno && CalamityWorld.death) @@ -116,20 +117,52 @@ namespace CalamityMod.Buffs tip += ". Provides cold protection in Death Mode"; else if (type == ModContent.BuffType() && CalamityWorld.death) tip += ". Provides cold protection in Death Mode"; - else if (type == ModContent.BuffType()) - { - Player player = Main.player[Main.myPlayer]; - bool offense = player.Calamity().gOffense; - bool defense = player.Calamity().gDefense; - if (offense && defense) - { - tip = "The Profaned Babs will fight for and defend you!"; - } - else if (offense || defense) - { - tip = "The " + (offense ? "Offensive" : "Defensive") + " Duo will " + (offense ? "fight for and heal you!" : "protect and heal you!"); - } - } + else if (type == ModContent.BuffType()) + { + Player player = Main.player[Main.myPlayer]; + bool offense = player.Calamity().gOffense; + bool defense = player.Calamity().gDefense; + if (player.Calamity().profanedCrystal && (!player.Calamity().profanedCrystalBuffs && !CalamityWorld.downedSCal)) + { + tip = "The Profaned Babs will accompany you!"; + } + else if (offense && defense) + { + tip = "The Profaned Babs will fight for and defend you!"; + } + else if (offense || defense) + { + tip = "The " + (offense ? "Offensive" : "Defensive") + " Duo will " + (offense ? "fight for and heal you!" : "protect and heal you!"); + } + } + else if (type == ModContent.BuffType()) + { + if (Main.player[Main.myPlayer].Calamity().profanedCrystalBuffs) + { + if (Main.player[Main.myPlayer].Calamity().endoCooper) + { + tip = "An ascended ice construct is suppressing your true potential.."; + } + else if (Main.player[Main.myPlayer].Calamity().magicHat) + { + tip = "A magical hat overwhelms your senses, squandering your true potential.."; + } + else + { + Player player = Main.player[Main.myPlayer]; + bool offense = (Main.dayTime && !player.wet) || player.lavaWet; + bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + tip = "You are an emissary of the profaned goddess now!\n" + + (offense ? "The " + (Main.dayTime ? "light of the sun" : "heat of the lava") + " empowers your offensive capabilities" : + "The " + (player.wet ? (player.honeyWet ? "honey cools" : "water douses") : "darkness of night cools") + " your flames, empowering your defensive capabilities") + + (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); + } + } + else if (CalamityWorld.downedSCal) + { + tip = "Your profaned soul is constrained by your insufficient summoning powers"; + } + } } } } diff --git a/Buffs/Pets/SparksBuff.cs b/Buffs/Pets/SparksBuff.cs new file mode 100644 index 0000000000..c591ed997f --- /dev/null +++ b/Buffs/Pets/SparksBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class SparksBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sparks"); + Description.SetDefault("Eats butterflies"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().sparks = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + (player.height / 2), 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 50f, 0f); + } + } + } +} diff --git a/Buffs/Pets/SparksBuff.png b/Buffs/Pets/SparksBuff.png new file mode 100644 index 0000000000..6fc861c7ef Binary files /dev/null and b/Buffs/Pets/SparksBuff.png differ diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs new file mode 100644 index 0000000000..d54dc5d229 --- /dev/null +++ b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class HallowedRuneAtkBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Hallowed Power"); + Description.SetDefault("Minion damage boosted by 15%"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sPower = true; + } + } +} diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.png b/Buffs/StatBuffs/HallowedRuneAtkBuff.png new file mode 100644 index 0000000000..9c504e33fa Binary files /dev/null and b/Buffs/StatBuffs/HallowedRuneAtkBuff.png differ diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.cs b/Buffs/StatBuffs/HallowedRuneDefBuff.cs new file mode 100644 index 0000000000..912fac2635 --- /dev/null +++ b/Buffs/StatBuffs/HallowedRuneDefBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class HallowedRuneDefBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Hallowed Defense"); + Description.SetDefault("Defense boosted by 7 and damage reduction boosted by 7%"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hallowedDefense = true; + } + } +} diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.png b/Buffs/StatBuffs/HallowedRuneDefBuff.png new file mode 100644 index 0000000000..bedc537399 Binary files /dev/null and b/Buffs/StatBuffs/HallowedRuneDefBuff.png differ diff --git a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs new file mode 100644 index 0000000000..09608d87b5 --- /dev/null +++ b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class HallowedRuneRegenBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Hallowed Regen"); + Description.SetDefault("Regenerating life"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().sRegen = true; + } + } +} diff --git a/Buffs/StatBuffs/HallowedRuneRegenBuff.png b/Buffs/StatBuffs/HallowedRuneRegenBuff.png new file mode 100644 index 0000000000..118f4e35e7 Binary files /dev/null and b/Buffs/StatBuffs/HallowedRuneRegenBuff.png differ diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs new file mode 100644 index 0000000000..6fa400e971 --- /dev/null +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -0,0 +1,27 @@ +using CalamityMod.World; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class ProfanedCrystalBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Devotion"); + Description.SetDefault("The profaned soul within has been defiled by the powerful magic of a supreme witch"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + if (CalamityWorld.downedSCal && (player.Calamity().minionSlotStat - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce) + { + player.Calamity().profanedCrystalBuffs = true; + } + } + } +} diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.png b/Buffs/StatBuffs/ProfanedCrystalBuff.png new file mode 100644 index 0000000000..ae762bf09f Binary files /dev/null and b/Buffs/StatBuffs/ProfanedCrystalBuff.png differ diff --git a/Buffs/Summon/BloodDragonsBuff.cs b/Buffs/Summon/BloodDragonsBuff.cs new file mode 100644 index 0000000000..503292544b --- /dev/null +++ b/Buffs/Summon/BloodDragonsBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class BloodDragonsBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Skeletal Dragons"); + Description.SetDefault("Big happy family"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.dragonFamily = true; + } + if (!modPlayer.dragonFamily) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/BloodDragonsBuff.png b/Buffs/Summon/BloodDragonsBuff.png new file mode 100644 index 0000000000..507a4dc698 Binary files /dev/null and b/Buffs/Summon/BloodDragonsBuff.png differ diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs new file mode 100644 index 0000000000..e8dd25c59f --- /dev/null +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class CorvidHarbringerBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Raven"); + Description.SetDefault("The powerful raven will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.powerfulRaven = true; + } + if (!modPlayer.powerfulRaven) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/CorvidHarbringerBuff.png b/Buffs/Summon/CorvidHarbringerBuff.png new file mode 100644 index 0000000000..6f4f6df1c5 Binary files /dev/null and b/Buffs/Summon/CorvidHarbringerBuff.png differ diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs new file mode 100644 index 0000000000..617011a0dd --- /dev/null +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class DazzlingStabberBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Dazzling Stabber"); + Description.SetDefault("En garde"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.providenceStabber = true; + } + if (!modPlayer.providenceStabber) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/DazzlingStabberBuff.png b/Buffs/Summon/DazzlingStabberBuff.png new file mode 100644 index 0000000000..4a2ab50bd6 Binary files /dev/null and b/Buffs/Summon/DazzlingStabberBuff.png differ diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs new file mode 100644 index 0000000000..36745f20d3 --- /dev/null +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class EndoHydraBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Endo Hydra"); + Description.SetDefault("The endo hydra will protect you... for some reason"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.endoHydra = true; + } + if (!modPlayer.endoHydra) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/EndoHydraBuff.png b/Buffs/Summon/EndoHydraBuff.png new file mode 100644 index 0000000000..46127e0c18 Binary files /dev/null and b/Buffs/Summon/EndoHydraBuff.png differ diff --git a/Buffs/Summon/FuelCellBundleBuff.cs b/Buffs/Summon/FuelCellBundleBuff.cs new file mode 100644 index 0000000000..8516a54014 --- /dev/null +++ b/Buffs/Summon/FuelCellBundleBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class FuelCellBundleBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mini Plaguebringer"); + Description.SetDefault("A small plague bee is following you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.plaguebringerMK2 = true; + } + if (!modPlayer.plaguebringerMK2) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/FuelCellBundleBuff.png b/Buffs/Summon/FuelCellBundleBuff.png new file mode 100644 index 0000000000..cceb2eea45 Binary files /dev/null and b/Buffs/Summon/FuelCellBundleBuff.png differ diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs new file mode 100644 index 0000000000..c44d973dfa --- /dev/null +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class IgneousExaltationBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Igneous Blade"); + Description.SetDefault("A blade is orbiting you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.igneousExaltation = true; + } + if (!modPlayer.providenceStabber) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/IgneousExaltationBuff.png b/Buffs/Summon/IgneousExaltationBuff.png new file mode 100644 index 0000000000..13ce07a7d2 Binary files /dev/null and b/Buffs/Summon/IgneousExaltationBuff.png differ diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs new file mode 100644 index 0000000000..5492e4063a --- /dev/null +++ b/Buffs/Summon/MagicHatBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class MagicHatBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Magic Hat"); + Description.SetDefault("The hat carries your soul, bound by a contract"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.magicHat = true; + } + if (!modPlayer.magicHat) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/MagicHatBuff.png b/Buffs/Summon/MagicHatBuff.png new file mode 100644 index 0000000000..fb32678074 Binary files /dev/null and b/Buffs/Summon/MagicHatBuff.png differ diff --git a/Buffs/Summon/ProfanedBabs.cs b/Buffs/Summon/ProfanedBabs.cs index e388f8ab83..38a96f3717 100644 --- a/Buffs/Summon/ProfanedBabs.cs +++ b/Buffs/Summon/ProfanedBabs.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.Summon public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.gHealer) + if (!modPlayer.gHealer || modPlayer.profanedCrystalBuffs) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/Summon/RadiantResolutionBuff.cs b/Buffs/Summon/RadiantResolutionBuff.cs new file mode 100644 index 0000000000..886f8dcd49 --- /dev/null +++ b/Buffs/Summon/RadiantResolutionBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class RadiantResolutionBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Radiant Resolution"); + Description.SetDefault("A radiant aura protects you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.radiantResolution = true; + } + if (!modPlayer.radiantResolution) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/RadiantResolutionBuff.png b/Buffs/Summon/RadiantResolutionBuff.png new file mode 100644 index 0000000000..71c1dedb1d Binary files /dev/null and b/Buffs/Summon/RadiantResolutionBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ff3bcb2fa9..6722aea72d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5,9 +5,9 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Armor; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; -using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Mounts; @@ -28,6 +28,7 @@ using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; @@ -54,8 +55,16 @@ namespace CalamityMod.CalPlayer None = 1 } + public enum AnimationType + { + Idle, + Jump, + Walk + } + public class CalamityPlayer : ModPlayer { + #region Variables // No Category public static bool areThereAnyDamnBosses = false; @@ -67,43 +76,43 @@ namespace CalamityMod.CalPlayer public int sCalDeathCount = 0; public int sCalKillCount = 0; public int deathCount = 0; - public int actualMaxLife = 0; - public int deathModeUnderworldTime = 0; - public int deathModeBlizzardTime = 0; - public static int chaosStateDuration = 600; - public bool killSpikyBalls = false; - public Projectile lastProjectileHit; + public int actualMaxLife = 0; + public int deathModeUnderworldTime = 0; + public int deathModeBlizzardTime = 0; + public static int chaosStateDuration = 600; + public bool killSpikyBalls = false; + public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; - + // "External" variables -- Only set by Mod.Call public int externalAbyssLight = 0; public bool externalColdImmunity = false; public bool externalHeatImmunity = false; - // Stat Meter - public int[] damageStats = new int[5]; - public int[] critStats = new int[4]; - public int defenseStat = 0; - public int DRStat = 0; - public int meleeSpeedStat = 0; - public int manaCostStat = 0; - public int rogueVelocityStat = 0; - public int minionSlotStat = 0; - public int lifeRegenStat = 0; - public int manaRegenStat = 0; - public int ammoReductionRanged = 0; - public int ammoReductionRogue = 0; - public int armorPenetrationStat = 0; - public int wingFlightTimeStat = 0; - public int adrenalineChargeStat = 0; - public int rageDamageStat = 0; - public int moveSpeedStat = 0; - public int abyssLightLevelStat = 0; - public int abyssBreathLossStat = 0; - public int abyssBreathLossRateStat = 0; - public int abyssLifeLostAtZeroBreathStat = 0; - public int abyssDefenseLossStat = 0; - public int stealthStat = 0; + // Stat Meter + public int[] damageStats = new int[5]; + public int[] critStats = new int[4]; + public int defenseStat = 0; + public int DRStat = 0; + public int meleeSpeedStat = 0; + public int manaCostStat = 0; + public int rogueVelocityStat = 0; + public int minionSlotStat = 0; + public int lifeRegenStat = 0; + public int manaRegenStat = 0; + public int ammoReductionRanged = 0; + public int ammoReductionRogue = 0; + public int armorPenetrationStat = 0; + public int wingFlightTimeStat = 0; + public int adrenalineChargeStat = 0; + public int rageDamageStat = 0; + public int moveSpeedStat = 0; + public int abyssLightLevelStat = 0; + public int abyssBreathLossStat = 0; + public int abyssBreathLossRateStat = 0; + public int abyssLifeLostAtZeroBreathStat = 0; + public int abyssDefenseLossStat = 0; + public int stealthStat = 0; public float standingRegenStat = 0f; public float movingRegenStat = 0f; @@ -132,7 +141,10 @@ namespace CalamityMod.CalPlayer public float shieldInvinc = 5f; public GaelSwitchPhase gaelSwitchTimer = 0; public int galileoCooldown = 0; - public int planarSpeedBoost = 0; + public int planarSpeedBoost = 0; + public int profanedSoulWeaponUsage = 0; + public int profanedSoulWeaponType = 0; + public int hurtSoundTimer = 0; // Sound public bool playRogueStealthSound = false; @@ -189,6 +201,7 @@ namespace CalamityMod.CalPlayer public bool akato = false; public bool leviPet = false; public bool rotomPet = false; + public bool sparks = false; public bool sirenPet = false; public bool fox = false; public bool chibii = false; @@ -232,19 +245,19 @@ namespace CalamityMod.CalPlayer public bool adrenalineBoostOne = false; public bool adrenalineBoostTwo = false; public bool adrenalineBoostThree = false; - public bool healToFull = false; + public bool healToFull = false; // Lore public bool kingSlimeLore = false; public bool desertScourgeLore = false; - public bool crabulonLore = false; + public bool crabulonLore = false; public bool eaterOfWorldsLore = false; public bool hiveMindLore = false; public bool perforatorLore = false; public bool queenBeeLore = false; public bool skeletronLore = false; public bool wallOfFleshLore = false; - public bool twinsLore = false; + public bool twinsLore = false; public bool destroyerLore = false; public bool aquaticScourgeLore = false; public bool skeletronPrimeLore = false; @@ -280,9 +293,9 @@ namespace CalamityMod.CalPlayer public bool regenator = false; public bool theBee = false; public int theBeeCooldown = 0; - public bool alluringBait = false; - public bool enchantedPearl = false; - public bool fishingStation = false; + public bool alluringBait = false; + public bool enchantedPearl = false; + public bool fishingStation = false; public bool rBrain = false; public bool bloodyWormTooth = false; public bool afflicted = false; @@ -395,7 +408,7 @@ namespace CalamityMod.CalPlayer public bool voltaicJelly = false; public bool jellyChargedBattery = false; public float jellyDmg; - //public bool dukeScales = false; + public bool dukeScales = false; public bool sandWaifu = false; public bool sandBoobWaifu = false; public bool cloudWaifu = false; @@ -432,8 +445,17 @@ namespace CalamityMod.CalPlayer public int plaguedFuelPackDirection = 0; public bool veneratedLocket = false; public bool camper = false; + public bool corrosiveSpine = false; + public bool miniOldDuke = false; + public bool starbusterCore = false; + public bool hallowedRune = false; + public bool hallowedDefense = false; + public bool hallowedPower = false; + public bool hallowedRegen = false; + // Armor Set + public bool snowRuffianSet = false; public bool eskimoSet = false; //vanilla armor public bool meteorSet = false; //vanilla armor, for space gun nerf public bool victideSet = false; @@ -444,23 +466,23 @@ namespace CalamityMod.CalPlayer public bool tarraMelee = false; public bool tarragonCloak = false; public bool tarragonCloakCooldown = false; - public int tarraDefenseTime = 600; + public int tarraDefenseTime = 600; public bool tarraMage = false; public int tarraMageHealCooldown = 0; public int tarraCrits = 0; public bool tarraRanged = false; public bool tarraThrowing = false; - public bool tarragonImmunityCooldown = false; - public bool tarragonImmunity = false; - public int tarraThrowingCrits = 0; + public bool tarragonImmunityCooldown = false; + public bool tarragonImmunity = false; + public int tarraThrowingCrits = 0; public bool tarraSummon = false; public bool bloodflareSet = false; public bool bloodflareMelee = false; - public bool bloodflareFrenzy = false; - public bool bloodFrenzyCooldown = false; - public int bloodflareMeleeHits = 0; + public bool bloodflareFrenzy = false; + public bool bloodFrenzyCooldown = false; + public int bloodflareMeleeHits = 0; public bool bloodflareRanged = false; - public bool bloodflareSoulCooldown = false; + public bool bloodflareSoulCooldown = false; public bool bloodflareThrowing = false; public bool bloodflareMage = false; public int bloodflareMageCooldown = 0; @@ -494,11 +516,11 @@ namespace CalamityMod.CalPlayer public bool umbraphileSet = false; public bool reaverBlast = false; public bool reaverBurst = false; - //public bool fathomSwarmer = false; - //public bool fathomSwarmerVisage = false; + //public bool fathomSwarmer = false; + //public bool fathomSwarmerVisage = false; public bool astralStarRain = false; public int astralStarRainCooldown = 0; - public bool plagueReaper = false; + public bool plagueReaper = false; public int plagueReaperCooldown = 0; public float ataxiaDmg; public bool ataxiaMage = false; @@ -530,8 +552,8 @@ namespace CalamityMod.CalPlayer public bool chaosSpirit = false; public bool redDevil = false; - // Debuff - public bool alcoholPoisoning = false; + // Debuff + public bool alcoholPoisoning = false; public bool shadowflame = false; public bool wDeath = false; public bool lethalLavaBurn = false; @@ -585,7 +607,7 @@ namespace CalamityMod.CalPlayer public bool omniscience = false; public bool zerg = false; public bool zen = false; - public bool bossZen = false; + public bool bossZen = false; public bool yPower = false; public bool aWeapon = false; public bool tScale = false; @@ -706,6 +728,13 @@ namespace CalamityMod.CalPlayer public bool cSpirit = false; public bool rOrb = false; public bool dCrystal = false; + public bool endoHydra = false; + public bool powerfulRaven = false; + public bool dragonFamily = false; + public bool providenceStabber = false; + public bool radiantResolution = false; + public bool plaguebringerMK2 = false; + public bool igneousExaltation = false; // Biome public bool ZoneCalamity = false; @@ -727,6 +756,13 @@ namespace CalamityMod.CalPlayer public bool abyssalDivingSuitHide; public bool abyssalDivingSuitForce; public bool abyssalDivingSuitPower; + public bool profanedCrystal; + public bool profanedCrystalPrevious; + public bool profanedCrystalForce; + public bool profanedCrystalBuffs; + public bool profanedCrystalHide; + public KeyValuePair profanedCrystalWingCounter = new KeyValuePair(0, 10); + public KeyValuePair profanedCrystalAnimCounter = new KeyValuePair(0, 10); public bool sirenBoobsPrevious; public bool sirenBoobs; public bool sirenBoobsHide; @@ -811,8 +847,8 @@ namespace CalamityMod.CalPlayer { "deathCount", deathCount }, { "moneyStolenByBandit", moneyStolenByBandit }, { "reforges", reforges }, - { "deathModeUnderworldTime", deathModeUnderworldTime }, - { "deathModeBlizzardTime", deathModeBlizzardTime } + { "deathModeUnderworldTime", deathModeUnderworldTime }, + { "deathModeBlizzardTime", deathModeBlizzardTime } }; } @@ -845,8 +881,8 @@ namespace CalamityMod.CalPlayer deathCount = tag.GetInt("deathCount"); moneyStolenByBandit = tag.GetInt("moneyStolenByBandit"); reforges = tag.GetInt("reforges"); - deathModeUnderworldTime = tag.GetInt("deathModeUnderworldTime"); - deathModeBlizzardTime = tag.GetInt("deathModeBlizzardTime"); + deathModeUnderworldTime = tag.GetInt("deathModeUnderworldTime"); + deathModeBlizzardTime = tag.GetInt("deathModeBlizzardTime"); meleeLevel = tag.GetInt("meleeLevel"); rangedLevel = tag.GetInt("rangedLevel"); @@ -870,8 +906,8 @@ namespace CalamityMod.CalPlayer deathCount = reader.ReadInt32(); moneyStolenByBandit = reader.ReadInt32(); reforges = reader.ReadInt32(); - deathModeUnderworldTime = reader.ReadInt32(); - deathModeBlizzardTime = reader.ReadInt32(); + deathModeUnderworldTime = reader.ReadInt32(); + deathModeBlizzardTime = reader.ReadInt32(); meleeLevel = reader.ReadInt32(); rangedLevel = reader.ReadInt32(); @@ -920,81 +956,81 @@ namespace CalamityMod.CalPlayer #region ResetEffects public override void ResetEffects() { - // Max health bonuses - if (absorber) - player.statLifeMax2 += 20; - player.statLifeMax2 += - (mFruit ? 25 : 0) + - (bOrange ? 25 : 0) + - (eBerry ? 25 : 0) + - (dFruit ? 25 : 0); - if (ZoneAbyss && abyssalAmulet) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); - if (coreOfTheBloodGod) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; - if (bloodPact) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; - if (leviathanAndSirenLore) - { - if (sirenBoobsPrevious || sirenBoobsAltPrevious) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; - } - if (hAttack) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; - if (affliction || afflicted) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; - if (cadence) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; - if (community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - int integerTypeBoost = (int)(floatTypeBoost * 50f); - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; - } + // Max health bonuses + if (absorber) + player.statLifeMax2 += 20; + player.statLifeMax2 += + (mFruit ? 25 : 0) + + (bOrange ? 25 : 0) + + (eBerry ? 25 : 0) + + (dFruit ? 25 : 0); + if (ZoneAbyss && abyssalAmulet) + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); + if (coreOfTheBloodGod) + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; + if (bloodPact) + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; + if (leviathanAndSirenLore) + { + if (sirenBoobsPrevious || sirenBoobsAltPrevious) + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; + } + if (hAttack) + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; + if (affliction || afflicted) + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; + if (cadence) + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; + if (community) + { + float floatTypeBoost = 0.01f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + int integerTypeBoost = (int)(floatTypeBoost * 50f); + player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; + } - // Max health reductions - if (crimEffigy) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); - if (badgeOfBraveryRare) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - if (regenator) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); - if (skeletronLore) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.9); - if (calamitasLore) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - if (providenceLore) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); + // Max health reductions + if (crimEffigy) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); + if (badgeOfBraveryRare) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + if (regenator) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); + if (skeletronLore) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.9); + if (calamitasLore) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + if (providenceLore) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); - // Extra accessory slots - if (extraAccessoryML) - player.extraAccessorySlots = 1; - if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) - player.extraAccessorySlots = 2; - if (CalamityWorld.bossRushActive) - { - if (CalamityMod.CalamityConfig.BossRushAccessoryCurse) - { - player.extraAccessorySlots = 0; - } - } + // Extra accessory slots + if (extraAccessoryML) + player.extraAccessorySlots = 1; + if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) + player.extraAccessorySlots = 2; + if (CalamityWorld.bossRushActive) + { + if (CalamityMod.CalamityConfig.BossRushAccessoryCurse) + { + player.extraAccessorySlots = 0; + } + } - ResetRogueStealth(); + ResetRogueStealth(); throwingDamage = 1f; throwingVelocity = 1f; @@ -1016,6 +1052,7 @@ namespace CalamityMod.CalPlayer akato = false; leviPet = false; rotomPet = false; + sparks = false; sirenPet = false; fox = false; chibii = false; @@ -1031,6 +1068,7 @@ namespace CalamityMod.CalPlayer angryDog = false; fab = false; crysthamyr = false; + miniOldDuke = false; abyssalDivingSuitPlates = false; abyssalDivingSuitCooldown = false; @@ -1102,14 +1140,14 @@ namespace CalamityMod.CalPlayer kingSlimeLore = false; desertScourgeLore = false; - crabulonLore = false; + crabulonLore = false; eaterOfWorldsLore = false; hiveMindLore = false; perforatorLore = false; queenBeeLore = false; skeletronLore = false; wallOfFleshLore = false; - twinsLore = false; + twinsLore = false; destroyerLore = false; aquaticScourgeLore = false; skeletronPrimeLore = false; @@ -1139,9 +1177,9 @@ namespace CalamityMod.CalPlayer regenator = false; deepDiver = false; theBee = false; - alluringBait = false; - enchantedPearl = false; - fishingStation = false; + alluringBait = false; + enchantedPearl = false; + fishingStation = false; rBrain = false; bloodyWormTooth = false; rampartOfDeities = false; @@ -1183,7 +1221,7 @@ namespace CalamityMod.CalPlayer stressPills = false; laudanum = false; fleshTotem = false; - fleshTotemCooldown = false; + fleshTotemCooldown = false; bloodPact = false; bloodflareCore = false; coreOfTheBloodGod = false; @@ -1211,6 +1249,9 @@ namespace CalamityMod.CalPlayer sDefense = false; sRegen = false; sPower = false; + hallowedDefense = false; + hallowedRegen = false; + hallowedPower = false; IBoots = false; elysianFire = false; sTracers = false; @@ -1221,7 +1262,7 @@ namespace CalamityMod.CalPlayer thiefsDime = false; dynamoStemCells = false; etherealExtorter = false; - //dukeScales = false; + dukeScales = false; blazingCore = false; voltaicJelly = false; jellyChargedBattery = false; @@ -1248,6 +1289,8 @@ namespace CalamityMod.CalPlayer astralStarRain = false; + snowRuffianSet = false; + eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf @@ -1266,22 +1309,22 @@ namespace CalamityMod.CalPlayer tarraSet = false; tarraMelee = false; - tarragonCloak = false; - tarragonCloakCooldown = false; + tarragonCloak = false; + tarragonCloakCooldown = false; tarraMage = false; tarraRanged = false; tarraThrowing = false; - tarragonImmunity = false; - tarragonImmunityCooldown = false; + tarragonImmunity = false; + tarragonImmunityCooldown = false; tarraSummon = false; bloodflareSet = false; bloodflareMelee = false; - bloodflareFrenzy = false; - bloodFrenzyCooldown = false; - bloodflareRanged = false; - bloodflareSoulCooldown = false; - bloodflareThrowing = false; + bloodflareFrenzy = false; + bloodFrenzyCooldown = false; + bloodflareRanged = false; + bloodflareSoulCooldown = false; + bloodflareThrowing = false; bloodflareMage = false; bloodflareSummon = false; @@ -1312,7 +1355,7 @@ namespace CalamityMod.CalPlayer plaguedFuelPack = false; camper = false; - alcoholPoisoning = false; + alcoholPoisoning = false; shadowflame = false; wDeath = false; lethalLavaBurn = false; @@ -1350,7 +1393,7 @@ namespace CalamityMod.CalPlayer cragsLava = false; vaporfied = false; - revivify = false; + revivify = false; trinketOfChiBuff = false; corrEffigy = false; crimEffigy = false; @@ -1365,7 +1408,7 @@ namespace CalamityMod.CalPlayer omniscience = false; zerg = false; zen = false; - bossZen = false; + bossZen = false; permafrostsConcoction = false; armorCrumbling = false; armorShattering = false; @@ -1498,6 +1541,15 @@ namespace CalamityMod.CalPlayer shellfish = false; hCrab = false; tDime = false; + endoHydra = false; + powerfulRaven = false; + dragonFamily = false; + providenceStabber = false; + hallowedRune = false; + starbusterCore = false; + plaguebringerMK2 = false; + igneousExaltation = false; + radiantResolution = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; @@ -1507,27 +1559,30 @@ namespace CalamityMod.CalPlayer sirenBoobsAltPrevious = sirenBoobsAlt; sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; + profanedCrystalPrevious = profanedCrystal; + profanedCrystal = profanedCrystalBuffs = profanedCrystalForce = profanedCrystalHide = false; + snowmanPrevious = snowman; snowman = snowmanHide = snowmanForce = snowmanPower = false; rageMode = false; adrenalineMode = false; - lastProjectileHit = null; + lastProjectileHit = null; } #endregion #region UpdateDead public override void UpdateDead() { - #region Debuffs - deathModeBlizzardTime = 0; - deathModeUnderworldTime = 0; + #region Debuffs + deathModeBlizzardTime = 0; + deathModeUnderworldTime = 0; gaelRageCooldown = 0; gaelSwipes = 0; gaelSwitchTimer = (GaelSwitchPhase)0; - planarSpeedBoost = 0; - galileoCooldown = 0; + planarSpeedBoost = 0; + galileoCooldown = 0; stress = 0; adrenaline = 0; raiderStack = 0; @@ -1549,14 +1604,14 @@ namespace CalamityMod.CalPlayer plaguedFuelPackDash = 0; plaguedFuelPackDirection = 0; theBeeCooldown = 0; - killSpikyBalls = false; + killSpikyBalls = false; moonCrownCooldown = 0; featherCrownCooldown = 0; nanoFlareCooldown = 0; fleshTotemCooldown = false; sandCloakCooldown = false; - alcoholPoisoning = false; + alcoholPoisoning = false; shadowflame = false; wDeath = false; lethalLavaBurn = false; @@ -1620,6 +1675,9 @@ namespace CalamityMod.CalPlayer sDefense = false; sRegen = false; sPower = false; + hallowedDefense = false; + hallowedRegen = false; + hallowedPower = false; onyxExcavator = false; angryDog = false; fab = false; @@ -1642,7 +1700,7 @@ namespace CalamityMod.CalPlayer omniscience = false; zerg = false; zen = false; - bossZen = false; + bossZen = false; permafrostsConcoction = false; armorCrumbling = false; armorShattering = false; @@ -1763,6 +1821,7 @@ namespace CalamityMod.CalPlayer ataxiaFire = false; ataxiaVolley = false; ataxiaBlaze = false; + snowRuffianSet = false; eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf victideSet = false; @@ -1770,23 +1829,23 @@ namespace CalamityMod.CalPlayer statigelSet = false; tarraSet = false; tarraMelee = false; - tarragonCloak = false; - tarragonCloakCooldown = false; - tarraDefenseTime = 600; + tarragonCloak = false; + tarragonCloakCooldown = false; + tarraDefenseTime = 600; tarraMage = false; tarraRanged = false; tarraThrowing = false; - tarragonImmunity = false; - tarragonImmunityCooldown = false; + tarragonImmunity = false; + tarragonImmunityCooldown = false; tarraThrowingCrits = 0; tarraSummon = false; bloodflareSet = false; bloodflareMelee = false; - bloodflareFrenzy = false; - bloodFrenzyCooldown = false; - bloodflareMeleeHits = 0; + bloodflareFrenzy = false; + bloodFrenzyCooldown = false; + bloodflareMeleeHits = 0; bloodflareRanged = false; - bloodflareSoulCooldown = false; + bloodflareSoulCooldown = false; bloodflareThrowing = false; bloodflareMage = false; bloodflareSummon = false; @@ -1800,7 +1859,7 @@ namespace CalamityMod.CalPlayer elysianGuard = false; #endregion - lastProjectileHit = null; + lastProjectileHit = null; if (CalamityWorld.bossRushActive) @@ -2058,40 +2117,40 @@ namespace CalamityMod.CalPlayer } if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) { - if (!player.chaosState) - { - Vector2 teleportLocation; - teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - teleportLocation.X -= (float)(player.width / 2); - if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int x = (int)(teleportLocation.X / 16f); - int y = (int)(teleportLocation.Y / 16f); - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) - { - player.Teleport(teleportLocation, 4, 0); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + if (!player.chaosState) + { + Vector2 teleportLocation; + teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + teleportLocation.X -= (float)(player.width / 2); + if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int x = (int)(teleportLocation.X / 16f); + int y = (int)(teleportLocation.Y / 16f); + if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + { + player.Teleport(teleportLocation, 4, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); - } - } - } + if (scarfCooldown) + player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); + else + player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + } + } + } } if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && !sandCloakCooldown) { - player.AddBuff(ModContent.BuffType(), 1800, false); //30 seconds + player.AddBuff(ModContent.BuffType(), 1800, false); //30 seconds rogueStealth -= rogueStealthMax * 0.25f; Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI, 0, 0); Main.PlaySound(2, player.position, 45); @@ -2099,62 +2158,62 @@ namespace CalamityMod.CalPlayer if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) { - if (!player.chaosState) - { - float teleportRange = 320f; - Vector2 teleportLocation; - teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - teleportLocation.X -= (float)(player.width / 2); - Vector2 playerToTeleport = teleportLocation - player.position; - if (playerToTeleport.Length() > teleportRange) - { - playerToTeleport.Normalize(); - playerToTeleport *= teleportRange; - teleportLocation = player.position + playerToTeleport; - } - if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int x = (int)(teleportLocation.X / 16f); - int y = (int)(teleportLocation.Y / 16f); - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) - { - rogueStealth -= rogueStealthMax * 0.25f; + if (!player.chaosState) + { + float teleportRange = 320f; + Vector2 teleportLocation; + teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + teleportLocation.X -= (float)(player.width / 2); + Vector2 playerToTeleport = teleportLocation - player.position; + if (playerToTeleport.Length() > teleportRange) + { + playerToTeleport.Normalize(); + playerToTeleport *= teleportRange; + teleportLocation = player.position + playerToTeleport; + } + if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int x = (int)(teleportLocation.X / 16f); + int y = (int)(teleportLocation.Y / 16f); + if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + { + rogueStealth -= rogueStealthMax * 0.25f; - player.Teleport(teleportLocation, 1, 0); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + player.Teleport(teleportLocation, 1, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + if (scarfCooldown) + player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); + else + player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); - int numDust = 40; - Vector2 step = playerToTeleport / numDust; - for (int i = 0; i < numDust; i++) - { - int dustIndex = Dust.NewDust(player.Center - (step * i), 1, 1, 21, step.X, step.Y); - Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].noLight = true; - } + int numDust = 40; + Vector2 step = playerToTeleport / numDust; + for (int i = 0; i < numDust; i++) + { + int dustIndex = Dust.NewDust(player.Center - (step * i), 1, 1, 21, step.X, step.Y); + Main.dust[dustIndex].noGravity = true; + Main.dust[dustIndex].noLight = true; + } - player.immune = true; - player.immuneTime = 120; - spectralVeilImmunity = 120; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } - } - } - } + player.immune = true; + player.immuneTime = 120; + spectralVeilImmunity = 120; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + } + } + } } if (CalamityMod.PlaguePackHotKey.JustPressed && plaguedFuelPack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && plaguedFuelPackCooldown == 0 && !player.mount.Active) @@ -2170,18 +2229,18 @@ namespace CalamityMod.CalPlayer { if (tarraMelee && !tarragonCloakCooldown && !tarragonCloak) { - if (player.whoAmI == Main.myPlayer) - { - player.AddBuff(ModContent.BuffType(), 602, false); - } - } + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 602, false); + } + } if (bloodflareRanged && !bloodflareSoulCooldown) { - if (player.whoAmI == Main.myPlayer) - { - player.AddBuff(ModContent.BuffType(), 1800, false); - } - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 1800, false); + } + 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, 1f); @@ -2220,10 +2279,10 @@ namespace CalamityMod.CalPlayer } if (omegaBlueSet && omegaBlueCooldown <= 0) { - if (player.whoAmI == Main.myPlayer) - { - player.AddBuff(ModContent.BuffType(), 300, false); - } + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 300, false); + } omegaBlueCooldown = 1800; Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); for (int i = 0; i < 66; i++) @@ -2271,8 +2330,8 @@ namespace CalamityMod.CalPlayer } } } - if (plagueReaper && plagueReaperCooldown <= 0) - plagueReaperCooldown = 1800; + if (plagueReaper && plagueReaperCooldown <= 0) + plagueReaperCooldown = 1800; } if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) { @@ -2403,7 +2462,7 @@ namespace CalamityMod.CalPlayer if (sulfurSet && player.controlJump && player.justJumped && player.jumpAgainSandstorm) { int bubble = Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(20f * (player.allDamage + throwingDamage - 1f)), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); - Main.projectile[bubble].Calamity().forceRogue = true; + Main.projectile[bubble].Calamity().forceRogue = true; } } #endregion @@ -2703,6 +2762,11 @@ namespace CalamityMod.CalPlayer sirenBoobsAltHide = false; sirenBoobsAltForce = true; } + else if (item.type == ModContent.ItemType()) + { + profanedCrystalHide = false; + profanedCrystalForce = true; + } } } @@ -2856,6 +2920,10 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 2); } } + if (profanedCrystal) + { + player.AddBuff(ModContent.BuffType(), 60, true); + } } #endregion @@ -2920,9 +2988,9 @@ namespace CalamityMod.CalPlayer public override void PostUpdateMiscEffects() { - CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); + CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); - if (player.HeldItem.type == ModContent.ItemType()) + if (player.HeldItem.type == ModContent.ItemType()) { gaelSwitchTimer = GaelSwitchPhase.LoseRage; stress += (int)MathHelper.Min(5, 10000 - stress); @@ -2942,6 +3010,9 @@ namespace CalamityMod.CalPlayer CalamityWorld.dragonScalesBought = true; } } + #endregion + + #region Shop Restrictions public override bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item) { @@ -2951,6 +3022,14 @@ namespace CalamityMod.CalPlayer } return base.CanBuyItem(vendor, shopInventory, item); } + + public override bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) + { + if (item.type == ModContent.ItemType()) + return CalamityWorld.downedSCal; //no easy moneycoins for post doggo/yhar + return base.CanSellItem(vendor, shopInventory, item); + } + #endregion public override void PostUpdateRunSpeeds() @@ -2989,20 +3068,20 @@ namespace CalamityMod.CalPlayer ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (destroyerLore) - { - runAccMult *= 0.95f; - } - if (twinsLore) - { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) - runAccMult *= 0.95f; - } - if (skeletronPrimeLore) - { - runAccMult *= 0.95f; - } - if (abyssalDivingSuit && !player.IsUnderwater()) + if (destroyerLore) + { + runAccMult *= 0.95f; + } + if (twinsLore) + { + if (player.statLife < (int)(player.statLifeMax2 * 0.5)) + runAccMult *= 0.95f; + } + if (skeletronPrimeLore) + { + runAccMult *= 0.95f; + } + if (abyssalDivingSuit && !player.IsUnderwater()) { runAccMult *= 0.4f; runSpeedMult *= 0.4f; @@ -3031,12 +3110,12 @@ namespace CalamityMod.CalPlayer { runSpeedMult *= 0.6666667f; } - if (CalamityWorld.death && deathModeBlizzardTime > 0) - { - float speedMult = (float)(3600 - deathModeBlizzardTime) / 3600f; - runAccMult *= speedMult; - runSpeedMult *= speedMult; - } + if (CalamityWorld.death && deathModeBlizzardTime > 0) + { + float speedMult = (float)(3600 - deathModeBlizzardTime) / 3600f; + runAccMult *= speedMult; + runSpeedMult *= speedMult; + } player.runAcceleration *= runAccMult; player.maxRunSpeed *= runSpeedMult; @@ -3187,7 +3266,7 @@ namespace CalamityMod.CalPlayer if (player.FindBuffIndex(ModContent.BuffType()) > -1) { player.ClearBuff(ModContent.BuffType()); - player.AddBuff(ModContent.BuffType(), 1800); + player.AddBuff(ModContent.BuffType(), 1800); } player.AddBuff(ModContent.BuffType(), 2700); return false; @@ -3213,7 +3292,7 @@ namespace CalamityMod.CalPlayer if (player.FindBuffIndex(ModContent.BuffType()) > -1) { player.ClearBuff(ModContent.BuffType()); - player.AddBuff(ModContent.BuffType(), 1800); + player.AddBuff(ModContent.BuffType(), 1800); } } } @@ -3240,6 +3319,7 @@ namespace CalamityMod.CalPlayer } //Custom Death Messages + if (alcoholPoisoning && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { if (Main.rand.Next(2) == 0) @@ -3319,19 +3399,19 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air."); } - if (everclear && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness."); - } if (manaOverloader && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s life was completely converted into mana."); } - if ((bloodyMary || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine) + if ((bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness."); } + if (profanedCrystalBuffs && !profanedCrystalHide) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " was summoned too soon."); + } if (NPC.AnyNPCs(ModContent.NPCType())) { @@ -3390,11 +3470,11 @@ namespace CalamityMod.CalPlayer bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type) && ItemID.Sets.Yoyo[item.type] != true)); if (isTrueMelee) { - if (tScale) - { - player.statDefense += 25; - player.endurance += 0.1f; - } + if (tScale) + { + player.statDefense += 25; + player.endurance += 0.1f; + } float damageAdd = (dodgeScarf ? 0.2f : 0f) + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2f : 0f) + @@ -3427,19 +3507,19 @@ namespace CalamityMod.CalPlayer { add += 0.1f; } - if (etherealExtorter && player.ZoneDungeon && item.Calamity().rogue && !item.consumable) - { - add += 0.05f; - } + if (etherealExtorter && player.ZoneDungeon && item.Calamity().rogue && !item.consumable) + { + add += 0.05f; + } - if (item.ranged) - { - acidRoundMultiplier = (double)(item.useTime) / 20D; - } - else - { - acidRoundMultiplier = 1D; - } + if (item.ranged) + { + acidRoundMultiplier = (double)(item.useTime) / 20D; + } + else + { + acidRoundMultiplier = 1D; + } } public override void GetWeaponKnockback(Item item, ref float knockback) { @@ -3463,18 +3543,18 @@ namespace CalamityMod.CalPlayer { knockback *= 1.09f; } - bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; + bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; if (etherealExtorter) { - if (player.ZoneOverworldHeight && ZoneForest) - { - knockback *= 1.15f; - } + if (player.ZoneOverworldHeight && ZoneForest) + { + knockback *= 1.15f; + } } } #endregion - #region Modify Mana Cost + #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { if (item.type == ItemID.SpaceGun && meteorSet) @@ -3482,37 +3562,37 @@ namespace CalamityMod.CalPlayer mult /= 2; } } - #endregion + #endregion #region Melee Effects public override void MeleeEffects(Item item, Rectangle hitbox) { - if (!item.melee && !item.noMelee && (!item.noUseGraphic && (int) player.meleeEnchant > 0)) - { - if ((int) player.meleeEnchant == 7) - { - if (Main.rand.NextBool(20)) - { - int Type = Main.rand.Next(139, 143); - int index = Dust.NewDust(new Vector2((float) hitbox.X, (float) hitbox.Y), hitbox.Width, hitbox.Height, Type, player.velocity.X, player.velocity.Y, 0, new Color(), 1.2f); - Main.dust[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.01); - } - if (Main.rand.NextBool(40)) - { - int Type = Main.rand.Next(276, 283); - int index = Gore.NewGore(new Vector2((float) hitbox.X, (float) hitbox.Y), player.velocity, Type, 1f); - Main.gore[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.01); - Main.gore[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.gore[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; - } - } - } + if (!item.melee && !item.noMelee && (!item.noUseGraphic && (int) player.meleeEnchant > 0)) + { + if ((int) player.meleeEnchant == 7) + { + if (Main.rand.NextBool(20)) + { + int Type = Main.rand.Next(139, 143); + int index = Dust.NewDust(new Vector2(hitbox.X,hitbox.Y), hitbox.Width, hitbox.Height, Type, player.velocity.X, player.velocity.Y, 0, new Color(), 1.2f); + Main.dust[index].velocity.X *= (float) (1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.Y *= (float) (1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].scale *= (float) (1.0 + Main.rand.Next(-30, 31) * 0.01); + } + if (Main.rand.NextBool(40)) + { + int Type = Main.rand.Next(276, 283); + int index = Gore.NewGore(new Vector2(hitbox.X, hitbox.Y), player.velocity, Type, 1f); + Main.gore[index].velocity.X *= (float) (1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].velocity.Y *= (float) (1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].scale *= (float) (1.0 + Main.rand.Next(-20, 21) * 0.01); + Main.gore[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.gore[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + } + } + } bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type) && ItemID.Sets.Yoyo[item.type] != true)); if (isTrueMelee) { @@ -3639,137 +3719,137 @@ namespace CalamityMod.CalPlayer #region On Hit NPC public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) { - if (!item.melee && (int) player.meleeEnchant == 7) + if (!item.melee && (int) player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); if (omegaBlueChestplate) target.AddBuff(ModContent.BuffType(), 240); if (sulfurSet) target.AddBuff(BuffID.Poisoned, 120); - switch (item.type) - { - case ItemID.IceSickle: - case ItemID.Frostbrand: - target.AddBuff(BuffID.Frostburn, 600); - break; + switch (item.type) + { + case ItemID.IceSickle: + case ItemID.Frostbrand: + target.AddBuff(BuffID.Frostburn, 600); + break; - case ItemID.IceBlade: - if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 360); - else if (Main.rand.NextBool(3)) - target.AddBuff(BuffID.Frostburn, 120); - break; - } + case ItemID.IceBlade: + if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 360); + else if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 120); + break; + } - if (item.melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes - { - if (eGauntlet) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.Frostburn, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.Frostburn, 240, false); - } - else - { - target.AddBuff(BuffID.Frostburn, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } + if (item.melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes + { + if (eGauntlet) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.Frostburn, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.Frostburn, 240, false); + } + else + { + target.AddBuff(BuffID.Frostburn, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } if (alchFlask) { if (Main.rand.NextBool(4)) @@ -3836,429 +3916,429 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Midas, 120, false); }*/ } - } + } if (holyWrath) { target.AddBuff(ModContent.BuffType(), 600, false); } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if (vexation) + { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 120, false); target.AddBuff(BuffID.Venom, 120, false); - } - } + } + } } #endregion #region On Hit NPC With Proj public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) { - switch (proj.type) - { - case ProjectileID.BoneArrow: - target.AddBuff(ModContent.BuffType(), 300); - break; + switch (proj.type) + { + case ProjectileID.BoneArrow: + target.AddBuff(ModContent.BuffType(), 300); + break; - case ProjectileID.FrostBlastFriendly: - case ProjectileID.NorthPoleWeapon: - target.AddBuff(BuffID.Frostburn, 600); - break; + case ProjectileID.FrostBlastFriendly: + case ProjectileID.NorthPoleWeapon: + target.AddBuff(BuffID.Frostburn, 600); + break; - case ProjectileID.FrostBoltStaff: - case ProjectileID.IceSickle: - case ProjectileID.FrostBoltSword: - case ProjectileID.FrostArrow: - case ProjectileID.NorthPoleSpear: - target.AddBuff(BuffID.Frostburn, 480); - break; + case ProjectileID.FrostBoltStaff: + case ProjectileID.IceSickle: + case ProjectileID.FrostBoltSword: + case ProjectileID.FrostArrow: + case ProjectileID.NorthPoleSpear: + target.AddBuff(BuffID.Frostburn, 480); + break; - case ProjectileID.Blizzard: - case ProjectileID.NorthPoleSnowflake: - target.AddBuff(BuffID.Frostburn, 240); - break; + case ProjectileID.Blizzard: + case ProjectileID.NorthPoleSnowflake: + target.AddBuff(BuffID.Frostburn, 240); + break; - case ProjectileID.SnowBallFriendly: - if (Main.rand.NextBool(10)) - target.AddBuff(BuffID.Frostburn, 120); - else if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 60); - break; + case ProjectileID.SnowBallFriendly: + if (Main.rand.NextBool(10)) + target.AddBuff(BuffID.Frostburn, 120); + else if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 60); + break; - case ProjectileID.IceBoomerang: - case ProjectileID.IceBolt: - case ProjectileID.FrostDaggerfish: - if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 240); - else if (Main.rand.NextBool(3)) - target.AddBuff(BuffID.Frostburn, 120); - break; - } + case ProjectileID.IceBoomerang: + case ProjectileID.IceBolt: + case ProjectileID.FrostDaggerfish: + if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 240); + else if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 120); + break; + } - if (!proj.npcProj && !proj.trap) - { - if (sulfurSet && proj.friendly && !target.friendly) - target.AddBuff(BuffID.Poisoned, 120); - if (omegaBlueChestplate && proj.friendly && !target.friendly) - target.AddBuff(ModContent.BuffType(), 240); + if (!proj.npcProj && !proj.trap) + { + if (sulfurSet && proj.friendly && !target.friendly) + target.AddBuff(BuffID.Poisoned, 120); + if (omegaBlueChestplate && proj.friendly && !target.friendly) + target.AddBuff(ModContent.BuffType(), 240); - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(ModContent.BuffType(), 20); + if (proj.melee && silvaMelee && Main.rand.NextBool(4)) + target.AddBuff(ModContent.BuffType(), 20); - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) - { - target.AddBuff(ModContent.BuffType(), 360); - } - else if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.Frostburn, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.Frostburn, 240, false); - } - else - { - target.AddBuff(BuffID.Frostburn, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - else if (providenceLore) - { - target.AddBuff(ModContent.BuffType(), 420, false); - } - if (proj.Calamity().rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } - if (etherealExtorter) - { - if (ZoneSunkenSea) - { - target.AddBuff(ModContent.BuffType(), 60, false); - } - if (ZoneSulphur) - { - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 300, false); - } - if (Main.moonPhase == 6) //first quarter - { - target.AddBuff(BuffID.Midas, 120, false); - } - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - } - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } - } + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(ModContent.BuffType(), 360); + } + else if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.Frostburn, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.Frostburn, 240, false); + } + else + { + target.AddBuff(BuffID.Frostburn, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.Calamity().rogue) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(ModContent.BuffType(), 600, false); + } + else if (providenceLore) + { + target.AddBuff(ModContent.BuffType(), 420, false); + } + if (proj.Calamity().rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 4) + { + target.AddBuff(BuffID.Midas, 120, false); + } + } + if (etherealExtorter) + { + if (ZoneSunkenSea) + { + target.AddBuff(ModContent.BuffType(), 60, false); + } + if (ZoneSulphur) + { + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 300, false); + } + if (Main.moonPhase == 6) //first quarter + { + target.AddBuff(BuffID.Midas, 120, false); + } + if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + } + } + if (vexation) + { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + } + } } #endregion #region PvP public override void OnHitPvp(Item item, Player target, int damage, bool crit) { - if (!item.melee && (int) player.meleeEnchant == 7) + if (!item.melee && (int) player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); if (omegaBlueChestplate) target.AddBuff(ModContent.BuffType(), 240); if (sulfurSet) target.AddBuff(BuffID.Poisoned, 120); - switch (item.type) - { - case ItemID.IceSickle: - case ItemID.Frostbrand: - target.AddBuff(BuffID.Frostburn, 600); - break; - } - if (item.type == ItemID.IceBlade) - { - if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 360); - else if (Main.rand.NextBool(3)) - target.AddBuff(BuffID.Frostburn, 120); - } + switch (item.type) + { + case ItemID.IceSickle: + case ItemID.Frostbrand: + target.AddBuff(BuffID.Frostburn, 600); + break; + } + if (item.type == ItemID.IceBlade) + { + if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 360); + else if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 120); + } - if (item.melee) - { - if (eGauntlet) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.Frostburn, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.Frostburn, 240, false); - } - else - { - target.AddBuff(BuffID.Frostburn, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } + if (item.melee) + { + if (eGauntlet) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.Frostburn, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.Frostburn, 240, false); + } + else + { + target.AddBuff(BuffID.Frostburn, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } if (alchFlask) { if (Main.rand.NextBool(4)) @@ -4307,303 +4387,303 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Midas, 120, false); }*/ } - } + } if (holyWrath) { target.AddBuff(ModContent.BuffType(), 600, false); } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if (vexation) + { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 120, false); target.AddBuff(BuffID.Venom, 120, false); - } - } + } + } } public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) { - switch (proj.type) - { - case ProjectileID.BoneArrow: - target.AddBuff(ModContent.BuffType(), 300); - break; + switch (proj.type) + { + case ProjectileID.BoneArrow: + target.AddBuff(ModContent.BuffType(), 300); + break; - case ProjectileID.FrostBlastFriendly: - case ProjectileID.NorthPoleWeapon: - target.AddBuff(BuffID.Frostburn, 600); - break; + case ProjectileID.FrostBlastFriendly: + case ProjectileID.NorthPoleWeapon: + target.AddBuff(BuffID.Frostburn, 600); + break; - case ProjectileID.FrostBoltStaff: - case ProjectileID.IceSickle: - case ProjectileID.FrostBoltSword: - case ProjectileID.FrostArrow: - case ProjectileID.NorthPoleSpear: - target.AddBuff(BuffID.Frostburn, 480); - break; + case ProjectileID.FrostBoltStaff: + case ProjectileID.IceSickle: + case ProjectileID.FrostBoltSword: + case ProjectileID.FrostArrow: + case ProjectileID.NorthPoleSpear: + target.AddBuff(BuffID.Frostburn, 480); + break; - case ProjectileID.Blizzard: - case ProjectileID.NorthPoleSnowflake: - target.AddBuff(BuffID.Frostburn, 240); - break; - } - if (proj.type == ProjectileID.SnowBallFriendly) - { - if (Main.rand.NextBool(10)) - target.AddBuff(BuffID.Frostburn, 120); - else if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 60); - } - else if (proj.type == (ProjectileID.IceBoomerang | ProjectileID.IceBolt | ProjectileID.FrostDaggerfish)) - { - if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Frostburn, 240); - else if (Main.rand.NextBool(3)) - target.AddBuff(BuffID.Frostburn, 120); - } + case ProjectileID.Blizzard: + case ProjectileID.NorthPoleSnowflake: + target.AddBuff(BuffID.Frostburn, 240); + break; + } + if (proj.type == ProjectileID.SnowBallFriendly) + { + if (Main.rand.NextBool(10)) + target.AddBuff(BuffID.Frostburn, 120); + else if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 60); + } + else if (proj.type == (ProjectileID.IceBoomerang | ProjectileID.IceBolt | ProjectileID.FrostDaggerfish)) + { + if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Frostburn, 240); + else if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 120); + } - if (!proj.npcProj && !proj.trap) - { - if (sulfurSet && proj.friendly) - target.AddBuff(BuffID.Poisoned, 120); - if (omegaBlueChestplate && proj.friendly) - target.AddBuff(ModContent.BuffType(), 240); + if (!proj.npcProj && !proj.trap) + { + if (sulfurSet && proj.friendly) + target.AddBuff(BuffID.Poisoned, 120); + if (omegaBlueChestplate && proj.friendly) + target.AddBuff(ModContent.BuffType(), 240); - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(ModContent.BuffType(), 20); + if (proj.melee && silvaMelee && Main.rand.NextBool(4)) + target.AddBuff(ModContent.BuffType(), 20); - if (abyssalAmulet) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) - { - target.AddBuff(ModContent.BuffType(), 360); - } - else if (alchFlask) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 120, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (aWeapon) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.Frostburn, 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.Frostburn, 240, false); - } - else - { - target.AddBuff(BuffID.Frostburn, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(ModContent.BuffType(), 360, false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - else - { - target.AddBuff(ModContent.BuffType(), 120, false); - } - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - else if (providenceLore) - { - target.AddBuff(ModContent.BuffType(), 420, false); - } - if (proj.Calamity().rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - /*if (player.meleeEnchant == 4) + if (abyssalAmulet) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(ModContent.BuffType(), 360); + } + else if (alchFlask) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 120, false); + if (Main.rand.NextBool(5)) + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (aWeapon) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.Frostburn, 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.Frostburn, 240, false); + } + else + { + target.AddBuff(BuffID.Frostburn, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.Calamity().rogue) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(ModContent.BuffType(), 360, false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + else + { + target.AddBuff(ModContent.BuffType(), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(ModContent.BuffType(), 600, false); + } + else if (providenceLore) + { + target.AddBuff(ModContent.BuffType(), 420, false); + } + if (proj.Calamity().rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + /*if (player.meleeEnchant == 4) { target.AddBuff(BuffID.Midas, 120, false); }*/ - } - if (etherealExtorter) - { - if (ZoneSunkenSea) - { - target.AddBuff(ModContent.BuffType(), 60, false); - } - if (ZoneSulphur) - { - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 300, false); - } - if (Main.moonPhase == 6) //first quarter - { - target.AddBuff(BuffID.Midas, 120, false); - } - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - } - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } - if (proj.type == ProjectileID.IchorArrow && player.inventory[player.selectedItem].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.Midas, 300, false); - } - } + } + if (etherealExtorter) + { + if (ZoneSunkenSea) + { + target.AddBuff(ModContent.BuffType(), 60, false); + } + if (ZoneSulphur) + { + target.AddBuff(ModContent.BuffType(), 120, false); + target.AddBuff(ModContent.BuffType(), 300, false); + } + if (Main.moonPhase == 6) //first quarter + { + target.AddBuff(BuffID.Midas, 120, false); + } + if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + target.AddBuff(ModContent.BuffType(), 240, false); + } + } + } + if (vexation) + { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + } + if (proj.type == ProjectileID.IchorArrow && player.inventory[player.selectedItem].type == ModContent.ItemType()) + { + target.AddBuff(BuffID.Midas, 300, false); + } + } } #endregion #region Modify Hit NPC public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) { - bool isTrueMelee = item.melee && item.shoot == 0; + bool isTrueMelee = item.melee && item.shoot == 0; - #region MultiplierBoosts - double damageMult = 1.0; + #region MultiplierBoosts + double damageMult = 1.0; if (silvaMelee && Main.rand.NextBool(4) && item.melee) { damageMult += 4.0; @@ -4656,41 +4736,41 @@ namespace CalamityMod.CalPlayer } #endregion - #region AdditiveBoosts + #region AdditiveBoosts if (item.melee && badgeOfBravery) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 10); - damage += (int)(0.5f * penetratedDefense); - } + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 10); + damage += (int)(0.5f * penetratedDefense); + } } - #endregion + #endregion if (yharonLore) damage = (int)((double)damage * 0.75); if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) { - if (isTrueMelee && soaring) - { - double useTimeMultiplier = 0.85 + ((double)(item.useTime * item.useAnimation) / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = (double)player.wingTimeMax / 20D; - double meleeStatMultiplier = (double)(player.meleeDamage * (float)((double)player.meleeCrit / 10D)); - - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; - } - if (item.melee && !item.noMelee && !item.noUseGraphic) + if (isTrueMelee && soaring) { - if (ataxiaGeyser) + double useTimeMultiplier = 0.85 + ((double)(item.useTime * item.useAnimation) / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost + double wingTimeFraction = (double)player.wingTimeMax / 20D; + double meleeStatMultiplier = (double)(player.meleeDamage * (float)((double)player.meleeCrit / 10D)); + + if (player.wingTime < player.wingTimeMax) + player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + + if (player.wingTime > player.wingTimeMax) + player.wingTime = player.wingTimeMax; + } + if (item.melee && !item.noMelee && !item.noUseGraphic) + { + if (ataxiaGeyser) { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { @@ -4815,27 +4895,27 @@ namespace CalamityMod.CalPlayer crit = Main.rand.Next(1, 101) < throwingCrit; } - if (proj.npcProj || proj.trap) - return; + if (proj.npcProj || proj.trap) + return; bool isTrueMelee = proj.Calamity().trueMelee; - bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); + bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; - Item heldItem = player.inventory[player.selectedItem]; + Item heldItem = player.inventory[player.selectedItem]; - if (isTrueMelee && soaring) - { - double useTimeMultiplier = 0.85 + ((double)(heldItem.useTime * heldItem.useAnimation) / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = (double)player.wingTimeMax / 20D; - double meleeStatMultiplier = (double)(player.meleeDamage * (float)((double)player.meleeCrit / 10D)); + if (isTrueMelee && soaring) + { + double useTimeMultiplier = 0.85 + ((double)(heldItem.useTime * heldItem.useAnimation) / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost + double wingTimeFraction = (double)player.wingTimeMax / 20D; + double meleeStatMultiplier = (double)(player.meleeDamage * (float)((double)player.meleeCrit / 10D)); - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + if (player.wingTime < player.wingTimeMax) + player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; - } + if (player.wingTime > player.wingTimeMax) + player.wingTime = player.wingTimeMax; + } #region MultiplierBoosts double damageMult = 1.0; @@ -4950,36 +5030,36 @@ namespace CalamityMod.CalPlayer } if ((filthyGlove || electricianGlove) && proj.Calamity().stealthStrike && proj.Calamity().rogue) { - if (nanotech) - damageMult += 0.05; - else - damageMult += 0.1; + if (nanotech) + damageMult += 0.05; + else + damageMult += 0.1; } if (etherealExtorter && proj.Calamity().rogue) { - bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; + bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; if (Main.moonPhase == 7 && crit) //Waxing Gibbous - { - damageMult += 0.05; - } - if (Main.moonPhase == 5) //Waxing Cresent - { - if (proj.penetrate == -1) - damageMult += 0.1; - else if (proj.penetrate >= 5) - damageMult += 0.08; - else if (proj.penetrate == 4) - damageMult += 0.06; - else if (proj.penetrate == 3) - damageMult += 0.03; - else if (proj.penetrate == 2) - damageMult += 0.02; - } - if (player.ZoneDirtLayerHeight && ZoneForest) - { - if (Main.rand.NextBool(20) && !crit) //5% chance to minicrit - damageMult += 0.5; - } + { + damageMult += 0.05; + } + if (Main.moonPhase == 5) //Waxing Cresent + { + if (proj.penetrate == -1) + damageMult += 0.1; + else if (proj.penetrate >= 5) + damageMult += 0.08; + else if (proj.penetrate == 4) + damageMult += 0.06; + else if (proj.penetrate == 3) + damageMult += 0.03; + else if (proj.penetrate == 2) + damageMult += 0.02; + } + if (player.ZoneDirtLayerHeight && ZoneForest) + { + if (Main.rand.NextBool(20) && !crit) //5% chance to minicrit + damageMult += 0.5; + } } damage = (int)(damage * damageMult); @@ -5007,56 +5087,57 @@ namespace CalamityMod.CalPlayer } if (proj.Calamity().stealthStrike && proj.Calamity().rogue && nanotech) { - //Ozzatron insists on counting for edge-cases - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 20); //nanotech is weaker - damage += (int)(0.5f * penetratedDefense); + //Ozzatron insists on counting for edge-cases + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 20); //nanotech is weaker + damage += (int)(0.5f * penetratedDefense); } else if (proj.Calamity().stealthStrike && proj.Calamity().rogue && electricianGlove) { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 30); - damage += (int)(0.5f * penetratedDefense); + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 30); + damage += (int)(0.5f * penetratedDefense); } else if (proj.Calamity().stealthStrike && proj.Calamity().rogue && (filthyGlove || bloodyGlove)) { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 10); - damage += (int)(0.5f * penetratedDefense); + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 10); + damage += (int)(0.5f * penetratedDefense); } if (proj.Calamity().rogue && etherealExtorter) { if (CalamityMod.boomerangProjList.Contains(proj.type) && player.ZoneCorrupt) - { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 6); - damage += (int)(0.5f * penetratedDefense); - } + { + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 6); + damage += (int)(0.5f * penetratedDefense); + } } if (proj.melee && badgeOfBravery) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 10); - damage += (int)(0.5f * penetratedDefense); - } + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 10); + damage += (int)(0.5f * penetratedDefense); + } } #endregion #region MultiplicativeReductions // Forbidden and Fearmonger armor makes you immune to the summoner cross-class nerf - bool forbidden = player.head == ArmorIDs.Head.AncientBattleArmor && player.body == ArmorIDs.Body.AncientBattleArmor && player.legs == ArmorIDs.Legs.AncientBattleArmor; - if (isSummon && !fearmongerSet && !forbidden) + // Profaned Soul Crystal encourages use of other weapons, nerfing the damage would not make sense. + bool forbidden = player.head == ArmorIDs.Head.AncientBattleArmor && player.body == ArmorIDs.Body.AncientBattleArmor && player.legs == ArmorIDs.Legs.AncientBattleArmor; + if (isSummon && !fearmongerSet && !forbidden && !profanedCrystalBuffs) { if (heldItem.type > 0) { if (!heldItem.summon && - (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && - heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0) + (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && + heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0) { damage = (int)(damage * 0.75); } @@ -5078,9 +5159,9 @@ namespace CalamityMod.CalPlayer } if (proj.type == ModContent.ProjectileType()) damage = (int)(damage * 0.8); - else if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) - damage = (int)(damage * 0.75); - } + else if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) + damage = (int)(damage * 0.75); + } if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) damage = (int)(damage * 0.7); if (yharonLore) @@ -5128,8 +5209,8 @@ namespace CalamityMod.CalPlayer value15.Normalize(); value15 *= (float)Main.rand.Next(30, 61) * 0.1f; int num17 = Projectile.NewProjectile(proj.oldPosition.X + (float)(proj.width / 2), proj.oldPosition.Y + (float)(proj.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)damage * 0.1), 0f, player.whoAmI, 0f, 0f); - Main.projectile[num17].Calamity().forceRogue = true; - Main.projectile[num17].localNPCHitCooldown = -1; + Main.projectile[num17].Calamity().forceRogue = true; + Main.projectile[num17].localNPCHitCooldown = -1; } } if (astralStarRain && crit && astralStarRainCooldown <= 0) @@ -5355,7 +5436,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && raiderStack < 150 && proj.Calamity().rogue && crit && raiderCooldown <= 0) { raiderStack++; - raiderCooldown = 30; + raiderCooldown = 30; } if (CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage) { @@ -5406,7 +5487,7 @@ namespace CalamityMod.CalPlayer } if (fleshTotem && !fleshTotemCooldown) { - player.AddBuff(ModContent.BuffType(), 1200, false); //20 seconds + player.AddBuff(ModContent.BuffType(), 1200, false); //20 seconds damage /= 2; } if (tarragonCloak && !tarragonCloakCooldown && tarraMelee) @@ -5507,46 +5588,46 @@ namespace CalamityMod.CalPlayer } if (CalamityWorld.revenge) { - double damageMultiplier = 1D; - if (CalamityMod.revengeanceProjectileBuffList25Percent.Contains(proj.type)) - { - damageMultiplier += 0.25; - } - else if (CalamityMod.revengeanceProjectileBuffList20Percent.Contains(proj.type)) - { - damageMultiplier += 0.2; - } - else if (CalamityMod.revengeanceProjectileBuffList15Percent.Contains(proj.type)) - { - damageMultiplier += 0.15; - } - else if (CalamityMod.revengeanceProjectileBuffList10Percent.Contains(proj.type)) - { - damageMultiplier += 0.1; - } - else if (CalamityMod.revengeanceProjectileBuffList5Percent.Contains(proj.type)) - { - damageMultiplier += 0.05; - } + double damageMultiplier = 1D; + if (CalamityMod.revengeanceProjectileBuffList25Percent.Contains(proj.type)) + { + damageMultiplier += 0.25; + } + else if (CalamityMod.revengeanceProjectileBuffList20Percent.Contains(proj.type)) + { + damageMultiplier += 0.2; + } + else if (CalamityMod.revengeanceProjectileBuffList15Percent.Contains(proj.type)) + { + damageMultiplier += 0.15; + } + else if (CalamityMod.revengeanceProjectileBuffList10Percent.Contains(proj.type)) + { + damageMultiplier += 0.1; + } + else if (CalamityMod.revengeanceProjectileBuffList5Percent.Contains(proj.type)) + { + damageMultiplier += 0.05; + } - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; + if (CalamityWorld.death) + damageMultiplier += (damageMultiplier - 1D) * 0.6; - damage = (int)(damage * damageMultiplier); + damage = (int)(damage * damageMultiplier); } - // Reduce damage from vanilla traps - // 350 in normal, 450 in expert - if (proj.type == ProjectileID.Explosives) - damage = (int)((double)damage * (Main.expertMode ? 0.225 : 0.35)); - if (Main.expertMode) - { - // 140 in normal, 182 in expert - if (proj.type == ProjectileID.Boulder) - damage = (int)((double)damage * 0.65); - } + // Reduce damage from vanilla traps + // 350 in normal, 450 in expert + if (proj.type == ProjectileID.Explosives) + damage = (int)((double)damage * (Main.expertMode ? 0.225 : 0.35)); + if (Main.expertMode) + { + // 140 in normal, 182 in expert + if (proj.type == ProjectileID.Boulder) + damage = (int)((double)damage * 0.65); + } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) { @@ -5607,7 +5688,7 @@ namespace CalamityMod.CalPlayer { if (!Main.npc[proj.owner].friendly) Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 120); - } + } else { Player p = Main.player[proj.owner]; @@ -5615,18 +5696,18 @@ namespace CalamityMod.CalPlayer p.AddBuff(BuffID.Poisoned, 120); } } - + if (CalamityWorld.revenge && proj.hostile) { - if (proj.type == ProjectileID.Explosives) - { - player.AddBuff(BuffID.OnFire, 600); - } - else if (proj.type == ProjectileID.Boulder) - { - player.AddBuff(BuffID.BrokenArmor, 600); - } - else if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) + if (proj.type == ProjectileID.Explosives) + { + player.AddBuff(BuffID.OnFire, 600); + } + else if (proj.type == ProjectileID.Boulder) + { + player.AddBuff(BuffID.BrokenArmor, 600); + } + else if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) { player.AddBuff(ModContent.BuffType(), 120); } @@ -5651,7 +5732,7 @@ namespace CalamityMod.CalPlayer else if (proj.type == ProjectileID.CultistBossLightningOrbArc) { player.AddBuff(BuffID.Electrified, (proj.Calamity().lineColor == 1 ? 60 : 120)); - //1 second for DM lightning, 2 seconds for Storm Weaver/Cultist lightning + //1 second for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } } if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) @@ -5722,12 +5803,12 @@ namespace CalamityMod.CalPlayer #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) { - CalamityPlayerFishing.CalamityCatchFish(player, ref fishingRod, ref bait, ref power, ref liquidType, ref poolSize, ref worldLayer, ref questFish, ref caughtType, ref junk); + CalamityPlayerFishing.CalamityCatchFish(player, ref fishingRod, ref bait, ref power, ref liquidType, ref poolSize, ref worldLayer, ref questFish, ref caughtType, ref junk); } public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) { - CalamityPlayerFishing.CalamityGetFishingLevel(player, ref fishingRod, ref bait, ref fishingLevel); + CalamityPlayerFishing.CalamityGetFishingLevel(player, ref fishingRod, ref bait, ref fishingLevel); } #endregion @@ -5805,9 +5886,48 @@ namespace CalamityMod.CalPlayer #endregion #region Frame Effects + public override void FrameEffects() { - if ((snowmanPower || snowmanForce) && !snowmanHide) + if (snowRuffianSet) + { + player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); + bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; + if (player.controlJump && falling) + { + player.velocity.Y *= 0.9f; + player.wingFrame = 3; + } + + } + else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) + { + player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); + player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); + player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); + player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); + + bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + + if (profanedCrystalWingCounter.Value == 0) + { + int key = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); + } + + player.wingFrame = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); + player.armorEffectDrawOutlines = true; + if (profanedCrystalBuffs) + { + player.armorEffectDrawShadow = true; + if (enrage) + { + player.armorEffectDrawOutlinesForbidden = true; + } + } + } + else if ((snowmanPower || snowmanForce) && !snowmanHide) { player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); @@ -5831,6 +5951,13 @@ namespace CalamityMod.CalPlayer player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); } + else + { + if (profanedCrystalWingCounter.Key != 1) + profanedCrystalWingCounter = new KeyValuePair(1, 7); + if (profanedCrystalAnimCounter.Key != 0) + profanedCrystalAnimCounter = new KeyValuePair(0, 10); + } if (CalamityWorld.defiled) Defiled(); @@ -5883,18 +6010,18 @@ namespace CalamityMod.CalPlayer NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } } - if (CalamityWorld.DoGSecondStageCountdown > 0) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - } - KillPlayer(); + if (CalamityWorld.DoGSecondStageCountdown > 0) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + } + KillPlayer(); } } @@ -5906,22 +6033,33 @@ namespace CalamityMod.CalPlayer { return false; } + if (hurtSoundTimer == 0) //hurtsounds + { + if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) + { + playSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ProvidenceHurt"), (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 20; + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + playSound = false; + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise + hurtSoundTimer = 10; + } + 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 + hurtSoundTimer = 10; + } + } - if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - playSound = false; - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise - } - else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) - { - playSound = false; - Main.PlaySound(20, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise - } #region MultiplierBoosts double damageMult = 1.0 + (dArtifact ? 0.25 : 0.0) + - (DoGLore ? 0.1 : 0.0) + + (DoGLore ? 0.1 : 0.0) + ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * (double)player.beetleOrbs) : 0.0) + (enraged ? 0.25 : 0.0) + ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0) + @@ -5929,6 +6067,8 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.revenge) { + if (player.chaosState) + damageMult += 0.25; if (player.ichor) damageMult += 0.25; else if (player.onFire2) @@ -5980,21 +6120,21 @@ namespace CalamityMod.CalPlayer if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) { damage = (int)((double)damage * 0.5); - theBeeCooldown = 600; + theBeeCooldown = 600; } if (CalamityWorld.revenge) { if (!CalamityWorld.downedBossAny) damage = (int)((double)damage * 0.8); - if (CalamityMod.CalamityConfig.AdrenalineAndRage) - { - if (adrenaline == adrenalineMax && !adrenalineMode) - damage = (int)((double)damage * 0.5); - } + if (CalamityMod.CalamityConfig.AdrenalineAndRage) + { + if (adrenaline == adrenalineMax && !adrenalineMode) + damage = (int)((double)damage * 0.5); + } } if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) - && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) { damage = (int)((double)damage * 0.9); } @@ -6036,11 +6176,11 @@ namespace CalamityMod.CalPlayer modStealth = 1f; if (player.whoAmI == Main.myPlayer) { - if (CalamityMod.CalamityConfig.AdrenalineAndRage && CalamityWorld.revenge) - { - if (!adrenalineMode) - adrenaline = 0; - } + if (CalamityMod.CalamityConfig.AdrenalineAndRage && CalamityWorld.revenge) + { + if (!adrenalineMode) + adrenaline = 0; + } if (amidiasBlessing) { player.ClearBuff(ModContent.BuffType()); @@ -6232,12 +6372,12 @@ namespace CalamityMod.CalPlayer #region Post Hurt public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) { - if (pArtifact) + if (!profanedCrystal && pArtifact) { player.AddBuff(ModContent.BuffType(), 300, true); } bool hardMode = Main.hardMode; - int iFramesToAdd = 0; + int iFramesToAdd = 0; if (player.whoAmI == Main.myPlayer) { if (cTracers && damage > 200) @@ -6344,7 +6484,7 @@ namespace CalamityMod.CalPlayer Main.projectile[star].ranged = false; } - /*int num = 1; + /*int num = 1; if (Main.rand.NextBool(3)) ++num; if (Main.rand.NextBool(3)) @@ -6358,8 +6498,8 @@ namespace CalamityMod.CalPlayer Main.projectile[bee].localNPCHitCooldown = 5; }*/ } - if (theBee) - { + if (theBee) + { for (int n = 0; n < 3; n++) { float x = player.position.X + (float)Main.rand.Next(-400, 400); @@ -6378,20 +6518,20 @@ namespace CalamityMod.CalPlayer Main.projectile[star].localNPCHitCooldown = 5; Main.projectile[star].ranged = false; } - int num = 1; - if (Main.rand.NextBool(3)) - ++num; - if (Main.rand.NextBool(3)) - ++num; - if (player.strongBees && Main.rand.NextBool(3)) - ++num; - for (int index = 0; index < num; ++index) - { - int bee = Projectile.NewProjectile(player.position.X, player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); + int num = 1; + if (Main.rand.NextBool(3)) + ++num; + if (Main.rand.NextBool(3)) + ++num; + if (player.strongBees && Main.rand.NextBool(3)) + ++num; + for (int index = 0; index < num; ++index) + { + int bee = Projectile.NewProjectile(player.position.X, player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 5; - } - } + } + } } if (fCarapace) { @@ -6462,7 +6602,7 @@ namespace CalamityMod.CalPlayer { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - for (int i = 0; i< 360; i += 3) + for (int i = 0; i < 360; i += 3) { Vector2 BCDSpeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); Dust.NewDust(player.Center, 1, 1, 244, BCDSpeed.X, BCDSpeed.Y, 0, default, 1.1f); @@ -6610,24 +6750,24 @@ namespace CalamityMod.CalPlayer } } } - if (lastProjectileHit != null) - { - switch (lastProjectileHit.modProjectile.cooldownSlot) - { - case 0: - case 1: - player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; - break; - case -1: - default: - player.immuneTime += iFramesToAdd; - break; - } - } - else - { - player.immuneTime += iFramesToAdd; - } + if (lastProjectileHit != null) + { + switch (lastProjectileHit.modProjectile.cooldownSlot) + { + case 0: + case 1: + player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; + break; + case -1: + default: + player.immuneTime += iFramesToAdd; + break; + } + } + else + { + player.immuneTime += iFramesToAdd; + } } #endregion @@ -6635,7 +6775,7 @@ namespace CalamityMod.CalPlayer public void KillPlayer() { deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { DeathPacket(false); } @@ -6747,11 +6887,11 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(player.name + " was defeated."); } - else if (CalamityWorld.death && deathModeBlizzardTime > 1980) - { - deathModeBlizzardTime = 0; - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was chilled to the bone by the frigid environment."); - } + else if (CalamityWorld.death && deathModeBlizzardTime > 1980) + { + deathModeBlizzardTime = 0; + damageSource = PlayerDeathReason.ByCustomReason(player.name + " was chilled to the bone by the frigid environment."); + } else if (SCalLore) { damageSource = PlayerDeathReason.ByCustomReason(player.Male ? player.name + " was consumed by his inner hatred." : player.name + " was consumed by her inner hatred."); @@ -6764,31 +6904,32 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(player.name + " was destroyed by a mysterious force."); } - NetworkText deathText = damageSource.GetDeathText(player.name); - if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) - { - NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); - } - if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); - } - else if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(deathText.ToString(), 225, 25, 25, false); - } - if (player.whoAmI == Main.myPlayer && player.difficulty == 0) - { - player.DropCoins(); - } - player.DropTombstone(coinsOwned, deathText, 0); + NetworkText deathText = damageSource.GetDeathText(player.name); + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + { + NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); + } + if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); + } + else if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(deathText.ToString(), 225, 25, 25, false); + } + if (player.whoAmI == Main.myPlayer && player.difficulty == 0) + { + player.DropCoins(); + } + player.DropTombstone(coinsOwned, deathText, 0); if (player.whoAmI == Main.myPlayer) { try { WorldGen.saveToonWhilePlaying(); - } catch + } + catch { } } @@ -7162,10 +7303,10 @@ namespace CalamityMod.CalPlayer } else if (dashMod > 0 && !player.mount.Active) { - float dashDistance; + float dashDistance; if (dashMod == 1) //Counter Scarf { - dashDistance = 14.5f; + dashDistance = 14.5f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7227,7 +7368,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 2) //Asgard's Valor { - dashDistance = 16.9f; + dashDistance = 16.9f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7290,7 +7431,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 3) //Elysian Aegis { - dashDistance = 21.9f; + dashDistance = 21.9f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7353,7 +7494,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 4) //Asgardian Aegis { - dashDistance = 23.9f; + dashDistance = 23.9f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7416,7 +7557,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 5) //Deep Diver { - dashDistance = 25.9f; + dashDistance = 25.9f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7479,7 +7620,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 6) //Cryogen Lore { - dashDistance = 15.7f; + dashDistance = 15.7f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7774,6 +7915,7 @@ namespace CalamityMod.CalPlayer #endregion #region Drawing + public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -7831,136 +7973,136 @@ namespace CalamityMod.CalPlayer else effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; } - if ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) - { - // Staff - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); - if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); + if ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) + { + // Staff + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); + if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); - float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; - int num105 = 0; - Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); + float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; + int num105 = 0; + Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); - if (drawPlayer.gravDir == -1f) - { - if (drawPlayer.direction == -1) - { - num104 += 1.57f; - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); - num105 -= Main.itemTexture[item.type].Width; - } - else - { - num104 -= 1.57f; - zero3 = Vector2.Zero; - } - } - else if (drawPlayer.direction == -1) - { - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); - num105 -= Main.itemTexture[item.type].Width; - } + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + num104 += 1.57f; + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); + num105 -= Main.itemTexture[item.type].Width; + } + else + { + num104 -= 1.57f; + zero3 = Vector2.Zero; + } + } + else if (drawPlayer.direction == -1) + { + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); + num105 -= Main.itemTexture[item.type].Width; + } - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105), (float)(int)(vector.Y - Main.screenPosition.Y + 0f)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - num104, - zero3, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)(int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105), (float)(int)(vector.Y - Main.screenPosition.Y + 0f)), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + num104, + zero3, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } + Main.playerDrawData.Add(data); + } - // Bow and Book - else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType()) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); - int offsetX = 10; - if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); - offsetX = 6; - } - else if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); - offsetX = 37; - } - else if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); - offsetX = 9; - } + // Bow and Book + else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || + item.type == ModContent.ItemType()) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); + int offsetX = 10; + if (item.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); + offsetX = 6; + } + else if (item.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); + offsetX = 37; + } + else if (item.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); + offsetX = 9; + } - Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); - Vector2 vector14 = vector13; - int num107 = (int)vector14.X - offsetX; - vector13.Y = vector14.Y; + Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); + Vector2 vector14 = vector13; + int num107 = (int)vector14.X - offsetX; + vector13.Y = vector14.Y; - Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); - if (drawPlayer.direction == -1) - origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); + Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); + if (drawPlayer.direction == -1) + origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X + vector13.X), (float)(int)(vector.Y - Main.screenPosition.Y + vector13.Y)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - origin4, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)(int)(vector.X - Main.screenPosition.X + vector13.X), (float)(int)(vector.Y - Main.screenPosition.Y + vector13.Y)), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + origin4, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } + Main.playerDrawData.Add(data); + } - // Sword - else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); - if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); + // Sword + else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || + item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); + if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); - float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; + float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X), (float)(int)(vector.Y - Main.screenPosition.Y)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, yOffset) + Vector2.Zero, - item.scale, - effect, - 0); + DrawData data = new DrawData(texture, + new Vector2((float)(int)(vector.X - Main.screenPosition.X), (float)(int)(vector.Y - Main.screenPosition.Y)), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, yOffset) + Vector2.Zero, + item.scale, + effect, + 0); - Main.playerDrawData.Add(data); - } - } + Main.playerDrawData.Add(data); + } + } } }); - public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) - { + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) + { if (drawInfo.shadow != 0f) return; @@ -7973,55 +8115,55 @@ namespace CalamityMod.CalPlayer !item.noUseGraphic && (!drawPlayer.wet || !item.noWet)) { - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - { - Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); - SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + { + Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); + SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_FlurrystormCannon"); - if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BlightSpewer"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BrimstoneFlameblaster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HavocsBreath"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_SparkSpreader"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HalleysInferno"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_CleansingBlaze"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_ElementalEruption"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TheEmpyrean"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Meowthrower"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_OverloadedBlaster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TerraFlameburster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Photoviscerator"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"); + Texture2D thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_FlurrystormCannon"); + if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BlightSpewer"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BrimstoneFlameblaster"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HavocsBreath"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_SparkSpreader"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HalleysInferno"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_CleansingBlaze"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_ElementalEruption"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TheEmpyrean"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Meowthrower"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_OverloadedBlaster"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TerraFlameburster"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Photoviscerator"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"); - float num25 = -4f; - float num24 = -8f; - DrawData howDoIDrawThings = new DrawData(thingToDraw, - new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), - new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), - color89, - drawPlayer.bodyRotation, - new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), - 1f, - spriteEffects, - 0); - howDoIDrawThings.shader = 0; - Main.playerDrawData.Add(howDoIDrawThings); - } - } - } + float num25 = -4f; + float num24 = -8f; + DrawData howDoIDrawThings = new DrawData(thingToDraw, + new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), + new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), + color89, + drawPlayer.bodyRotation, + new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), + 1f, + spriteEffects, + 0); + howDoIDrawThings.shader = 0; + Main.playerDrawData.Add(howDoIDrawThings); + } + } + } public override void ModifyDrawLayers(List list) { @@ -8085,10 +8227,10 @@ namespace CalamityMod.CalPlayer Texture2D heart4 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart4"); Texture2D heart5 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart5"); Texture2D heart6 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart6"); - Texture2D heartOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal"); //Life fruit - Texture2D heartOriginal2 = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal2"); //Life crystal + Texture2D heartOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal"); //Life fruit + Texture2D heartOriginal2 = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal2"); //Life crystal - int totalFruit = + int totalFruit = (mFruit ? 1 : 0) + (bOrange ? 1 : 0) + (eBerry ? 1 : 0) + @@ -8097,7 +8239,7 @@ namespace CalamityMod.CalPlayer switch (totalFruit) { default: - Main.heart2Texture = heartOriginal; + Main.heart2Texture = heartOriginal; break; case 4: Main.heart2Texture = heart6; @@ -8394,27 +8536,27 @@ namespace CalamityMod.CalPlayer } if (vaporfied) { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 242, - 229, - 226, - 247, - 187, - 234 - }); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 242, + 229, + 226, + 247, + 187, + 234 + }); if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, dustType, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } Main.playerDrawDust.Add(dust); } if (noRogueStealth) @@ -8499,21 +8641,21 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - } - #endregion + } + #endregion - #region Nurse Modifications - public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) - { - if (CalamityWorld.death && areThereAnyDamnBosses) - { - chatText = "Now is not the time!"; - return false; - } - return true; - } + #region Nurse Modifications + public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) + { + if (CalamityWorld.death && areThereAnyDamnBosses) + { + chatText = "Now is not the time!"; + return false; + } + return true; + } - public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) + public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) { // In Rev+, nurse costs scale as the game progresses. // Base: 300 3 silver @@ -8579,7 +8721,7 @@ namespace CalamityMod.CalPlayer #region Rogue Stealth private void ResetRogueStealth() { - // rogueStealth doesn't reset every frame because it's a continuously building resource + // rogueStealth doesn't reset every frame because it's a continuously building resource // these other parameters are rebuilt every frame based on the items you have equipped rogueStealthMax = 0f; @@ -8629,6 +8771,7 @@ namespace CalamityMod.CalPlayer // If the player is using an item that deals damage and is on their first frame of doing so, // consume stealth if a stealth strike wasn't triggered manually by item code. + // This doesn't trigger stealth strike effects (ConsumeStealthStrike instead of StealthStrike) // so non-rogue weapons can't call lasers down from the sky and such. // Using any item which deals no damage or is a tool doesn't consume stealth. @@ -8688,8 +8831,8 @@ namespace CalamityMod.CalPlayer stealthGenMoving += 0.08f; } - if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent - stealthGenStandstill += 0.15f; + if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent + stealthGenStandstill += 0.15f; // // Other code which affects stealth generation goes here. @@ -8867,33 +9010,33 @@ namespace CalamityMod.CalPlayer packet.Send(-1, player.whoAmI); } - public void DeathModeUnderworldTimePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync); - packet.Write(player.whoAmI); - packet.Write(deathModeUnderworldTime); + public void DeathModeUnderworldTimePacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync); + packet.Write(player.whoAmI); + packet.Write(deathModeUnderworldTime); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - public void DeathModeBlizzardTimePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync); - packet.Write(player.whoAmI); - packet.Write(deathModeBlizzardTime); + public void DeathModeBlizzardTimePacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync); + packet.Write(player.whoAmI); + packet.Write(deathModeBlizzardTime); - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } + if (!server) + packet.Send(); + else + packet.Send(-1, player.whoAmI); + } - internal void HandleExactLevels(BinaryReader reader, int levelType) + internal void HandleExactLevels(BinaryReader reader, int levelType) { switch (levelType) { @@ -8964,21 +9107,21 @@ namespace CalamityMod.CalPlayer DeathPacket(true); } - internal void HandleDeathModeUnderworldTime(BinaryReader reader) - { - deathModeUnderworldTime = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathModeUnderworldTimePacket(true); - } + internal void HandleDeathModeUnderworldTime(BinaryReader reader) + { + deathModeUnderworldTime = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + DeathModeUnderworldTimePacket(true); + } - internal void HandleDeathModeBlizzardTime(BinaryReader reader) - { - deathModeBlizzardTime = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathModeBlizzardTimePacket(true); - } + internal void HandleDeathModeBlizzardTime(BinaryReader reader) + { + deathModeBlizzardTime = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + DeathModeBlizzardTimePacket(true); + } - public override void OnEnterWorld(Player player) + public override void OnEnterWorld(Player player) { if (Main.netMode == NetmodeID.MultiplayerClient) { @@ -8995,9 +9138,9 @@ namespace CalamityMod.CalPlayer StressPacket(false); AdrenalinePacket(false); DeathPacket(false); - DeathModeUnderworldTimePacket(false); - DeathModeBlizzardTimePacket(false); - } + DeathModeUnderworldTimePacket(false); + DeathModeBlizzardTimePacket(false); + } } #endregion @@ -9289,14 +9432,14 @@ namespace CalamityMod.CalPlayer if (final) { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + 0, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[prof].ranged = false; } else { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9315,13 +9458,13 @@ namespace CalamityMod.CalPlayer { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } else { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9340,13 +9483,13 @@ namespace CalamityMod.CalPlayer { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } else { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9365,13 +9508,13 @@ namespace CalamityMod.CalPlayer { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } else { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9390,13 +9533,13 @@ namespace CalamityMod.CalPlayer { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } else { int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + Main.projectile[prof].ranged = false; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9876,6 +10019,98 @@ namespace CalamityMod.CalPlayer } #endregion + #region Profaned Soul Crystal Stuffs + + internal void rollBabSpears(int randAmt) + { + if (player.whoAmI == Main.myPlayer && randAmt > 0 && !endoCooper && !magicHat && Main.rand.NextBool(randAmt)) //disallow other dev summons due to damage being bonkers + { + int spearsFired = 0; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (spearsFired == 2) + break; + if (Main.projectile[i].friendly && Main.projectile[i].owner == player.whoAmI) + { + bool attack = Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI; + if (attack || (Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI)) + { + int numSpears = attack ? 12 : 6; + int dam = Main.projectile[i].damage; + if (!attack) + dam = (int)((float)dam * 0.5f); + float angleVariance = MathHelper.TwoPi / (float)numSpears; + float spinOffsetAngle = MathHelper.Pi / (2f * numSpears); + Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); + for (int x = 0; x < numSpears; x++) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity.Normalize(); + velocity *= 8f; + Projectile.NewProjectile(Main.projectile[i].Center + posVec, velocity, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f, 0f); + } + spearsFired++; + } + } + } + } + } + + private bool IsValidTransitionFrame(AnimationType currentAnim, AnimationType newAnim, int frame, int counter) //this exists so it doesn't loop through the entire walk/idle anim just to find one frame for switching. + { + bool result = newAnim != AnimationType.Jump && currentAnim != AnimationType.Jump; + if (currentAnim == AnimationType.Walk && newAnim == AnimationType.Idle) + { + result = counter <= 0 && (frame == 11 || frame == 15 || frame == 19); + } + else if (currentAnim == AnimationType.Idle && newAnim == AnimationType.Walk) + { + result = counter <= 0 && (frame == 2 || frame == 6); + } + return currentAnim != newAnim && result; //swapping to jumps should be instant, no need to check the counter here + } + + private int HandlePSCAnimationFrames(AnimationType newType) + { + int key = profanedCrystalAnimCounter.Key; //0-based indexing + int value = profanedCrystalAnimCounter.Value - 1; + AnimationType currentType = key < 8 ? AnimationType.Idle : key == 8 ? AnimationType.Jump : AnimationType.Walk; + + bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother + AnimationType type = isInvalidTransFrame ? newType : currentType; + int frameCount = type == AnimationType.Walk || (!profanedCrystalForce && player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) ? 7 : 10; + int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9; + int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22; + if (value <= 0 || !isInvalidTransFrame) + { + value = frameCount; + if (key >= lowerRange && key < upperRange) + key++; + else + key = lowerRange; + } + profanedCrystalAnimCounter = new KeyValuePair(key, value); + return profanedCrystalAnimCounter.Key; + } + + public override void PostUpdate() //needs to be here else it doesn't work properly, otherwise i'd have stuck it with the wing anim stuffs + { + if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide && player.legs == mod.GetEquipSlot("ProviLegs", EquipType.Legs)) + { + bool usingCarpet = player.carpetTime > 0 && player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground + AnimationType animType = AnimationType.Walk; + if ((player.sliding || (player.velocity.Y != 0 || player.controlJump) || player.mount.Active || player.grappling[0] != -1 || player.GoingDownWithGrapple) && !usingCarpet) + animType = AnimationType.Jump; + else if (player.velocity.X == 0 || usingCarpet) + animType = AnimationType.Idle; + int frame = HandlePSCAnimationFrames(animType); + player.legFrame.Y = player.legFrame.Height * frame; + } + } + + #endregion + #region Misc Stuff /// @@ -9898,6 +10133,7 @@ namespace CalamityMod.CalPlayer return range; } + /// /// Calculates and returns the player's total light strength. This is used for Abyss darkness, among other things.
/// The Stat Meter also reports this stat. @@ -9907,7 +10143,7 @@ namespace CalamityMod.CalPlayer { int light = externalAbyssLight; bool underwater = player.IsUnderwater(); - bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet; + bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet; // The campfire bonus does not apply while in the Abyss. if (!ZoneAbyss && (player.HasBuff(BuffID.Campfire) || Main.campfire)) @@ -9926,6 +10162,8 @@ namespace CalamityMod.CalPlayer light += 1; if (radiator) light += 1; + if (sparks) + light += 1; if (sirenBoobs || sirenBoobsAlt) light += 1; if (aAmpoule) // sponge inherits this and doesn't stack with ampoule @@ -9960,8 +10198,11 @@ namespace CalamityMod.CalPlayer light += 3; if (player.suspiciouslookingTentacle) light += 3; + if (profanedCrystalBuffs && !ZoneAbyss) + light += Main.dayTime || player.lavaWet ? 2 : 1; return light; } + #endregion } } diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index c35c008573..31cd3de1ec 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -555,7 +555,7 @@ namespace CalamityMod.CalPlayer } } } - else if (player.cratePotion && Main.rand.NextBool(5)) // 20% + if (player.cratePotion && Main.rand.NextBool(5)) // 20% { caughtType = ModContent.ItemType(); } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index db47c8ac9c..33ce2b9be2 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -128,7 +128,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - lifeRegenLost += 30; + lifeRegenLost += modPlayer.profanedCrystalBuffs ? 35 : 30; } if (modPlayer.astralInfection) @@ -551,7 +551,10 @@ namespace CalamityMod.CalPlayer if (modPlayer.sRegen) player.lifeRegen += 2; - if (modPlayer.affliction || modPlayer.afflicted) + if (modPlayer.hallowedRegen) + player.lifeRegen += 3; + + if (modPlayer.affliction || modPlayer.afflicted) player.lifeRegen += 1; if (modPlayer.absorber) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 98c0e334aa..e89292b151 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -17,6 +17,7 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -35,10 +36,10 @@ using Terraria.ModLoader; namespace CalamityMod.CalPlayer { public class CalamityPlayerMiscEffects - { - #region Post Update Misc Effects - public static void CalamityPostUpdateMiscEffects(Player player, Mod mod) - { + { + #region Post Update Misc Effects + public static void CalamityPostUpdateMiscEffects(Player player, Mod mod) + { CalamityPlayer modPlayer = player.Calamity(); // No category @@ -397,15 +398,31 @@ namespace CalamityMod.CalPlayer player.breath--; } } - - //extra DoT in the lava of the crags - if (modPlayer.ZoneCalamity && player.lavaWet) - { - player.AddBuff(ModContent.BuffType(), 2, false); - } - // Death Mode effects - modPlayer.caveDarkness = 0f; + //extra DoT in the lava of the crags + if (modPlayer.ZoneCalamity && player.lavaWet) + { + player.AddBuff(ModContent.BuffType(), 2, false); + } + + // Acid rain droplets + if (player.whoAmI == Main.myPlayer) + { + if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur && !CalamityPlayer.areThereAnyDamnBosses) + { + int acidRainDropRate = (int)MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50); + Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); + + if (player.miscCounter % acidRainDropRate == 0f && Main.rand.NextBool(2)) + { + Projectile.NewProjectile(spawnPoint, Vector2.UnitY * Main.rand.NextFloat(7f, 11f), + ModContent.ProjectileType(), 28, 0f); + } + } + } + + // Death Mode effects + modPlayer.caveDarkness = 0f; if (CalamityWorld.death) { if (player.whoAmI == Main.myPlayer) @@ -457,7 +474,7 @@ namespace CalamityMod.CalPlayer bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves; bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier || - modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction; + modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs; bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity; @@ -582,7 +599,9 @@ namespace CalamityMod.CalPlayer } int randomFrequency2 = (int)(20f * frequencyMult); - if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) + if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur) + randomFrequency2 = (int)(randomFrequency2 * 3.75); + if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) { if (!tileSafely.active()) { @@ -764,23 +783,27 @@ namespace CalamityMod.CalPlayer player.allDamage += damageUp; modPlayer.AllCritBoost(critUp); } - + bool canProvideBuffs = player.Calamity().profanedCrystalBuffs || (!modPlayer.profanedCrystal && modPlayer.pArtifact) || (player.Calamity().profanedCrystal && CalamityWorld.downedSCal); + bool attack = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out - if (!modPlayer.bOut) + if (!modPlayer.bOut && canProvideBuffs) { - if (modPlayer.gHealer) + bool healer = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + bool defend = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + if (healer) { if (modPlayer.healCounter > 0) modPlayer.healCounter--; if (modPlayer.healCounter <= 0) { - modPlayer.healCounter = 300; + bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + modPlayer.healCounter = (!enrage && player.Calamity().profanedCrystalBuffs) ? 360 : 300; if (player.whoAmI == Main.myPlayer) { int healAmount = 5 + - (modPlayer.gDefense ? 5 : 0) + - (modPlayer.gOffense ? 5 : 0); + (defend ? 5 : 0) + + (attack ? 5 : 0); player.statLife += healAmount; player.HealEffect(healAmount); @@ -788,23 +811,23 @@ namespace CalamityMod.CalPlayer } } - if (modPlayer.gDefense) + if (defend) { player.moveSpeed += 0.1f + - (modPlayer.gOffense ? 0.1f : 0f); + (attack ? 0.1f : 0f); player.endurance += 0.025f + - (modPlayer.gOffense ? 0.025f : 0f); + (attack ? 0.025f : 0f); } - if (modPlayer.gOffense) + if (attack) { player.minionDamage += 0.1f + - (modPlayer.gDefense ? 0.05f : 0f); + (defend ? 0.05f : 0f); } } // You always get the max minions, even during the effect of the burnout debuff - if (modPlayer.gOffense) + if (attack && canProvideBuffs) player.maxMinions++; // Cooldowns and timers @@ -828,8 +851,8 @@ namespace CalamityMod.CalPlayer modPlayer.featherCrownCooldown--; if (modPlayer.moonCrownCooldown > 0) modPlayer.moonCrownCooldown--; - if (modPlayer.nanoFlareCooldown > 0) - modPlayer.nanoFlareCooldown--; + if (modPlayer.nanoFlareCooldown > 0) + modPlayer.nanoFlareCooldown--; if (modPlayer.spectralVeilImmunity > 0) modPlayer.spectralVeilImmunity--; if (modPlayer.plaguedFuelPackCooldown > 0) @@ -860,6 +883,8 @@ namespace CalamityMod.CalPlayer modPlayer.gaelRageCooldown--; if (modPlayer.projRefRareLifeRegenCounter > 0) modPlayer.projRefRareLifeRegenCounter--; + if (modPlayer.hurtSoundTimer > 0) + modPlayer.hurtSoundTimer--; // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) @@ -1635,17 +1660,17 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); } } - if (modPlayer.gSabatonCooldown == 1) //dust when ready to use again - { - for (int i = 0; i < 66; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0, 0, 100, default, 2.6f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity *= 6.6f; - } - } + if (modPlayer.gSabatonCooldown == 1) //dust when ready to use again + { + for (int i = 0; i < 66; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0, 0, 100, default, 2.6f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity *= 6.6f; + } + } } } #endregion @@ -3140,7 +3165,7 @@ namespace CalamityMod.CalPlayer player.npcTypeNoAggro[ModContent.NPCType()] = true; } - /*if (modPlayer.dukeScales) + if (modPlayer.dukeScales) { player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.Poisoned] = true; @@ -3160,7 +3185,7 @@ namespace CalamityMod.CalPlayer player.allDamage += 0.1f; modPlayer.AllCritBoost(5); } - }*/ + } if (modPlayer.auricSet && modPlayer.silvaMelee) { @@ -3193,35 +3218,83 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(232f * (player.allDamage + player.minionDamage - 1f)), 2f, Main.myPlayer, 0f, 0f); } } - if (modPlayer.pArtifact) { if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1 && !player.Calamity().profanedCrystalBuffs) player.AddBuff(ModContent.BuffType(), 3600, true); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - float baseDamage = 100f + + float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : 100f + (CalamityWorld.downedDoG ? 100f : 0f) + - (CalamityWorld.downedYharon ? 100f : 0f); + (CalamityWorld.downedYharon ? 100f : 0f) + + (modPlayer.profanedCrystalBuffs ? 700f : 0f); - if (player.Calamity().minionSlotStat >= 10) + if (modPlayer.profanedCrystal || player.Calamity().minionSlotStat >= 10) { player.Calamity().gDefense = true; if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), (int)(baseDamage * (player.allDamage + player.minionDamage - 1f)), 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), baseDamage == 0 ? 0 : (int)(baseDamage * (player.allDamage + player.minionDamage - 1f)), 1f, Main.myPlayer, 0f, 0f); } - if (modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet) + if (modPlayer.profanedCrystal || (modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet)) { player.Calamity().gOffense = true; if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(baseDamage * (player.allDamage + player.minionDamage - 1f)), 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), baseDamage == 0 ? 0 : (int)(baseDamage * (player.allDamage + player.minionDamage - 1f)), 1f, Main.myPlayer, 0f, 0f); + } + } + } + if (modPlayer.profanedCrystalBuffs && modPlayer.gOffense && modPlayer.gDefense) + { + if (player.whoAmI == Main.myPlayer) + { + player.scope = false; //this is so it doesn't mess with the balance of ranged transform attacks over the others + player.lavaImmune = true; + player.lavaMax += 420; + player.lavaRose = true; + player.fireWalk = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Burning] = true; + player.buffImmune[BuffID.Daybreak] = true; + bool offenseBuffs = (Main.dayTime && !player.wet) || player.lavaWet; + if (offenseBuffs) + { + player.minionDamage += 0.15f; + player.minionKB += 0.15f; + player.moveSpeed += 0.25f; + player.statDefense -= 15; + if (!player.Calamity().yharonLore) + player.wingTimeMax = (int)((float)player.wingTimeMax * 1.1f); + player.ignoreWater = true; + } + else + { + player.moveSpeed -= 0.15f; + player.endurance += 0.05f; + player.statDefense += 15; + player.lifeRegen += 5; + } + bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + bool notRetro = Lighting.NotRetro; + if (!modPlayer.ZoneAbyss) //No abyss memes. + Lighting.AddLight(player.Center, enrage ? 60 : offenseBuffs ? 50 : 10, enrage ? 12 : offenseBuffs ? 10 : 2, 0); + if (enrage) + { + bool special = player.name == "Amber" || player.name == "Nincity" || player.name == "IbanPlay" || player.name == "Chen"; //People who either helped create the item or test it. + for (int i = 0; i < 3; i++) + { + int num469 = Dust.NewDust(player.position, player.width, player.height, special ? 231 : 244, 0f, 0f, 100, special ? Color.DarkRed : default, 1f); + Main.dust[num469].scale = special ? 1.169f : 2f; + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= special ? 10f : 6.9f; + } } } } @@ -3253,10 +3326,10 @@ namespace CalamityMod.CalPlayer } } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) - { + { if (player.whoAmI == Main.myPlayer) { - for (int i = 0; i < 1000; i++) + for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) { diff --git a/CalamityMod.cs b/CalamityMod.cs index 5efd145042..422fb90619 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2,11 +2,13 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.ILEditing; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Armor; using CalamityMod.Items.Fishing.AstralCatches; -using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Tools; @@ -48,9 +50,8 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; using CalamityMod.Skies; @@ -75,22 +76,18 @@ using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Graphics; using System; using System.Collections.Generic; using System.IO; using System.Reflection; using Terraria; using Terraria.DataStructures; -using Terraria.GameContent.Events; -using Terraria.Graphics; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Config; using Terraria.UI; -using Terraria.UI.Chat; namespace CalamityMod { @@ -200,7 +197,9 @@ namespace CalamityMod public static List hornetList; public static List mossHornetList; - private Mod thorium = null; + // TODO -- Calamity should check for other mods existing in exactly one place + internal Mod thorium = null; + public bool fargosMutant = false; internal static Configs CalamityConfig; internal static CalamityMod instance; @@ -232,6 +231,8 @@ namespace CalamityMod LoadClient(); } + ILChanges.Initialize(); + thorium = ModLoader.GetMod("ThoriumMod"); BossHealthBarManager.Load(this); @@ -264,6 +265,13 @@ namespace CalamityMod AddEquipTexture(new PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Accessories/Vanity/Popo_Body", "CalamityMod/Items/Accessories/Vanity/Popo_Arms"); AddEquipTexture(new PopoLegs(), null, EquipType.Legs, "PopoLeg", "CalamityMod/Items/Accessories/Vanity/Popo_Legs"); + AddEquipTexture(new ProfanedCrystalHead(), null, EquipType.Head, "ProviHead", "CalamityMod/Items/Accessories/ProfanedSoulTransHead"); + AddEquipTexture(new ProfanedCrystalBody(), null, EquipType.Body, "ProviBody", "CalamityMod/Items/Accessories/ProfanedSoulTransBody", "CalamityMod/Items/Accessories/ProfanedSoulTransArms"); + AddEquipTexture(new ProfanedCrystalLegs(), null, EquipType.Legs, "ProviLegs", "CalamityMod/Items/Accessories/ProfanedSoulTransLegs"); + AddEquipTexture(new ProfanedCrystalWings(), null, EquipType.Wings, "ProviWings", "CalamityMod/Items/Accessories/Wings/ProfanedSoulTransWings"); + + AddEquipTexture(new SnowRuffianWings(), null, EquipType.Wings, "SnowRuffWings", "CalamityMod/Items/Armor/SnowRuffianWings"); + AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); @@ -395,6 +403,7 @@ namespace CalamityMod mossHornetList = null; thorium = null; + fargosMutant = false; CalamityConfig = null; instance = null; diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs new file mode 100644 index 0000000000..0453bd8376 --- /dev/null +++ b/Events/AcidRainEvent.cs @@ -0,0 +1,157 @@ +using CalamityMod.ILEditing; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using System.Linq; +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Localization; + +namespace CalamityMod.Events +{ + public class AcidRainEvent + { + // Make sure this does not interfere with any vanilla values. An obscure and random number is used just in case + // Any other mods are changing the invasion ID as well. + public const int InvasionID = 57; + + // A partially bright pale-ish cyan with a hint of yellow. + public static readonly Color TextColor = new Color(115, 194, 147); + + // Not readonly so that if anyone else wants to add stuff in here with their own mod, they can. + // The first value is the NPC type, the second is the value they're worth in the event + public static List<(int, int)> PossibleEnemies = new List<(int, int)>() + { + ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ) + }; + + // Temporary variable. Remove when Old Duke is added. + internal const bool OldDukeExists = false; + + /// + /// Broadcasts some text from a given localization key. + /// + /// The key to write + public static void BroadcastEventText(string localizationKey) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(localizationKey), TextColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(localizationKey), TextColor); + } + } + /// + /// Checks if the player's screen is in the view of the invasion, based on . + /// + /// The area to check based on the screen. + /// The ID for the icon. For more info on how this works, check .. + /// + public static bool NearInvasionCheck(int rectangleCheckSize, ref int iconID) + { + Rectangle screen = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active) + { + iconID = InvasionID; + int type = Main.npc[i].type; + for (int j = 0; j < PossibleEnemies.Count; j++) + { + if (PossibleEnemies.Select(enemy => enemy.Item2).Contains(type)) + { + Rectangle invasionCheckArea = new Rectangle((int)Main.npc[i].Center.X - rectangleCheckSize / 2, (int)Main.npc[i].Center.Y - rectangleCheckSize / 2, + rectangleCheckSize, rectangleCheckSize); + if (screen.Intersects(invasionCheckArea)) + { + Main.invasionProgressDisplayLeft = 480; + return true; + } + } + } + } + } + return false; + } + /// + /// Attempts to start the Acid Rain event. Will fail if there is another invasion going on. + /// + public static void TryStartEvent() + { + if (CalamityWorld.rainingAcid) + return; + int playerCount = 0; + for (int i = 0; i < Main.player.Length; i++) + { + if (Main.player[i].active) + { + playerCount++; + } + } + if (playerCount > 0) + { + // So that vanilla doesn't shit itself + Main.invasionType = -1; + + CalamityWorld.rainingAcid = true; + // The E - 1 part is to ensure that we start at 1 as a multiple instead of 0 + // At a maximum of 255 players, the max multiplier is 9.98, or 998 enemies that need to be killed. + Main.invasionSize = Main.invasionSizeStart = (int)(180 * Math.Log(playerCount + Math.E - 1)); + Main.invasionProgress = 0; + Main.invasionProgressIcon = 3; + Main.invasionProgressWave = 0; + + // Make it rain normally + Main.raining = true; + + // If abyssSide is true, then the abyss was generated on the left side of the world. + // If false, the right. + Main.invasionX = CalamityWorld.abyssSide ? 0 : Main.maxTilesX; + } + BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! + } + /// + /// Updates the invasion, checking to see if it has ended. + /// + public static void UpdateInvasion() + { + // If the custom invasion is up + if (CalamityWorld.rainingAcid) + { + foreach (Player p in Main.player) + { + NetMessage.SendData(MessageID.InvasionProgressReport, p.whoAmI, -1, null, Main.invasionSizeStart - Main.invasionSize, (float)Main.invasionSizeStart, (float)(Main.invasionType + 3), 0f, 0, 0, 0); + } + // End invasion if we've defeated all the enemies, including Old Duke + if (Main.invasionSize <= 0) + { + CalamityWorld.rainingAcid = false; + BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulfuric skies begin to clear... + Main.invasionType = 0; + Main.invasionDelay = 0; + Main.invasionProgressNearInvasion = false; + Main.invasionProgressDisplayLeft = 0; + + // Turn off the rain from the event + Main.numCloudsTemp = Main.rand.Next(5, 20 + 1); + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = Main.rand.NextFloat(0.04f, 0.25f); + Main.windSpeedSet = Main.windSpeedTemp; + Main.raining = false; + } + } + } + } +} diff --git a/ExtraTextures/UI/AcidRainIcon.png b/ExtraTextures/UI/AcidRainIcon.png new file mode 100644 index 0000000000..3962778a2e Binary files /dev/null and b/ExtraTextures/UI/AcidRainIcon.png differ diff --git a/Gores/AcidRain/AcidEelGore.png b/Gores/AcidRain/AcidEelGore.png new file mode 100644 index 0000000000..c7a2621d82 Binary files /dev/null and b/Gores/AcidRain/AcidEelGore.png differ diff --git a/Gores/AcidRain/AcidEelGore2.png b/Gores/AcidRain/AcidEelGore2.png new file mode 100644 index 0000000000..4b6081fd44 Binary files /dev/null and b/Gores/AcidRain/AcidEelGore2.png differ diff --git a/Gores/AcidRain/AcidEelGore3.png b/Gores/AcidRain/AcidEelGore3.png new file mode 100644 index 0000000000..6731655517 Binary files /dev/null and b/Gores/AcidRain/AcidEelGore3.png differ diff --git a/Gores/AcidRain/NuclearToadGore1.png b/Gores/AcidRain/NuclearToadGore1.png new file mode 100644 index 0000000000..e7a328664f Binary files /dev/null and b/Gores/AcidRain/NuclearToadGore1.png differ diff --git a/Gores/AcidRain/NuclearToadGore2.png b/Gores/AcidRain/NuclearToadGore2.png new file mode 100644 index 0000000000..3d508ecf72 Binary files /dev/null and b/Gores/AcidRain/NuclearToadGore2.png differ diff --git a/Gores/AcidRain/NuclearToadGore3.png b/Gores/AcidRain/NuclearToadGore3.png new file mode 100644 index 0000000000..e9abc48dad Binary files /dev/null and b/Gores/AcidRain/NuclearToadGore3.png differ diff --git a/Gores/AcidRain/NuclearToadGore4.png b/Gores/AcidRain/NuclearToadGore4.png new file mode 100644 index 0000000000..2051a0220a Binary files /dev/null and b/Gores/AcidRain/NuclearToadGore4.png differ diff --git a/Gores/AcidRain/Orthocera.png b/Gores/AcidRain/Orthocera.png new file mode 100644 index 0000000000..5d2b67eb29 Binary files /dev/null and b/Gores/AcidRain/Orthocera.png differ diff --git a/Gores/AcidRain/Orthocera2.png b/Gores/AcidRain/Orthocera2.png new file mode 100644 index 0000000000..53bb75e1bc Binary files /dev/null and b/Gores/AcidRain/Orthocera2.png differ diff --git a/Gores/AcidRain/OrthoceraGore.png b/Gores/AcidRain/OrthoceraGore.png new file mode 100644 index 0000000000..5d2b67eb29 Binary files /dev/null and b/Gores/AcidRain/OrthoceraGore.png differ diff --git a/Gores/AcidRain/OrthoceraGore2.png b/Gores/AcidRain/OrthoceraGore2.png new file mode 100644 index 0000000000..53bb75e1bc Binary files /dev/null and b/Gores/AcidRain/OrthoceraGore2.png differ diff --git a/Gores/AcidRain/SkyfinGore.png b/Gores/AcidRain/SkyfinGore.png new file mode 100644 index 0000000000..45969ed986 Binary files /dev/null and b/Gores/AcidRain/SkyfinGore.png differ diff --git a/Gores/AcidRain/SkyfinGore2.png b/Gores/AcidRain/SkyfinGore2.png new file mode 100644 index 0000000000..ec3e1a0fef Binary files /dev/null and b/Gores/AcidRain/SkyfinGore2.png differ diff --git a/Gores/AcidRain/SkyfinGore3.png b/Gores/AcidRain/SkyfinGore3.png new file mode 100644 index 0000000000..3e58b66069 Binary files /dev/null and b/Gores/AcidRain/SkyfinGore3.png differ diff --git a/Gores/AcidRain/TrilobiteGore.png b/Gores/AcidRain/TrilobiteGore.png new file mode 100644 index 0000000000..d40a9d3292 Binary files /dev/null and b/Gores/AcidRain/TrilobiteGore.png differ diff --git a/Gores/AcidRain/TrilobiteGore2.png b/Gores/AcidRain/TrilobiteGore2.png new file mode 100644 index 0000000000..2f997aaeb7 Binary files /dev/null and b/Gores/AcidRain/TrilobiteGore2.png differ diff --git a/Gores/AcidRain/TrilobiteGore3.png b/Gores/AcidRain/TrilobiteGore3.png new file mode 100644 index 0000000000..b1d7a534a7 Binary files /dev/null and b/Gores/AcidRain/TrilobiteGore3.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs new file mode 100644 index 0000000000..1275ce068b --- /dev/null +++ b/ILEditing/ILChanges.cs @@ -0,0 +1,214 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; +using MonoMod.Cil; +using static Mono.Cecil.Cil.OpCodes; +namespace CalamityMod.ILEditing +{ + public class ILChanges + { + /// + /// Loads all IL Editing changes in the mod. + /// + public static void Initialize() + { + IL.Terraria.Main.DrawInvasionProgress += (il) => + { + // 201 was retrieved by searching the instructions in dnspy + var cursor = new ILCursor(il) + { + Index = 201 + }; + cursor.EmitDelegate(() => + { + if ((CalamityWorld.rainingAcid && !Main.LocalPlayer.Calamity().ZoneSulphur) || + (!CalamityWorld.rainingAcid && Main.LocalPlayer.Calamity().ZoneSulphur)) + return; + float progressAlpha = 0.5f + Main.invasionProgressAlpha * 0.5f; + if (CalamityWorld.rainingAcid && Main.LocalPlayer.Calamity().ZoneSulphur && + Main.LocalPlayer.Center.Y < (int)(Main.worldSurface * 16) + 1600) + { + int sizeX = (int)(200f * progressAlpha); + int sizeY = (int)(45f * progressAlpha); + Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); + Rectangle screenCoordsRectangle = new Rectangle((int)screenCoords.X - sizeX / 2, (int)screenCoords.Y - sizeY / 2, sizeX, sizeY); + Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); + + float progressRatio = 1f - MathHelper.Clamp(Main.invasionSize / (float)Main.invasionSizeStart, 0f, 1f); + string progressText = $"{((int)(100 * progressRatio)).ToString()}%"; + progressText = Language.GetTextValue("Game.WaveCleared", progressText); + Texture2D barTexture = Main.colorBarTexture; + Texture2D blipTexture = Main.colorBlipTexture; + Main.spriteBatch.Draw(barTexture, screenCoords, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f); + Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText); + float adjustedAlpha = progressAlpha; + if (textMeasurement.Y > 22f) + { + adjustedAlpha *= 22f / textMeasurement.Y; + } + float barDrawOffsetX = 169f * progressAlpha; + float scaleY = 8f * progressAlpha; + Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; + Utils.DrawBorderString(Main.spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, adjustedAlpha, 0.5f, 1f, -1); + barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; + Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); + + string invasionNameText = "Acid Rain"; + Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText); + float x = 120f; + if (textMeasurement2.X > 200f) + { + x += textMeasurement2.X - 200f; + } + Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon"); + Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha); + Utils.DrawInvBG(Main.spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f); + Main.spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, (float)(iconTexture.Height / 2)), progressAlpha * 0.8f, SpriteEffects.None, 0f); + Utils.DrawBorderString(Main.spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1); + } + // I don't have the energy to clean this up. If you want to do so, go ahead. + else + { + Texture2D texture2D = Main.extraTexture[9]; + string text = ""; + Color c = Color.White; + if (Main.invasionProgressIcon == 1) + { + texture2D = Main.extraTexture[8]; + text = Lang.inter[83].Value; + c = new Color(64, 109, 164) * 0.5f; + } + else if (Main.invasionProgressIcon == 2) + { + texture2D = Main.extraTexture[12]; + text = Lang.inter[84].Value; + c = new Color(112, 86, 114) * 0.5f; + } + else if (Main.invasionProgressIcon == 3) + { + texture2D = Main.extraTexture[79]; + text = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle"); + c = new Color(88, 0, 160) * 0.5f; + } + else if (Main.invasionProgressIcon == 7) + { + texture2D = Main.extraTexture[10]; + text = Lang.inter[85].Value; + c = new Color(165, 160, 155) * 0.5f; + } + else if (Main.invasionProgressIcon == 6) + { + texture2D = Main.extraTexture[11]; + text = Lang.inter[86].Value; + c = new Color(148, 122, 72) * 0.5f; + } + else if (Main.invasionProgressIcon == 5) + { + texture2D = Main.extraTexture[7]; + text = Lang.inter[87].Value; + c = new Color(173, 135, 140) * 0.5f; + } + else if (Main.invasionProgressIcon == 4) + { + texture2D = Main.extraTexture[9]; + text = Lang.inter[88].Value; + c = new Color(94, 72, 131) * 0.5f; + } + if (Main.invasionProgressWave > 0) + { + int num2 = (int)(200f * progressAlpha); + int num3 = (int)(45f * progressAlpha); + Vector2 vector = new Vector2((float)(Main.screenWidth - 120), (float)(Main.screenHeight - 40)); + Rectangle r = new Rectangle((int)vector.X - num2 / 2, (int)vector.Y - num3 / 2, num2, num3); + Utils.DrawInvBG(Main.spriteBatch, r, new Color(63, 65, 151, 255) * 0.785f); + string text2; + if (Main.invasionProgressMax == 0) + { + text2 = Language.GetTextValue("Game.InvasionPoints", Main.invasionProgress); + } + else + { + text2 = ((int)((float)Main.invasionProgress * 100f / (float)Main.invasionProgressMax)).ToString() + "%"; + } + text2 = Language.GetTextValue("Game.WaveMessage", Main.invasionProgressWave, text2); + Texture2D texture2D2 = Main.colorBarTexture; + Texture2D texture2D4 = Main.colorBlipTexture; + float num4 = MathHelper.Clamp((float)Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f); + if (Main.invasionProgressMax == 0) + { + num4 = 1f; + } + float num5 = 169f * progressAlpha; + float num6 = 8f * progressAlpha; + Vector2 vector2 = vector + Vector2.UnitY * num6 + Vector2.UnitX * 1f; + Utils.DrawBorderString(Main.spriteBatch, text2, vector2, Color.White * Main.invasionProgressAlpha, progressAlpha, 0.5f, 1f, -1); + Main.spriteBatch.Draw(texture2D2, vector, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2((float)(texture2D2.Width / 2), 0f), progressAlpha, SpriteEffects.None, 0f); + vector2 += Vector2.UnitX * (num4 - 0.5f) * num5; + Main.spriteBatch.Draw(Main.magicPixel, vector2, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(num5 * num4, num6), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, vector2, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, num6), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, vector2, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(num5 * (1f - num4), num6), SpriteEffects.None, 0f); + } + else + { + int num7 = (int)(200f * progressAlpha); + int num8 = (int)(45f * progressAlpha); + Vector2 vector3 = new Vector2((float)(Main.screenWidth - 120), (float)(Main.screenHeight - 40)); + Rectangle r2 = new Rectangle((int)vector3.X - num7 / 2, (int)vector3.Y - num8 / 2, num7, num8); + Utils.DrawInvBG(Main.spriteBatch, r2, new Color(63, 65, 151, 255) * 0.785f); + string text3; + if (Main.invasionProgressMax == 0) + { + text3 = Main.invasionProgress.ToString(); + } + else + { + text3 = ((int)((float)Main.invasionProgress * 100f / (float)Main.invasionProgressMax)).ToString() + "%"; + } + text3 = Language.GetTextValue("Game.WaveCleared", text3); + Texture2D texture2D3 = Main.colorBarTexture; + Texture2D texture2D5 = Main.colorBlipTexture; + if (Main.invasionProgressMax != 0) + { + Main.spriteBatch.Draw(texture2D3, vector3, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2((float)(texture2D3.Width / 2), 0f), progressAlpha, SpriteEffects.None, 0f); + float num9 = MathHelper.Clamp((float)Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f); + Vector2 vector4 = Main.fontMouseText.MeasureString(text3); + float num10 = progressAlpha; + if (vector4.Y > 22f) + { + num10 *= 22f / vector4.Y; + } + float num11 = 169f * progressAlpha; + float num12 = 8f * progressAlpha; + Vector2 vector5 = vector3 + Vector2.UnitY * num12 + Vector2.UnitX * 1f; + Utils.DrawBorderString(Main.spriteBatch, text3, vector5 + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, num10, 0.5f, 1f, -1); + vector5 += Vector2.UnitX * (num9 - 0.5f) * num11; + Main.spriteBatch.Draw(Main.magicPixel, vector5, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(num11 * num9, num12), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, vector5, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, num12), SpriteEffects.None, 0f); + Main.spriteBatch.Draw(Main.magicPixel, vector5, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(num11 * (1f - num9), num12), SpriteEffects.None, 0f); + } + } + Vector2 value = Main.fontMouseText.MeasureString(text); + float num13 = 120f; + if (value.X > 200f) + { + num13 += value.X - 200f; + } + Rectangle r3 = Utils.CenteredRectangle(new Vector2((float)Main.screenWidth - num13, (float)(Main.screenHeight - 80)), (value + new Vector2((float)(texture2D.Width + 12), 6f)) * progressAlpha); + Utils.DrawInvBG(Main.spriteBatch, r3, c); + Main.spriteBatch.Draw(texture2D, r3.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, (float)(texture2D.Height / 2)), progressAlpha * 0.8f, SpriteEffects.None, 0f); + Utils.DrawBorderString(Main.spriteBatch, text, r3.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1); + } + }); + cursor.Emit(Pop); + cursor.Emit(Ret); + }; + } + } +} diff --git a/Items/Accessories/Abaddon_Head.png b/Items/Accessories/Abaddon_Head.png new file mode 100644 index 0000000000..4b6e75247b Binary files /dev/null and b/Items/Accessories/Abaddon_Head.png differ diff --git a/Items/Accessories/AbyssalDivingGear_Head.png b/Items/Accessories/AbyssalDivingGear_Head.png new file mode 100644 index 0000000000..4f71e2541b Binary files /dev/null and b/Items/Accessories/AbyssalDivingGear_Head.png differ diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs new file mode 100644 index 0000000000..ba8444de36 --- /dev/null +++ b/Items/Accessories/CorrosiveSpine.cs @@ -0,0 +1,62 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class CorrosiveSpine : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrosive Spine"); + Tooltip.SetDefault("Increased movement speed\n" + + "All rogue weapons inflict venom and spawn clouds on enemy hits\n" + + "You release a ton of clouds everywhere on hit"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 46; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.defense = 4; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().corrosiveSpine = true; + if (player.immune) + { + if (Main.rand.NextBool(9)) + { + for (int i = 0; i < 9; i++) + { + int type = -1; + switch (Main.rand.Next(3)) + { + case 0: + type = ModContent.ProjectileType(); + break; + case 1: + type = ModContent.ProjectileType(); + break; + case 2: + type = ModContent.ProjectileType(); + break; + } + // Should never happen, but just in case- + if (type != -1) + { + float speed = Main.rand.NextFloat(3f, 11f); + Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, + type, 100, 0f, player.whoAmI); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/CorrosiveSpine.png b/Items/Accessories/CorrosiveSpine.png new file mode 100644 index 0000000000..54e40784ed Binary files /dev/null and b/Items/Accessories/CorrosiveSpine.png differ diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs new file mode 100644 index 0000000000..8962086219 --- /dev/null +++ b/Items/Accessories/DukeScales.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class DukeScales : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Old Duke's Scales"); + Tooltip.SetDefault("While under the effects of a damaging debuff, you gain 10% increased damage and 5% crit\n" + + "When below 75% life, you gain 3% increased damage and crit\n" + + "When below 50% life, you gain an additional 5% increased damage and crit\n" + + "Provides immunity to poisoned, venom, and sulphruic poisoning"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 26; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.rare = 10; + item.Calamity().customRarity = (CalamityRarity)12; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dukeScales = true; + } + } +} diff --git a/Items/Accessories/DukeScales.png b/Items/Accessories/DukeScales.png new file mode 100644 index 0000000000..77255ebea8 Binary files /dev/null and b/Items/Accessories/DukeScales.png differ diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs new file mode 100644 index 0000000000..e10f6da85b --- /dev/null +++ b/Items/Accessories/HallowedRune.cs @@ -0,0 +1,44 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class HallowedRune : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hallowed Rune"); + Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff\n" + + "These buffs will either boost your defense, summon damage, or life regen for a while"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.hallowedRune = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.HallowedBar, 18); + recipe.AddIngredient(ItemID.SoulofFright, 5); + recipe.AddIngredient(ItemID.SoulofMight, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/HallowedRune.png b/Items/Accessories/HallowedRune.png new file mode 100644 index 0000000000..3d5301f9a1 Binary files /dev/null and b/Items/Accessories/HallowedRune.png differ diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs new file mode 100644 index 0000000000..e191db698d --- /dev/null +++ b/Items/Accessories/MutatedTruffle.cs @@ -0,0 +1,44 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Accessories +{ + public class MutatedTruffle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mutated Truffle"); + Tooltip.SetDefault("Summons a small Old Duke to fight for you\n" + + "When below 50% life, it moves much faster"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.expert = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.miniOldDuke = true; + if (player.whoAmI == Main.myPlayer) + { + const int damage = 1800; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center, Vector2.Zero, + ModContent.ProjectileType(), + (int)(damage * (player.allDamage + player.minionDamage - 1f)), + 6.5f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/Accessories/MutatedTruffle.png b/Items/Accessories/MutatedTruffle.png new file mode 100644 index 0000000000..12bf99395c Binary files /dev/null and b/Items/Accessories/MutatedTruffle.png differ diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 36c7e2b6c5..9634e29e26 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -32,6 +32,11 @@ namespace CalamityMod.Items.Accessories item.Calamity().customRarity = CalamityRarity.Dedicated; } + public override bool CanEquipAccessory(Player player, int slot) + { + return !player.Calamity().pArtifact; + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs new file mode 100644 index 0000000000..03770bf427 --- /dev/null +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -0,0 +1,168 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + //Developer item, dedicatee: Mishiro Usui/Amber Sienna + public class ProfanedSoulCrystal : ModItem + { + + /** + * Notes: Drops from providence if the only damage source during the fight is from typeless damage or the profaned soul and the owners of those babs do not have profaned crystal. + * All projectiles are in ProfanedSoulCrystalProjectiles.cs in the summon projectile directory + * The projectiles being created/fired on click happens in CalamityGlobalItem (there's a region specially for it so ctrl + f is your friend) + * the day/night buffs are in calamityplayermisceffects + * the bab projectiles are the same, just refactored ai to be more adhering to DRY principle + * bab spears being fired happens at the bottom of calplayer + * Animation of legs is postupdate, animation of wings is frameeffects. + * Projectiles transformed are ONLY affected by alldamage and summon damage bonuses, likewise the weapon's base damage/usetime is NOT taken into account. + * You enrage below below or at 50% hp. + */ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Soul Crystal"); + Tooltip.SetDefault("Transforms you into an emissary of the profaned goddess\n" + + "Requires 10 minion slots to use in order to grant the following effects\n" + + "All non-summon weapons are converted into powerful summon variations\n" + + "Falling below 50% life will empower these attacks\n" + + "[c/f05a5a:Transforms Melee attacks into a barrage of spears]\n" + + "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball]\n" + + "[c/85e092:Transforms Ranged attacks into a flurry of fireballs and meteors]\n" + + "[c/e97451:Transforms Rogue attacks into a deadly crystalline spiral]\n" + + "Summons and empowers the profaned babs to fight alongside you\n" + + "You are no longer affected by burn out when hit\n" + + "Provides buffs depending on the time of day\n" + + "Provides heat and cold protection in Death Mode\n" + + "Thinking back, it was a boring life\n" + + "[c/FFBF49:And so we burn it all in the name of purity]"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.value = Item.buyPrice(5, 0, 0, 0); + item.accessory = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + return !player.Calamity().pArtifact; + } + + public override void ModifyTooltips(List tooltips) + { + if (!CalamityWorld.downedSCal) + { + int index = 0; + foreach (TooltipLine line in tooltips) + { + if (line.mod == "Terraria" && line.Name.StartsWith("Tooltip")) + { + if (line.Name == "Tooltip0") + { + index = tooltips.IndexOf(line); + } + else + { + line.text = ""; + } + } + + } + + tooltips.Insert(index+1, new TooltipLine(CalamityMod.instance, "Tooltip1", "[c/f05a5a:The soul within this crystal has been defiled by the powerful magic of a supreme witch]\nMerchants will reject a defiled soul such as this.")); + } + else if (Main.player[Main.myPlayer].Calamity().profanedCrystalBuffs) + { + int manaCost = (int)((float)100 * Main.player[Main.myPlayer].manaCost); + foreach (TooltipLine line in tooltips) + { + if (line.mod == "Terraria" && line.Name == "Tooltip5") + { + line.text = "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball for " + manaCost + " mana per cast]"; + } + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + + modPlayer.pArtifact = true; + modPlayer.profanedCrystal = true; + + if (hideVisual) + modPlayer.profanedCrystalHide = true; + } + + public override void AddRecipes() + { + PSCRecipe recipe = new PSCRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ModContent.ItemType()); //this is NOT consumed during crafting + recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ItemID.ObsidianRose); + recipe.AddTile(ModContent.TileType()); + recipe.needLava = true; + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + public class PSCRecipe : ModRecipe + { + + public PSCRecipe(Mod mod) : base(mod) { } + + + public override int ConsumeItem(int type, int numRequired) => type == ModContent.ItemType() ? 0 : numRequired; + + public override bool RecipeAvailable() => Main.dayTime && (Main.LocalPlayer.ZoneHoly || Main.LocalPlayer.ZoneUnderworldHeight); + } + + public class ProfanedCrystalHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class ProfanedCrystalBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class ProfanedCrystalLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } + + public class ProfanedCrystalWings : EquipTexture + { + } +} diff --git a/Items/Accessories/ProfanedSoulCrystal.png b/Items/Accessories/ProfanedSoulCrystal.png new file mode 100644 index 0000000000..d23b652b79 Binary files /dev/null and b/Items/Accessories/ProfanedSoulCrystal.png differ diff --git a/Items/Accessories/ProfanedSoulTransArms.png b/Items/Accessories/ProfanedSoulTransArms.png new file mode 100644 index 0000000000..b2d12f3818 Binary files /dev/null and b/Items/Accessories/ProfanedSoulTransArms.png differ diff --git a/Items/Accessories/ProfanedSoulTransBody.png b/Items/Accessories/ProfanedSoulTransBody.png new file mode 100644 index 0000000000..0c533e0a36 Binary files /dev/null and b/Items/Accessories/ProfanedSoulTransBody.png differ diff --git a/Items/Accessories/ProfanedSoulTransHead.png b/Items/Accessories/ProfanedSoulTransHead.png new file mode 100644 index 0000000000..ccab0fb56d Binary files /dev/null and b/Items/Accessories/ProfanedSoulTransHead.png differ diff --git a/Items/Accessories/ProfanedSoulTransLegs.png b/Items/Accessories/ProfanedSoulTransLegs.png new file mode 100644 index 0000000000..98ba2a1bfc Binary files /dev/null and b/Items/Accessories/ProfanedSoulTransLegs.png differ diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs new file mode 100644 index 0000000000..c4823639be --- /dev/null +++ b/Items/Accessories/StarbusterCore.cs @@ -0,0 +1,34 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class StarbusterCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starbuster Core"); + Tooltip.SetDefault("Summons release an astral explosion on enemy hits\n" + + "1 extra minion slot"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.maxMinions++; + player.Calamity().starbusterCore = true; + } + } +} diff --git a/Items/Accessories/StarbusterCore.png b/Items/Accessories/StarbusterCore.png new file mode 100644 index 0000000000..ef5758d627 Binary files /dev/null and b/Items/Accessories/StarbusterCore.png differ diff --git a/Items/Accessories/Wings/ProfanedSoulTransWings.png b/Items/Accessories/Wings/ProfanedSoulTransWings.png new file mode 100644 index 0000000000..df354fa312 Binary files /dev/null and b/Items/Accessories/Wings/ProfanedSoulTransWings.png differ diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 053e4310d6..d344d14dd4 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 7fec2a588f..cf67e49703 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor "Inferno effect when below 50% life\n" + "Rogue weapons have a 10% chance to unleash a volley of chaos flames around the player that chase enemies when used\n" + "You have a 20% chance to emit a blazing explosion when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 2cf2cba682..3005be8296 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "Rogue weapon critical strikes will do 1.25 times damage while you are above 50% HP\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 130\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 130\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index 8619b5f27a..22cba89c92 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + "Being below 80% life boosts your rogue damage by 10%\n" + "Rogue critical strikes have a 50% chance to heal you\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index feab1d346b..cbddcd31ab 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "5% increased rogue damage\n" + "Rogue projectiles throw out crystal shards as they travel\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 105\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 5c4d6454df..cf8f6ff59d 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + "While at full HP all of your rogue stats are boosted by 10%\n" + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index 71ce606364..546adfb0c3 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor modPlayer.rogueStealthMax += 1.1f; player.setBonus = "5% increased rogue damage\n" + "You emit a cloud of spores when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 4e5eb9fa2e..a937ccc73f 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor "Your max life will return to normal if you die\n" + "Rogue weapons have a faster throwing rate while you are above 50% life\n" + "After the silva invulnerability time your rogue weapons will do 10% more damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 125\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 125\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed\n" + diff --git a/Items/Armor/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffianChestplate.cs new file mode 100644 index 0000000000..74a50440d3 --- /dev/null +++ b/Items/Armor/SnowRuffianChestplate.cs @@ -0,0 +1,43 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + class SnowRuffianChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snow Ruffian Chestplate"); + Tooltip.SetDefault("3% increased rogue critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 2; //4 + } + + public override void UpdateEquip(Player player) + { + player.Calamity().throwingCrit += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SnowBlock, 30); + recipe.AddIngredient(ItemID.IceBlock, 15); + recipe.AddIngredient(ItemID.BorealWood, 45); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SnowRuffianChestplate.png b/Items/Armor/SnowRuffianChestplate.png new file mode 100644 index 0000000000..5c989b094f Binary files /dev/null and b/Items/Armor/SnowRuffianChestplate.png differ diff --git a/Items/Armor/SnowRuffianChestplate_Arms.png b/Items/Armor/SnowRuffianChestplate_Arms.png new file mode 100644 index 0000000000..f3b23cdc8a Binary files /dev/null and b/Items/Armor/SnowRuffianChestplate_Arms.png differ diff --git a/Items/Armor/SnowRuffianChestplate_Body.png b/Items/Armor/SnowRuffianChestplate_Body.png new file mode 100644 index 0000000000..d6fd5e3c0d Binary files /dev/null and b/Items/Armor/SnowRuffianChestplate_Body.png differ diff --git a/Items/Armor/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffianGreaves.cs new file mode 100644 index 0000000000..bddc78ce5f --- /dev/null +++ b/Items/Armor/SnowRuffianGreaves.cs @@ -0,0 +1,43 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + class SnowRuffianGreaves : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snow Ruffian Greaves"); + Tooltip.SetDefault("5% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 1; //4 + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SnowBlock, 20); + recipe.AddIngredient(ItemID.IceBlock, 10); + recipe.AddIngredient(ItemID.BorealWood, 30); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SnowRuffianGreaves.png b/Items/Armor/SnowRuffianGreaves.png new file mode 100644 index 0000000000..dd0aefbb4d Binary files /dev/null and b/Items/Armor/SnowRuffianGreaves.png differ diff --git a/Items/Armor/SnowRuffianGreaves_Legs.png b/Items/Armor/SnowRuffianGreaves_Legs.png new file mode 100644 index 0000000000..19fb8e8563 Binary files /dev/null and b/Items/Armor/SnowRuffianGreaves_Legs.png differ diff --git a/Items/Armor/SnowRuffianMask.cs b/Items/Armor/SnowRuffianMask.cs new file mode 100644 index 0000000000..3afac1a2cb --- /dev/null +++ b/Items/Armor/SnowRuffianMask.cs @@ -0,0 +1,97 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + class SnowRuffianMask : ModItem + { + private bool shouldBoost = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snow Ruffian Mask"); + Tooltip.SetDefault("2% increased rogue damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 1; //4 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.snowRuffianSet = true; + modPlayer.rogueStealthMax += 0.5f; + player.setBonus = "5% increased rogue damage\n" + + "You can glide to negate fall damage\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 50\n" + + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + player.Calamity().throwingDamage += 0.05f; + player.Calamity().wearingRogueArmor = true; + if (player.controlJump) + { + player.noFallDmg = true; + player.UpdateJumpHeight(); + if (shouldBoost) + { + player.velocity.X *= 1.3f; + shouldBoost = false; + } + + } + else if (!shouldBoost && player.velocity.Y == 0) + { + shouldBoost = true; + } + } + + public override void UpdateEquip(Player player) + { + player.Calamity().throwingDamage += 0.02f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SnowBlock, 10); + recipe.AddIngredient(ItemID.IceBlock, 5); + recipe.AddIngredient(ItemID.BorealWood, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + public class SnowRuffianWings : EquipTexture + { + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.5f; + ascentWhenRising = 0f; + maxCanAscendMultiplier = 0f; + maxAscentMultiplier = 0f; + constantAscend = 0f; + } + + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 2f; + acceleration *= 1.25f; + } + } +} diff --git a/Items/Armor/SnowRuffianMask.png b/Items/Armor/SnowRuffianMask.png new file mode 100644 index 0000000000..440ddd4baf Binary files /dev/null and b/Items/Armor/SnowRuffianMask.png differ diff --git a/Items/Armor/SnowRuffianMask_Head.png b/Items/Armor/SnowRuffianMask_Head.png new file mode 100644 index 0000000000..5614a81d94 Binary files /dev/null and b/Items/Armor/SnowRuffianMask_Head.png differ diff --git a/Items/Armor/SnowRuffianWings.png b/Items/Armor/SnowRuffianWings.png new file mode 100644 index 0000000000..46ae41a109 Binary files /dev/null and b/Items/Armor/SnowRuffianWings.png differ diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 19f4ae0551..1d61ce5748 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/SulfurHelmet.cs b/Items/Armor/SulfurHelmet.cs index 61cfc507b6..1181974a1d 100644 --- a/Items/Armor/SulfurHelmet.cs +++ b/Items/Armor/SulfurHelmet.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Attacking and being attacked by enemies inflicts poison\n" + "Grants a sulphurous bubble jump that applies venom on hit\n" + "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index e6087a4786..eb1d9f64e0 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + "This effect can only occur once every 30 seconds\n" + "While under the effects of a debuff you gain 10% increased rogue damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 115\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/UmbraphileHood.cs b/Items/Armor/UmbraphileHood.cs index 82bfcf677e..97c76a0f23 100644 --- a/Items/Armor/UmbraphileHood.cs +++ b/Items/Armor/UmbraphileHood.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Rogue weapons have a chance to create explosions on hit\n" + "Stealth strikes always create an explosion\n" + "Penumbra potions always build stealth at max effectiveness\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 50a02d3f2e..b71e5a1622 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor "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" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 90\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 90\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 00fa02449a..c87bb01370 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); player.setBonus = "+3 defense\n" + "+5 defense when below 50% life\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 50\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 50\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 069aba5b57..8cff77074b 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "9% increased rogue damage and velocity\n" + "Rogue projectiles have special effects on enemy hits\n" + "Imbued with cosmic wrath and rage when you are damaged\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 115\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 1e816da2a4..36cd4b5d72 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -427,10 +427,186 @@ namespace CalamityMod.Items } #endregion + #region Profaned Soul Crystal Attacks + + private bool HandleAttackTransforms(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1; + if (weaponType > 0) + { + if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300) + { + player.Calamity().profanedSoulWeaponType = weaponType; + player.Calamity().profanedSoulWeaponUsage = 0; + } + Vector2 correctedVelocity = Main.MouseWorld - player.Center; + correctedVelocity.Normalize(); + bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much. + bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + if (item.melee) + { + if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0) + { + if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread + { + int numProj = 5; + + correctedVelocity *= 12f; + int spread = 3; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + + Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1750) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + spread -= Main.rand.Next(2, 4); + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage = 0; + } + else + { + Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 250 : 1250) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + Main.PlaySound(SoundID.Item20, player.Center); + } + + } + player.Calamity().profanedSoulWeaponUsage++; + + } + else if (item.ranged) + { + + if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance + { + correctedVelocity *= 20f; + Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3)); + bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. + bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% + int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; + int dam = (int)((shouldNerf ? 250 : 1000) * (player.allDamage + player.minionDamage - 1f)); + switch (projType) + { + case 1: //big boomer + case 2: //boomer + int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f); + Main.projectile[proj].Calamity().forceMinion = true; + break; + case 3: //bab boomer + int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f); + Main.projectile[proj2].Calamity().forceMinion = true; + break; + } + if (projType > 1) + { + Main.PlaySound(SoundID.Item20, player.Center); + } + } + } + else if (item.magic) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + int manaCost = (int)((float)100 * player.manaCost); + if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0) + { + if (player.manaFlower) + { + player.QuickMana(); + } + } + if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= manaCost; + correctedVelocity *= 25f; + Main.PlaySound(SoundID.Item20, player.Center); + int dam = (int)((shouldNerf ? 900 : 4500) * (player.allDamage + player.minionDamage - 1f)); + if (player.HasBuff(BuffID.ManaSickness)) + { + int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); + dam -= sickPenalty; + } + int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType(), dam, 1f, player.whoAmI, enrage ? 1f : 0f); + Main.projectile[proj].Calamity().forceMinion = true; + player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25; + } + if (player.Calamity().profanedSoulWeaponUsage > 0) + player.Calamity().profanedSoulWeaponUsage--; + } + else if (item.Calamity().rogue) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180)) + { + float crystalCount = 36f; + for (float i = 0; i < crystalCount; i++) + { + float angle = MathHelper.TwoPi / crystalCount * i; + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 169 : 880) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().forceMinion = true; + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage = 0; + } + else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) + { + float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 1100) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 1f, 0f); + Main.projectile[proj].Calamity().forceMinion = true; + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; + if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) + player.Calamity().profanedSoulWeaponUsage--; + } + } + return false; + } + + #endregion + #region Use Item Changes + + public override bool AltFunctionUse(Item item, Player player) + { + if (player.Calamity().profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) + { + NPC closest = Main.MouseWorld.ClosestNPCAt(1000f, true); + if (closest != null) + { + player.MinionAttackTargetNPC = closest.whoAmI; + player.UpdateMinionTarget(); + } + return false; + } + return base.AltFunctionUse(item, player); + } + public override bool CanUseItem(Item item, Player player) { CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) + { + if (player.altFunctionUse == 0) + { + return HandleAttackTransforms(item, player); + } + else + { + return AltFunctionUse(item, player); + } + } + else if (modPlayer.profanedCrystalBuffs && item.summon) + { + + } if (item.type == ItemID.MonkStaffT1) { for (int i = 0; i < 1000; ++i) @@ -545,6 +721,8 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(0, 0, 255); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); + if (item.type == ModContent.ItemType()) + tt2.overrideColor = new Color(255 - Main.DiscoG < 80 ? 80 : Main.DiscoG < 50 ? 255 : 255 - Main.DiscoG, Main.DiscoG < 126 ? 126 : Main.DiscoG, 0); //alternates between emerald green and amber (BanditHueh) // Uniquely colored legendary weapons if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) @@ -871,7 +1049,7 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.FlaskofNanites) + if (item.type == ItemID.FlaskofPoison) { foreach (TooltipLine line2 in tooltips) { diff --git a/Items/Materials/Acidwood.cs b/Items/Materials/Acidwood.cs new file mode 100644 index 0000000000..4ca317c2bc --- /dev/null +++ b/Items/Materials/Acidwood.cs @@ -0,0 +1,20 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class Acidwood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acidwood"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 999; + item.value = 0; + } + } +} diff --git a/Items/Materials/Acidwood.png b/Items/Materials/Acidwood.png new file mode 100644 index 0000000000..b9ce4603be Binary files /dev/null and b/Items/Materials/Acidwood.png differ diff --git a/Items/Materials/SulfuricScale.cs b/Items/Materials/SulfuricScale.cs new file mode 100644 index 0000000000..c8d90e717f --- /dev/null +++ b/Items/Materials/SulfuricScale.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class SulfuricScale : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulfuric Scale"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 3); + item.rare = 1; + } + } +} diff --git a/Items/Materials/SulfuricScale.png b/Items/Materials/SulfuricScale.png new file mode 100644 index 0000000000..16a53ba6e5 Binary files /dev/null and b/Items/Materials/SulfuricScale.png differ diff --git a/Items/Pets/RadiatingCrystal.cs b/Items/Pets/RadiatingCrystal.cs index 87d0aa64c1..48a33b4dad 100644 --- a/Items/Pets/RadiatingCrystal.cs +++ b/Items/Pets/RadiatingCrystal.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Radiating Crystal"); - Tooltip.SetDefault("Summons a radiator light pet\n" + - "The crystal contains traces of holothurin\n" + + Tooltip.SetDefault("The crystal contains traces of holothurin\n" + + "Summons a radiator light pet\n" + "Provides a small amount of light in the abyss"); } diff --git a/Items/Pets/SparksSummon.cs b/Items/Pets/SparksSummon.cs new file mode 100644 index 0000000000..d37d166612 --- /dev/null +++ b/Items/Pets/SparksSummon.cs @@ -0,0 +1,53 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class SparksSummon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Butterfly"); + Tooltip.SetDefault("Feed him dragonflies to keep him strong!\n" + + "Summons a mysterious dragonfly light pet\n" + + "Provides a small amount of light in the abyss"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.WispinaBottle); + item.shoot = ModContent.ProjectileType(); + item.buffType = ModContent.BuffType(); + item.value = Item.sellPrice(gold: 1); + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldButterfly); + recipe.AddIngredient(ItemID.MonarchButterfly); + recipe.AddIngredient(ItemID.PurpleEmperorButterfly); + recipe.AddIngredient(ItemID.RedAdmiralButterfly); + recipe.AddIngredient(ItemID.UlyssesButterfly); + recipe.AddIngredient(ItemID.SulphurButterfly); + recipe.AddIngredient(ItemID.TreeNymphButterfly); + recipe.AddIngredient(ItemID.ZebraSwallowtailButterfly); + recipe.AddIngredient(ItemID.JuliaButterfly); + recipe.AddTile(TileID.CrystalBall); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Pets/SparksSummon.png b/Items/Pets/SparksSummon.png new file mode 100644 index 0000000000..ec611e6f70 Binary files /dev/null and b/Items/Pets/SparksSummon.png differ diff --git a/Items/Placeables/Banners/AcidEelBanner.cs b/Items/Placeables/Banners/AcidEelBanner.cs new file mode 100644 index 0000000000..8f54541f54 --- /dev/null +++ b/Items/Placeables/Banners/AcidEelBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class AcidEelBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 115; + } + } +} diff --git a/Items/Placeables/Banners/AcidEelBanner.png b/Items/Placeables/Banners/AcidEelBanner.png new file mode 100644 index 0000000000..148f9306ff Binary files /dev/null and b/Items/Placeables/Banners/AcidEelBanner.png differ diff --git a/Items/Placeables/Banners/NuclearToadBanner.cs b/Items/Placeables/Banners/NuclearToadBanner.cs new file mode 100644 index 0000000000..ef770b8866 --- /dev/null +++ b/Items/Placeables/Banners/NuclearToadBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class NuclearToadBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 116; + } + } +} diff --git a/Items/Placeables/Banners/NuclearToadBanner.png b/Items/Placeables/Banners/NuclearToadBanner.png new file mode 100644 index 0000000000..b4ef373b7b Binary files /dev/null and b/Items/Placeables/Banners/NuclearToadBanner.png differ diff --git a/Items/Placeables/Banners/OrthoceraBanner.cs b/Items/Placeables/Banners/OrthoceraBanner.cs new file mode 100644 index 0000000000..565ae130ee --- /dev/null +++ b/Items/Placeables/Banners/OrthoceraBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class OrthoceraBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 112; + } + } +} diff --git a/Items/Placeables/Banners/OrthoceraBanner.png b/Items/Placeables/Banners/OrthoceraBanner.png new file mode 100644 index 0000000000..a24336c299 Binary files /dev/null and b/Items/Placeables/Banners/OrthoceraBanner.png differ diff --git a/Items/Placeables/Banners/SkyfinBanner.cs b/Items/Placeables/Banners/SkyfinBanner.cs new file mode 100644 index 0000000000..94408ffd0c --- /dev/null +++ b/Items/Placeables/Banners/SkyfinBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class SkyfinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 113; + } + } +} diff --git a/Items/Placeables/Banners/SkyfinBanner.png b/Items/Placeables/Banners/SkyfinBanner.png new file mode 100644 index 0000000000..45aedc2fc0 Binary files /dev/null and b/Items/Placeables/Banners/SkyfinBanner.png differ diff --git a/Items/Placeables/Banners/TrilobiteBanner.cs b/Items/Placeables/Banners/TrilobiteBanner.cs new file mode 100644 index 0000000000..d730d9c795 --- /dev/null +++ b/Items/Placeables/Banners/TrilobiteBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class TrilobiteBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 111; + } + } +} diff --git a/Items/Placeables/Banners/TrilobiteBanner.png b/Items/Placeables/Banners/TrilobiteBanner.png new file mode 100644 index 0000000000..148f9306ff Binary files /dev/null and b/Items/Placeables/Banners/TrilobiteBanner.png differ diff --git a/Items/Placeables/Banners/WaterLeechBanner.cs b/Items/Placeables/Banners/WaterLeechBanner.cs new file mode 100644 index 0000000000..bea85e2872 --- /dev/null +++ b/Items/Placeables/Banners/WaterLeechBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class WaterLeechBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 114; + } + } +} diff --git a/Items/Placeables/Banners/WaterLeechBanner.png b/Items/Placeables/Banners/WaterLeechBanner.png new file mode 100644 index 0000000000..27edc65158 Binary files /dev/null and b/Items/Placeables/Banners/WaterLeechBanner.png differ diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs new file mode 100644 index 0000000000..e730198191 --- /dev/null +++ b/Items/SummonItems/BloodwormItem.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.NPCs.AcidRain; + +namespace CalamityMod.Items.SummonItems +{ + public class BloodwormItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodworm"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 9; + item.bait = 69420; + item.useStyle = 1; + item.autoReuse = true; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.consumable = true; + item.noUseGraphic = true; + item.makeNPC = (short)ModContent.NPCType(); + } + } +} diff --git a/Items/SummonItems/BloodwormItem.png b/Items/SummonItems/BloodwormItem.png new file mode 100644 index 0000000000..458cb0dc21 Binary files /dev/null and b/Items/SummonItems/BloodwormItem.png differ diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs new file mode 100644 index 0000000000..89fc407c97 --- /dev/null +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -0,0 +1,43 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + public class CausticTear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Tear"); + Tooltip.SetDefault("Toggles the acid rain in the Sulphurous Sea"); + } + + 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 UseItem(Player player) + { + if (!CalamityWorld.rainingAcid) + { + AcidRainEvent.TryStartEvent(); + } + else + { + Main.invasionSize = 0; + AcidRainEvent.UpdateInvasion(); + } + return true; + } + } +} diff --git a/Items/SummonItems/Invasion/CausticTear.png b/Items/SummonItems/Invasion/CausticTear.png new file mode 100644 index 0000000000..9d91f64691 Binary files /dev/null and b/Items/SummonItems/Invasion/CausticTear.png differ diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 52e2ab742b..5c08c4cdb0 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.World; using Terraria; @@ -54,6 +55,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Blight Spewer DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); float malachiteChance = DropHelper.LegendaryDropRateFloat; DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, malachiteChance); diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 56d9e3a24b..b8bdb90ccb 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Providence; using Terraria; using Terraria.ModLoader; @@ -52,6 +53,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs new file mode 100644 index 0000000000..c6289c58ac --- /dev/null +++ b/Items/Weapons/Magic/AcidGun.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class AcidGun : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Gun"); + Tooltip.SetDefault("Releases a stream of acid"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 9; + item.width = 48; + item.height = 30; + item.useTime = item.useAnimation = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = ModContent.ProjectileType(); + } + 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 angle = MathHelper.Lerp(-0.145f, 0.145f, i / 3f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY).RotatedBy(angle), type, damage, knockBack, player.whoAmI); + } + return false; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 35); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + } + } +} diff --git a/Items/Weapons/Magic/AcidGun.png b/Items/Weapons/Magic/AcidGun.png new file mode 100644 index 0000000000..6c5d06e5f2 Binary files /dev/null and b/Items/Weapons/Magic/AcidGun.png differ diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs new file mode 100644 index 0000000000..be91cb12dc --- /dev/null +++ b/Items/Weapons/Magic/Eternity.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Eternity : ModItem + { + public const int BaseDamage = 7777; + public const int ExplosionDamage = 50000; + public const int MaxHomers = 40; + public const int dustID = 16; + public static readonly Color blueColor = new Color(34, 34, 160); + public static readonly Color pinkColor = new Color(169, 30, 184); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternity"); + Tooltip.SetDefault("Hexes a possible nearby enemy, trapping them in a brilliant display of destruction\n" + + "This line is modified in ModifyTooltips"); + } + + public override void SetDefaults() + { + item.damage = BaseDamage; + item.magic = true; + item.mana = 30; + item.width = 38; + item.height = 40; + item.useTime = item.useAnimation = 120; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Developer; + item.autoReuse = true; + item.noUseGraphic = true; + item.shoot = ModContent.ProjectileType(); + item.channel = true; + item.shootSpeed = 0f; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void ModifyTooltips(List tooltips) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = $"[" + DisoHex + "There's pictures of ponies in the book]"; + } + } + } + public static string DisoHex => "c/" + + ((int)(156 + Main.DiscoR * 99f / 255f)).ToString("X2") + + 108.ToString("X2") + 251.ToString("X2") + ":"; + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.UnicornHorn, 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Magic/Eternity.png b/Items/Weapons/Magic/Eternity.png new file mode 100644 index 0000000000..9059a2fb2a Binary files /dev/null and b/Items/Weapons/Magic/Eternity.png differ diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs new file mode 100644 index 0000000000..fdbfc32794 --- /dev/null +++ b/Items/Weapons/Magic/Miasma.cs @@ -0,0 +1,49 @@ +using CalamityMod.Projectiles.Magic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Miasma : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miasma"); + Tooltip.SetDefault("Releases gas clouds that stay still and explode after a while"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 123; + item.magic = true; + item.mana = 16; + item.width = 50; + item.height = 64; + item.useTime = item.useAnimation = 27; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + 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) + { + for (int i = 0; i < Main.rand.Next(5, 8 + 1); i++) + { + Vector2 velocity = new Vector2(speedX, speedY) * Main.rand.NextFloat(0.9f, 1.1f); + float angle = Main.rand.NextFloat(-1f, 1f) * MathHelper.ToRadians(23f); + Projectile.NewProjectile(position, velocity.RotatedBy(angle), type, damage, knockBack, player.whoAmI); + } + return false; + } + } +} diff --git a/Items/Weapons/Magic/Miasma.png b/Items/Weapons/Magic/Miasma.png new file mode 100644 index 0000000000..10266bf4f5 Binary files /dev/null and b/Items/Weapons/Magic/Miasma.png differ diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 91e64976cc..11f6805c22 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("The Wand"); Tooltip.SetDefault("The ultimate wand"); + Item.staff[item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs new file mode 100644 index 0000000000..1eff8574b4 --- /dev/null +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -0,0 +1,57 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class VitriolicViper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vitriolic Viper"); + Tooltip.SetDefault("Releases a volley of venomous fangs and spit"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 15; + item.width = 60; + item.height = 62; + item.useTime = item.useAnimation = 16; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.UseSound = SoundID.Item46; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + } + + 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 velocity = new Vector2(speedX, speedY); + float spitAngleMax = MathHelper.ToRadians(20f + Main.rand.NextFloat(-2f, 2f)); + float fangAngleMax = MathHelper.ToRadians(10f + Main.rand.NextFloat(-1f, 1f)); + for (int i = 0; i < 9; i++) + { + float angle = MathHelper.Lerp(i / 9f, -spitAngleMax, spitAngleMax); + Projectile.NewProjectile(position, velocity.RotatedBy(angle) * 1.65f, type, (int)(damage * 0.7f), knockBack, player.whoAmI); + } + for (int i = 0; i < 5; i++) + { + float angle = MathHelper.Lerp(i / 5f, -fangAngleMax, fangAngleMax); + Projectile.NewProjectile(position, velocity.RotatedBy(angle), + ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + } + return false; + } + } +} diff --git a/Items/Weapons/Magic/VitriolicViper.png b/Items/Weapons/Magic/VitriolicViper.png new file mode 100644 index 0000000000..1f15cf2da3 Binary files /dev/null and b/Items/Weapons/Magic/VitriolicViper.png differ diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs new file mode 100644 index 0000000000..0b6651164b --- /dev/null +++ b/Items/Weapons/Melee/Basher.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class Basher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Basher"); + Tooltip.SetDefault("Inflicts sulfuric poisoning on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 52; + item.damage = 22; + item.melee = true; + item.useAnimation = item.useTime = 26; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.useTurn = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 1; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 30); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Items/Weapons/Melee/Basher.png b/Items/Weapons/Melee/Basher.png new file mode 100644 index 0000000000..83c3c73eb9 Binary files /dev/null and b/Items/Weapons/Melee/Basher.png differ diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs new file mode 100644 index 0000000000..dbe0546270 --- /dev/null +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -0,0 +1,61 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class FetidEmesis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fetid Emesis"); + Tooltip.SetDefault("Has a chance to release rotten chunks instead of bullets."); + } + + public override void SetDefaults() + { + item.damage = 125; + item.ranged = true; + item.width = 76; + item.height = 46; + item.useTime = item.useAnimation = 5; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = AmmoID.Bullet; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.NextBool(8)) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 0.45f, + ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustDirect(position, 10, 10, 27); + dust.velocity = Vector2.Normalize(new Vector2(speedX, speedY)).RotatedByRandom(MathHelper.ToRadians(15f)); + dust.noGravity = true; + } + // WoF vomit sound. + Main.PlaySound(SoundID.NPCKilled, position, 13); + return false; + } + return true; + } + } +} diff --git a/Items/Weapons/Ranged/FetidEmesis.png b/Items/Weapons/Ranged/FetidEmesis.png new file mode 100644 index 0000000000..5e142252ff Binary files /dev/null and b/Items/Weapons/Ranged/FetidEmesis.png differ diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs new file mode 100644 index 0000000000..a405ca513e --- /dev/null +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Toxibow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxibow"); + Tooltip.SetDefault("Fires slow arrows that inflict sulfuric poisoning"); + } + + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 20; + item.height = 54; + item.useTime = item.useAnimation = 29; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = AmmoID.Arrow; + } + + 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, new Vector2(speedX, speedY), ModContent.ProjectileType(), + damage, 0f, player.whoAmI, 0f, 0f); + return false; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + } + } +} diff --git a/Items/Weapons/Ranged/Toxibow.png b/Items/Weapons/Ranged/Toxibow.png new file mode 100644 index 0000000000..5dd229fab9 Binary files /dev/null and b/Items/Weapons/Ranged/Toxibow.png differ diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs new file mode 100644 index 0000000000..0460a9222f --- /dev/null +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -0,0 +1,54 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class ToxicantTwister : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxicant Twister"); + Tooltip.SetDefault("Releases a fast boomerang\n" + + "Stealth strikes cause the boomerang to go much faster and release sand rapidly"); + } + + public override void SafeSetDefaults() + { + item.width = 42; + item.height = 46; + item.damage = 400; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = item.useTime = 30; + item.useStyle = 1; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().rogue = 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) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + + Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (Main.projectile[stealth].Calamity().stealthStrike) + { + Main.projectile[stealth].velocity *= 1.5f; + Main.projectile[stealth].timeLeft = 420; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].localNPCHitCooldown = 6; + } + return false; + } + } +} diff --git a/Items/Weapons/Rogue/ToxicantTwister.png b/Items/Weapons/Rogue/ToxicantTwister.png new file mode 100644 index 0000000000..f54ead37b4 Binary files /dev/null and b/Items/Weapons/Rogue/ToxicantTwister.png differ diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs new file mode 100644 index 0000000000..06c8314b71 --- /dev/null +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -0,0 +1,91 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class BensUmbrella : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Temporal Umbrella"); + Tooltip.SetDefault("Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow\n" + + "Summons a magic hat to hover above your head\n" + + "The hat will release a variety of objects to assault your foes\n" + + "Requires 5 minion slots to use\n" + + "There can only be one"); + } + + public override void SetDefaults() + { + item.mana = 99; + item.damage = 1234; + item.useStyle = 1; + item.width = 74; + item.height = 72; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.Calamity().customRarity = CalamityRarity.Developer; + item.rare = 10; + item.UseSound = SoundID.Item68; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == ModContent.ProjectileType() && 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) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + for (int x = 0; x < Main.projectile.Length; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.type == type) + { + projectile.Kill(); + } + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Umbrella); + recipe.AddIngredient(ItemID.TopHat); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/BensUmbrella.png b/Items/Weapons/Summon/BensUmbrella.png new file mode 100644 index 0000000000..8d9a67b7e0 Binary files /dev/null and b/Items/Weapons/Summon/BensUmbrella.png differ diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 12dbc251ae..2e4064f69a 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -38,10 +38,13 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (player.whoAmI == Main.myPlayer) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } } return false; } diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs new file mode 100644 index 0000000000..62ce5315b2 --- /dev/null +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class CadaverousCarrion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cadaverous Carrion"); + Tooltip.SetDefault("Summons a gross Old Duke fishron head on the ground"); + } + + public override void SetDefaults() + { + item.damage = 400; + item.mana = 32; + item.summon = true; + item.sentry = true; + item.width = 54; + item.height = 56; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.UseSound = SoundID.NPCDeath13; + item.shoot = ModContent.ProjectileType(); + } + + 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; + Point mouseTileCoords = position.ToTileCoordinates(); + if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y)) + return false; + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/CadaverousCarrion.png b/Items/Weapons/Summon/CadaverousCarrion.png new file mode 100644 index 0000000000..3cc33f076e Binary files /dev/null and b/Items/Weapons/Summon/CadaverousCarrion.png differ diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs new file mode 100644 index 0000000000..d1fcf1fd54 --- /dev/null +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class CausticCroakerStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Croaker Staff"); + Tooltip.SetDefault("Summons a toad that explodes if enemies are nearby"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.mana = 10; + item.width = 10; + item.height = 32; + item.useTime = item.useAnimation = 36; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = 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; + Point mouseTileCoords = position.ToTileCoordinates(); + if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y + 1)) + return false; + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); + } + return false; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + } + } +} diff --git a/Items/Weapons/Summon/CausticCroakerStaff.png b/Items/Weapons/Summon/CausticCroakerStaff.png new file mode 100644 index 0000000000..77d97c90da Binary files /dev/null and b/Items/Weapons/Summon/CausticCroakerStaff.png differ diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs new file mode 100644 index 0000000000..d0a2fe447e --- /dev/null +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -0,0 +1,61 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class CorvidHarbringerStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corvid Harbringer Staff"); + Tooltip.SetDefault("Nevermore.\n" + + "Summons a powerful raven which teleports and dashes"); + } + + public override void SetDefaults() + { + item.width = 54; + item.height = 52; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; + item.summon = true; + item.mana = 11; + item.damage = 456; + item.knockBack = 2f; + item.autoReuse = true; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 13f; + + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + 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) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RavenStaff); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.png b/Items/Weapons/Summon/CorvidHarbringerStaff.png new file mode 100644 index 0000000000..3d8e535379 Binary files /dev/null and b/Items/Weapons/Summon/CorvidHarbringerStaff.png differ diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 9eabdb1c34..57e366f8a5 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs new file mode 100644 index 0000000000..2b47d99d2a --- /dev/null +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class DazzlingStabberStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dazzling Stabber Staff"); + Tooltip.SetDefault("Summons a holy blade to fight for you"); + } + + public override void SetDefaults() + { + item.width = 54; + item.height = 52; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.DD2_DarkMageHealImpact; + item.summon = true; + item.mana = 12; + item.damage = 111; + item.knockBack = 2f; + item.autoReuse = true; + item.useTime = item.useAnimation = 21; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 13f; + + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } + + 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) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + float angleMax = MathHelper.ToRadians(45f); + if (CalamityUtils.CountProjectiles(type) == 1) + angleMax = 0f; + float index = 1f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].ai[1] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; + Main.projectile[i].netUpdate = true; + index++; + } + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.png b/Items/Weapons/Summon/DazzlingStabberStaff.png new file mode 100644 index 0000000000..959b2003dd Binary files /dev/null and b/Items/Weapons/Summon/DazzlingStabberStaff.png differ diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs new file mode 100644 index 0000000000..31a81446bb --- /dev/null +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class DragonbloodDisgorger : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragonblood Disgorger"); + Tooltip.SetDefault("Summons a skeletal dragon and her two children\n" + + "Requires 6 minion slots to be summoned\n" + + "There can only be one family"); + } + + public override void SetDefaults() + { + item.damage = 300; + item.mana = 30; + item.width = 64; + item.height = 62; + item.useTime = item.useAnimation = 36; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 8; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.UseSound = SoundID.DD2_SkeletonDeath; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = 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) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + return false; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ModContent.ItemType(), 12); + r.AddTile(TileID.LunarCraftingStation); + r.SetResult(this); + r.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.png b/Items/Weapons/Summon/DragonbloodDisgorger.png new file mode 100644 index 0000000000..d1c8066dfe Binary files /dev/null and b/Items/Weapons/Summon/DragonbloodDisgorger.png differ diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs new file mode 100644 index 0000000000..f6eefe1b04 --- /dev/null +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -0,0 +1,80 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class EndoHydraStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Endo Hydra Staff"); + Tooltip.SetDefault("Summons a frigid entity with a head\n" + + "If the entity already exists, using this item again will cause it to gain more heads"); + } + + public override void SetDefaults() + { + item.width = 58; + item.height = 60; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.Item60; + item.summon = true; + item.mana = 25; + item.damage = 2563; + item.knockBack = 3f; + item.autoReuse = true; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + 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) + { + bool bodyExists = false; + int bodyIndex = -1; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI) + { + bodyIndex = i; + bodyExists = true; + break; + } + } + if (bodyExists) + { + Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + } + else + { + bodyIndex = Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StaffoftheFrostHydra); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/EndoHydraStaff.png b/Items/Weapons/Summon/EndoHydraStaff.png new file mode 100644 index 0000000000..6fa7f3ad9d Binary files /dev/null and b/Items/Weapons/Summon/EndoHydraStaff.png differ diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs new file mode 100644 index 0000000000..76204b8f27 --- /dev/null +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Weapons.Summon +{ + public class FuelCellBundle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fuel Cell Bundle"); + Tooltip.SetDefault("Releases a small, special variant of the plaguebringers"); + } + + public override void SetDefaults() + { + item.mana = 10; + item.damage = 50; + item.useStyle = ItemUseStyleID.SwingThrow; + item.width = 32; + item.height = 32; + item.useTime = item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item106; + item.autoReuse = true; + item.noUseGraphic = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 11f; + item.summon = 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) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/FuelCellBundle.png b/Items/Weapons/Summon/FuelCellBundle.png new file mode 100644 index 0000000000..191e5f6570 Binary files /dev/null and b/Items/Weapons/Summon/FuelCellBundle.png differ diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs new file mode 100644 index 0000000000..44214ef800 --- /dev/null +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -0,0 +1,124 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class IgneousExaltation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Igneous Exaltation"); + Tooltip.SetDefault("Summons an orbiting blade\n" + + "If this item is used when you have no free minion slots, all knives are launched towards the cursor"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 39; + item.mana = 19; + item.width = 52; + item.height = 50; + item.useTime = item.useAnimation = 30; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = 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; + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + int swordCount = 0; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) + { + swordCount++; + for (int j = 0; j < 22; j++) + { + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 6); + dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.noGravity = true; + } + } + } + float angleVariance = MathHelper.TwoPi / swordCount; + float angle = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) + { + Main.projectile[i].ai[0] = angle; + angle += angleVariance; + for (int j = 0; j < 22; j++) + { + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 6); + dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.noGravity = true; + } + } + } + float totalMinionSlots = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].minion && Main.projectile[i].owner == player.whoAmI) + { + totalMinionSlots += Main.projectile[i].minionSlots; + } + } + if (totalMinionSlots >= player.maxMinions) + { + bool hasBlades = false; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) + { + hasBlades = true; + break; + } + } + if (hasBlades) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) + { + Main.projectile[i].rotation = MathHelper.PiOver2 + MathHelper.PiOver4; + Main.projectile[i].velocity = Main.projectile[i].DirectionTo(Main.MouseWorld) * 16f; + Main.projectile[i].rotation += Main.projectile[i].velocity.ToRotation(); + Main.projectile[i].ai[0] = 180f; + Main.projectile[i].localAI[1] = 1f; + Main.projectile[i].tileCollide = true; + Main.projectile[i].netUpdate = true; + } + } + } + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(this); + r.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/IgneousExaltation.png b/Items/Weapons/Summon/IgneousExaltation.png new file mode 100644 index 0000000000..0e640a9533 Binary files /dev/null and b/Items/Weapons/Summon/IgneousExaltation.png differ diff --git a/Items/Weapons/Summon/RadiantResolution.cs b/Items/Weapons/Summon/RadiantResolution.cs new file mode 100644 index 0000000000..0e063a6a4e --- /dev/null +++ b/Items/Weapons/Summon/RadiantResolution.cs @@ -0,0 +1,91 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class RadiantResolution : ModItem + { + int radianceSlots; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Saros Possession"); + Tooltip.SetDefault("Gain absolute control over light itself\n" + + "Summons a radiant aura\n" + + "Consumes all of the remaining minion slots on use\n" + + "Increased power based on the number of minion slots used"); + } + + public override void SetDefaults() + { + item.width = 56; + item.height = 56; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.DD2_BetsyFlameBreath; + + item.summon = true; + item.mana = 100; + item.damage = 666; + item.knockBack = 3f; + item.autoReuse = true; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override void HoldItem(Player player) + { + double minionCount = 0; + for (int j = 0; j < Main.projectile.Length; j++) + { + Projectile projectile = Main.projectile[j]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + { + minionCount += projectile.minionSlots; + } + } + radianceSlots = (int)(player.maxMinions - minionCount); + } + + public override bool CanUseItem(Player player) + { + return radianceSlots >= 1; + } + + 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 < Main.projectile.Length; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + { + projectile.Kill(); + } + } + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, radianceSlots); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/RadiantResolution.png b/Items/Weapons/Summon/RadiantResolution.png new file mode 100644 index 0000000000..16ce3953f4 Binary files /dev/null and b/Items/Weapons/Summon/RadiantResolution.png differ diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 1880acdc35..232097c7f8 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Summon r.AddIngredient(ModContent.ItemType(), 5); r.AddIngredient(ItemID.ButterflyDust, 2); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); + //r.AddIngredient(ModContent.ItemType()); r.AddTile(TileID.Loom); r.SetResult(this); r.AddRecipe(); diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index ce2f94bc25..d9eb03ccf8 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon for (int j = 0; j < Main.projectile.Length; j++) { Projectile projectile = Main.projectile[j]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) + if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) { minionCount += projectile.minionSlots; } @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Summon for (int x = 0; x < Main.projectile.Length; x++) { Projectile projectile2 = Main.projectile[x]; - if (projectile2.active && projectile2.owner == player.whoAmI && projectile2.type == ModContent.ProjectileType()) + if (projectile2.active && projectile2.owner == player.whoAmI && projectile2.type == ModContent.ProjectileType() && projectile2.type != ModContent.ProjectileType()) { projectile2.Kill(); } diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 5c87dde536..6cf5135387 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Localization new [] { "ProfanedBossText", "The air is burning..." }, new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, + new [] { "ProfanedBossText4", "The Profaned Goddess has recognised your devotion to purity!" }, new [] { "GhostBossText", "The abyssal spirits have been disturbed." }, new [] { "GhostBossText2", "Wails echo through the dilapidated dungeon halls..." }, diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index f33c0e8bb0..a6741293fe 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items; using CalamityMod.Projectiles; using CalamityMod.World; using System; @@ -6,333 +7,336 @@ using Terraria; namespace CalamityMod { - public class ModCalls - { - #region Boss / Event Downed - /// - /// Returns whether the Calamity boss or event corresponding to the given string has been defeated. - /// - /// The boss or event name to check. Many aliases are accepted. - /// Whether the boss or event has been defeated. - public static bool GetBossDowned(string boss) - { - switch (boss.ToLower()) - { - default: - return false; + public class ModCalls + { + #region Boss / Event Downed + /// + /// Returns whether the Calamity boss or event corresponding to the given string has been defeated. + /// + /// The boss or event name to check. Many aliases are accepted. + /// Whether the boss or event has been defeated. + public static bool GetBossDowned(string boss) + { + switch (boss.ToLower()) + { + default: + return false; - case "desertscourge": - case "desert scourge": - return CalamityWorld.downedDesertScourge; + case "desertscourge": + case "desert scourge": + return CalamityWorld.downedDesertScourge; - case "clam": - case "giantclam": - case "giant clam": - return CalamityWorld.downedCLAM; + case "clam": + case "giantclam": + case "giant clam": + return CalamityWorld.downedCLAM; - case "crabulon": - return CalamityWorld.downedCrabulon; + case "crabulon": + return CalamityWorld.downedCrabulon; - case "hivemind": - case "hive mind": - case "thehivemind": - case "the hive mind": - return CalamityWorld.downedHiveMind; + case "hivemind": + case "hive mind": + case "thehivemind": + case "the hive mind": + return CalamityWorld.downedHiveMind; - case "perforator": - case "perforators": - case "theperforators": - case "the perforators": - case "perforatorhive": - case "perforator hive": - case "theperforatorhive": - case "the perforator hive": - return CalamityWorld.downedPerforator; + case "perforator": + case "perforators": + case "theperforators": + case "the perforators": + case "perforatorhive": + case "perforator hive": + case "theperforatorhive": + case "the perforator hive": + return CalamityWorld.downedPerforator; - case "slimegod": - case "slime god": - case "theslimegod": - case "the slime god": - return CalamityWorld.downedSlimeGod; + case "slimegod": + case "slime god": + case "theslimegod": + case "the slime god": + return CalamityWorld.downedSlimeGod; - case "cryogen": - return CalamityWorld.downedCryogen; + case "cryogen": + return CalamityWorld.downedCryogen; - case "brimstoneelemental": - case "brimstone elemental": - return CalamityWorld.downedBrimstoneElemental; + case "brimstoneelemental": + case "brimstone elemental": + return CalamityWorld.downedBrimstoneElemental; - case "calamitas": - case "clone": - case "calamitasclone": - case "calamitas clone": - case "clonelamitas": - case "calamitasdoppelganger": - case "calamitas doppelganger": - return CalamityWorld.downedCalamitas; + case "calamitas": + case "clone": + case "calamitasclone": + case "calamitas clone": + case "clonelamitas": + case "calamitasdoppelganger": + case "calamitas doppelganger": + return CalamityWorld.downedCalamitas; - case "gss": - case "greatsandshark": - case "great sand shark": - return CalamityWorld.downedGSS; + case "gss": + case "greatsandshark": + case "great sand shark": + return CalamityWorld.downedGSS; - case "siren": - case "thesiren": - case "the siren": - case "leviathan": - case "theleviathan": - case "the leviathan": - case "sirenleviathan": - case "siren leviathan": - case "sirenandleviathan": - case "siren and leviathan": - case "the siren and the leviathan": - return CalamityWorld.downedLeviathan; + case "siren": + case "thesiren": + case "the siren": + case "leviathan": + case "theleviathan": + case "the leviathan": + case "sirenleviathan": + case "siren leviathan": + case "sirenandleviathan": + case "siren and leviathan": + case "the siren and the leviathan": + return CalamityWorld.downedLeviathan; - case "aureus": - case "astrumaureus": - case "astrum aureus": - return CalamityWorld.downedAstrageldon; + case "aureus": + case "astrumaureus": + case "astrum aureus": + return CalamityWorld.downedAstrageldon; - case "pbg": - case "plaguebringer": - case "plaguebringergoliath": - case "plaguebringer goliath": - case "theplaguebringergoliath": - case "the plaguebringer goliath": - return CalamityWorld.downedPlaguebringer; + case "pbg": + case "plaguebringer": + case "plaguebringergoliath": + case "plaguebringer goliath": + case "theplaguebringergoliath": + case "the plaguebringer goliath": + return CalamityWorld.downedPlaguebringer; - case "ravager": - return CalamityWorld.downedScavenger; + case "scavenger": // backwards compatibility + case "ravager": + return CalamityWorld.downedScavenger; - case "astrumdeus": - case "astrum deus": - return CalamityWorld.downedStarGod; + case "stargod": // backwards compatibility + case "star god": // backwards compatibility + case "astrumdeus": + case "astrum deus": + return CalamityWorld.downedStarGod; - case "guardians": - case "donuts": - case "profanedguardians": - case "profaned guardians": - case "theprofanedguardians": - case "the profaned guardians": - return CalamityWorld.downedGuardians; + case "guardians": + case "donuts": + case "profanedguardians": + case "profaned guardians": + case "theprofanedguardians": + case "the profaned guardians": + return CalamityWorld.downedGuardians; - case "bumblebirb": - case "bumblefuck": - return CalamityWorld.downedBumble; + case "bumblebirb": + case "bumblefuck": + return CalamityWorld.downedBumble; - case "providence": - case "providencetheprofanedgoddess": - case "providence the profaned goddess": - case "providence, the profaned goddess": - return CalamityWorld.downedProvidence; + case "providence": + case "providencetheprofanedgoddess": + case "providence the profaned goddess": + case "providence, the profaned goddess": + return CalamityWorld.downedProvidence; - case "polterghast": - case "necroghast": - case "necroplasm": - return CalamityWorld.downedPolterghast; + case "polterghast": + case "necroghast": + case "necroplasm": + return CalamityWorld.downedPolterghast; - case "sentinel1": // backwards compatibility - case "void": - case "ceaselessvoid": - case "ceaseless void": - return CalamityWorld.downedSentinel1; + case "sentinel1": // backwards compatibility + case "void": + case "ceaselessvoid": + case "ceaseless void": + return CalamityWorld.downedSentinel1; - case "sentinel2": // backwards compatibility - case "stormweaver": - case "storm weaver": - return CalamityWorld.downedSentinel2; + case "sentinel2": // backwards compatibility + case "stormweaver": + case "storm weaver": + return CalamityWorld.downedSentinel2; - case "sentinel3": // backwards compatibility - case "cosmicwraith": - case "cosmic wraith": - case "signus": - case "signusenvoyofthedevourer": - case "signus envoy of the devourer": - case "signus, envoy of the devourer": - return CalamityWorld.downedSentinel3; + case "sentinel3": // backwards compatibility + case "cosmicwraith": + case "cosmic wraith": + case "signus": + case "signusenvoyofthedevourer": + case "signus envoy of the devourer": + case "signus, envoy of the devourer": + return CalamityWorld.downedSentinel3; - case "sentinelany": // backwards compatibility - case "anysentinel": - case "any sentinel": - case "onesentinel": - case "one sentinel": - case "sentinel": - return CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3; + case "sentinelany": // backwards compatibility + case "anysentinel": + case "any sentinel": + case "onesentinel": + case "one sentinel": + case "sentinel": + return CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3; - case "sentinelall": // backwards compatibility - case "sentinels": - case "allsentinel": - case "allsentinels": - case "all sentinels": - return CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + case "sentinelall": // backwards compatibility + case "sentinels": + case "allsentinel": + case "allsentinels": + case "all sentinels": + return CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; - case "dog": - case "devourerofgods": - case "devourer of gods": - case "thedevourerofgods": - case "the devourer of gods": - return CalamityWorld.downedDoG; + case "dog": + case "devourerofgods": + case "devourer of gods": + case "thedevourerofgods": + case "the devourer of gods": + return CalamityWorld.downedDoG; - case "darksun": - case "darksuneclipse": - case "darksun eclipse": - case "buffedeclipse": - case "buffed eclipse": - case "mothron": - case "darksunmothron": - case "darksun mothron": - case "buffedmothron": - case "buffed mothron": - return CalamityWorld.downedBuffedMothron; + case "darksun": + case "darksuneclipse": + case "darksun eclipse": + case "buffedeclipse": + case "buffed eclipse": + case "mothron": + case "darksunmothron": + case "darksun mothron": + case "buffedmothron": + case "buffed mothron": + return CalamityWorld.downedBuffedMothron; - case "yharon": - case "jungledragonyharon": - case "jungle dragon yharon": - case "jungle dragon, yharon": - return CalamityWorld.downedYharon; + case "yharon": + case "jungledragonyharon": + case "jungle dragon yharon": + case "jungle dragon, yharon": + return CalamityWorld.downedYharon; - case "scal": - case "supremecalamitas": - case "supreme calamitas": - return CalamityWorld.downedSCal; - } - } - #endregion + case "scal": + case "supremecalamitas": + case "supreme calamitas": + return CalamityWorld.downedSCal; + } + } + #endregion - #region Player in Zone / Area - /// - /// Returns whether the specified player is in the Calamity biome or area corresponding to the given string. - /// - /// The player whose locale is being questioned. - /// The zone or area name to check. Many aliases are accepted. - /// Whether the player is currently in the zone. - public static bool GetInZone(Player p, string zone) - { - CalamityPlayer mp = p.Calamity(); - switch (zone.ToLower()) - { - default: - return false; + #region Player in Zone / Area + /// + /// Returns whether the specified player is in the Calamity biome or area corresponding to the given string. + /// + /// The player whose locale is being questioned. + /// The zone or area name to check. Many aliases are accepted. + /// Whether the player is currently in the zone. + public static bool GetInZone(Player p, string zone) + { + CalamityPlayer mp = p.Calamity(); + switch (zone.ToLower()) + { + default: + return false; - case "calamity": // backwards compatibility - case "calamitybiome": - case "calamity biome": - case "crag": - case "crags": + case "calamity": // backwards compatibility + case "calamitybiome": + case "calamity biome": + case "crag": + case "crags": - case "profanedcrag": // remove these four when the actual profaned biome is added - case "profaned crag": - case "profanedcrags": - case "profaned crags": + case "profanedcrag": // remove these four when the actual profaned biome is added + case "profaned crag": + case "profanedcrags": + case "profaned crags": - case "brimstone": - case "brimstonecrag": - case "brimstone crag": - case "brimstonecrags": - case "brimstone crags": - return mp.ZoneCalamity; + case "brimstone": + case "brimstonecrag": + case "brimstone crag": + case "brimstonecrags": + case "brimstone crags": + return mp.ZoneCalamity; - case "astral": - case "astralbiome": - case "astral biome": - case "astralinfection": - case "astral infection": - return mp.ZoneAstral; + case "astral": + case "astralbiome": + case "astral biome": + case "astralinfection": + case "astral infection": + return mp.ZoneAstral; - case "sunkensea": - case "sunken sea": - case "thesunkensea": - case "the sunken sea": - return mp.ZoneSunkenSea; + case "sunkensea": + case "sunken sea": + case "thesunkensea": + case "the sunken sea": + return mp.ZoneSunkenSea; - case "sulfur": - case "sulphur": - case "sulfursea": - case "sulfur sea": - case "sulphursea": - case "sulphur sea": - case "sulfuroussea": - case "sulfurous sea": - case "sulphuroussea": - case "sulphurous sea": - return mp.ZoneSulphur; + case "sulfur": + case "sulphur": + case "sulfursea": + case "sulfur sea": + case "sulphursea": + case "sulphur sea": + case "sulfuroussea": + case "sulfurous sea": + case "sulphuroussea": + case "sulphurous sea": + return mp.ZoneSulphur; - case "abyss": - case "theabyss": - case "the abyss": - case "anyabyss": - case "any abyss": - case "abyssany": - case "any abyss layer": - return mp.ZoneAbyss; + case "abyss": + case "theabyss": + case "the abyss": + case "anyabyss": + case "any abyss": + case "abyssany": + case "any abyss layer": + return mp.ZoneAbyss; - case "abyss1": - case "abyss 1": - case "abyss_1": - case "layer1": - case "layer 1": - case "layer_1": - case "abysslayer1": - case "abyss layer 1": - return mp.ZoneAbyssLayer1; + case "abyss1": + case "abyss 1": + case "abyss_1": + case "layer1": + case "layer 1": + case "layer_1": + case "abysslayer1": + case "abyss layer 1": + return mp.ZoneAbyssLayer1; - case "abyss2": - case "abyss 2": - case "abyss_2": - case "layer2": - case "layer 2": - case "layer_2": - case "abysslayer2": - case "abyss layer 2": - return mp.ZoneAbyssLayer2; + case "abyss2": + case "abyss 2": + case "abyss_2": + case "layer2": + case "layer 2": + case "layer_2": + case "abysslayer2": + case "abyss layer 2": + return mp.ZoneAbyssLayer2; - case "abyss3": - case "abyss 3": - case "abyss_3": - case "layer3": - case "layer 3": - case "layer_3": - case "abysslayer3": - case "abyss layer 3": - return mp.ZoneAbyssLayer3; + case "abyss3": + case "abyss 3": + case "abyss_3": + case "layer3": + case "layer 3": + case "layer_3": + case "abysslayer3": + case "abyss layer 3": + return mp.ZoneAbyssLayer3; - case "abyss4": - case "abyss 4": - case "abyss_4": - case "layer4": - case "layer 4": - case "layer_4": - case "abysslayer4": - case "abyss layer 4": - return mp.ZoneAbyssLayer4; - } - } - #endregion + case "abyss4": + case "abyss 4": + case "abyss_4": + case "layer4": + case "layer 4": + case "layer_4": + case "abysslayer4": + case "abyss layer 4": + return mp.ZoneAbyssLayer4; + } + } + #endregion - #region Difficulty Modes - /// - /// Returns whether the Calamity difficulty modifier corresponding to the given string is currently active. - /// - /// The difficulty modifier to check for. - /// Whether the difficulty is currently active. - public static bool GetDifficultyActive(string difficulty) - { - switch (difficulty.ToLower()) - { - default: - return false; + #region Difficulty Modes + /// + /// Returns whether the Calamity difficulty modifier corresponding to the given string is currently active. + /// + /// The difficulty modifier to check for. + /// Whether the difficulty is currently active. + public static bool GetDifficultyActive(string difficulty) + { + switch (difficulty.ToLower()) + { + default: + return false; - case "revengeance": - case "rev": - case "revengeancemode": - case "revengeance mode": - return CalamityWorld.revenge; + case "revengeance": + case "rev": + case "revengeancemode": + case "revengeance mode": + return CalamityWorld.revenge; - case "death": - case "deathmode": - case "death mode": - return CalamityWorld.death; + case "death": + case "deathmode": + case "death mode": + return CalamityWorld.death; case "br": case "bossrush": @@ -342,53 +346,53 @@ namespace CalamityMod return CalamityWorld.bossRushActive; case "defiled": - case "defiledrune": - case "defiled rune": - case "defiledmode": - case "defiled mode": - return CalamityWorld.defiled; + case "defiledrune": + case "defiled rune": + case "defiledmode": + case "defiled mode": + return CalamityWorld.defiled; - case "armageddon": - case "arma": - case "instakill": - case "instagib": - case "armageddonmode": - case "armageddon mode": - return CalamityWorld.armageddon; + case "armageddon": + case "arma": + case "instakill": + case "instagib": + case "armageddonmode": + case "armageddon mode": + return CalamityWorld.armageddon; - case "ironheart": - case "iron heart": - case "steelsoul": - case "steel soul": - case "permadeath": - return CalamityWorld.ironHeart; - } - } + case "ironheart": + case "iron heart": + case "steelsoul": + case "steel soul": + case "permadeath": + return CalamityWorld.ironHeart; + } + } - /// - /// Either enables or disables the Calamity difficulty modifier corresponding to the given string.

- /// Unlike the in-game mode changing items, this has no ancillary effects such as failing if a boss is alive or instantly killing players. - ///
- /// The difficulty modifier to edit. - /// Whether to enable or disable the difficulty. - /// - public static bool SetDifficultyActive(string difficulty, bool enabled) - { - switch (difficulty.ToLower()) - { - default: - return false; + /// + /// Either enables or disables the Calamity difficulty modifier corresponding to the given string.

+ /// Unlike the in-game mode changing items, this has no ancillary effects such as failing if a boss is alive or instantly killing players. + ///
+ /// The difficulty modifier to edit. + /// Whether to enable or disable the difficulty. + /// + public static bool SetDifficultyActive(string difficulty, bool enabled) + { + switch (difficulty.ToLower()) + { + default: + return false; - case "revengeance": - case "rev": - case "revengeancemode": - case "revengeance mode": - return CalamityWorld.revenge = enabled; + case "revengeance": + case "rev": + case "revengeancemode": + case "revengeance mode": + return CalamityWorld.revenge = enabled; - case "death": - case "deathmode": - case "death mode": - return CalamityWorld.death = enabled; + case "death": + case "deathmode": + case "death mode": + return CalamityWorld.death = enabled; case "br": case "bossrush": @@ -398,1133 +402,1160 @@ namespace CalamityMod return CalamityWorld.bossRushActive = enabled; case "defiled": - case "defiledrune": - case "defiled rune": - case "defiledmode": - case "defiled mode": - return CalamityWorld.defiled = enabled; - - case "armageddon": - case "arma": - case "instakill": - case "instagib": - case "armageddonmode": - case "armageddon mode": - return CalamityWorld.armageddon = enabled; - - case "ironheart": - case "iron heart": - case "steelsoul": - case "steel soul": - case "permadeath": - return CalamityWorld.ironHeart = enabled; - } - } - #endregion - - #region Rogue Class - /// - /// Gets a player's current rogue damage stat. - /// - /// The player whose rogue damage is being queried. - /// Current rogue damage boost. 1f is no bonus, 2f is +100%. - public static float GetRogueDamage(Player p) => p?.Calamity()?.throwingDamage ?? 1f; - - /// - /// Adds a flat amount of rogue damage stat to a player. This amount can be negative. - /// - /// The player whose rogue damage is being modified. - /// The amount of rogue damage to add or subtract (if negative). - /// The player's new rogue damage stat. - public static float AddRogueDamage(Player p, float add) => p is null ? 1f : (p.Calamity().throwingDamage += add); - - /// - /// Gets a player's current rogue critical strike chance. - /// - /// The player whose rogue crit is being queried. - /// Current rogue critical strike chance. 0 is no additional crit, 8 is +8% crit chance. - public static int GetRogueCrit(Player p) => p?.Calamity()?.throwingCrit ?? 0; - - /// - /// Adds a flat amount of rogue crit to a player. This amount can be negative. - /// - /// The player whose rogue crit is being modified. - /// The amount of rogue crit to add or subtract (if negative). - /// The player's new rogue crit stat. - public static int AddRogueCrit(Player p, int add) => p is null ? 0 : (p.Calamity().throwingCrit += add); - - /// - /// Gets a player's current rogue projectile velocity multiplier. - /// - /// The player whose rogue velocity is being queried. - /// Current rogue projectile velocity multiplier. 1f is no bonus, 2f doubles projectile speed. - public static float GetRogueVelocity(Player p) => p?.Calamity()?.throwingVelocity ?? 1f; - - /// - /// Adds a flat amount of rogue velocity stat to a player. This amount can be negative. - /// - /// The player whose rogue velocity is being modified. - /// The amount of rogue velocity to add or subtract (if negative). - /// The player's new rogue velocity stat. - public static float AddRogueVelocity(Player p, float add) => p is null ? 1f : (p.Calamity().throwingVelocity += add); - - public static float GetCurrentStealth(Player p) => p?.Calamity()?.rogueStealth ?? 0f; - - public static float GetMaxStealth(Player p) => p?.Calamity()?.rogueStealthMax ?? 0f; - - public static float AddMaxStealth(Player p, float add) => p is null ? 0f : (p.Calamity().rogueStealthMax += add); - - /// - /// Gets whether the given projectile is classified as rogue. - /// - /// The projectile which is being checked. - /// Whether the projectile is rogue. - public static bool IsRogue(Projectile p) - { - if (p is null || p.Calamity() is null) - return false; - CalamityGlobalProjectile cgp = p.Calamity(); - return cgp.rogue | cgp.forceRogue; - } - - /// - /// Sets whether the given projectile is classified as rogue. If set to true, also forces the projectile to be rogue every single frame. - /// - /// The projectile whose rogue classification is being toggled. - /// The value to apply. - /// Whether the projectile is now rogue. - public static bool SetRogue(Projectile p, bool isRogue) - { - if (p is null || p.Calamity() is null) - return false; - CalamityGlobalProjectile cgp = p.Calamity(); - cgp.forceRogue = cgp.rogue = isRogue; - return cgp.rogue; - } - #endregion - - #region Player Armor Set Bonuses - /// - /// Returns whether the specified player has the set bonus corresponding to the given string. - /// - /// The player whose set bonuses are being questioned. - /// The set bonus to check for. - /// Whether the player currently has the set bonus. - public static bool GetSetBonus(Player p, string setBonus) - { - CalamityPlayer mp = p.Calamity(); - - setBonus = setBonus.ToLower(); - - // LATER -- no summon set bonuses are written well. all use two bools, neither of which actually controls the function - - // Victide - if (setBonus == "victide_summon" || setBonus == "victide summon") - return mp.urchin; // the bool set directly by VictideHelmet.UpdateArmorSet - else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) - return mp.victideSet; - - // Aerospec - if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") - return mp.valkyrie; // the bool set directly by AerospecHelmet.UpdateArmorSet - else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) - return mp.aeroSet; - - // Statigel - if (setBonus == "statigel_summon" || setBonus == "statigel summon") - return mp.slimeGod; // the bool set directly by StatigelHood.UpdateArmorSet - if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) - return mp.statigelSet; - - // Mollusk - if (setBonus == "mollusk") - return mp.molluskSet; - - // Daedalus - switch (setBonus) - { - default: - break; - case "daedalus": - return mp.daedalusReflect || mp.daedalusShard || mp.daedalusAbsorb || mp.daedalusCrystal || mp.daedalusSplit; - case "daedalus_melee": - case "daedalus melee": - return mp.daedalusReflect; - case "daedalus_ranged": - case "daedalus ranged": - return mp.daedalusShard; - case "daedalus_magic": - case "daedalus magic": - return mp.daedalusAbsorb; - case "daedalus_summon": - case "daedalus summon": - return mp.daedalusCrystal; - case "daedalus_rogue": - case "daedalus rogue": - return mp.daedalusSplit; - } - - // Reaver - switch (setBonus) - { - default: - break; - case "reaver": - return mp.reaverBlast || mp.reaverDoubleTap || mp.reaverBurst || mp.reaverOrb || mp.reaverSpore; - case "reaver_melee": - case "reaver melee": - return mp.reaverBlast; - case "reaver_ranged": - case "reaver ranged": - return mp.reaverDoubleTap; - case "reaver_magic": - case "reaver magic": - return mp.reaverBurst; - case "reaver_summon": - case "reaver summon": - return mp.reaverOrb; - case "reaver_rogue": - case "reaver rogue": - return mp.reaverSpore; - } - - // Umbraphile - if (setBonus == "umbraphile") - return mp.umbraphileSet; - - // Ataxia - switch (setBonus) - { - default: - break; - case "ataxia": - return mp.ataxiaBlaze; - case "ataxia_melee": - case "ataxia melee": - return mp.ataxiaGeyser; - case "ataxia_ranged": - case "ataxia ranged": - return mp.ataxiaBolt; - case "ataxia_magic": - case "ataxia magic": - return mp.ataxiaMage; - case "ataxia_summon": - case "ataxia summon": - return mp.chaosSpirit; - case "ataxia_rogue": - case "ataxia rogue": - return mp.ataxiaVolley; - } - - // Plague Reaper - if (setBonus == "plaguereaper" || setBonus == "plague reaper") - return mp.plagueReaper; - - // Astral - if (setBonus == "astral") - return mp.astralStarRain; - - // Xeroc - if (setBonus == "xeroc") - return mp.xerocSet; - - // Tarragon - switch (setBonus) - { - default: - break; - case "tarragon": - return mp.tarraSet; - case "tarragon_melee": - case "tarragon melee": - return mp.tarraMelee; - case "tarragon_ranged": - case "tarragon ranged": - return mp.tarraRanged; - case "tarragon_magic": - case "tarragon magic": - return mp.tarraMage; - case "tarragon_summon": - case "tarragon summon": - return mp.tarraSummon; - case "tarragon_rogue": - case "tarragon rogue": - return mp.tarraThrowing; - } - - // Bloodflare - switch (setBonus) - { - default: - break; - case "bloodflare": - return mp.bloodflareSet; - case "bloodflare_melee": - case "bloodflare melee": - return mp.bloodflareMelee; - case "bloodflare_ranged": - case "bloodflare ranged": - return mp.bloodflareRanged; - case "bloodflare_magic": - case "bloodflare magic": - return mp.bloodflareMage; - case "bloodflare_summon": - case "bloodflare summon": - return mp.bloodflareSummon; - case "bloodflare_rogue": - case "bloodflare rogue": - return mp.bloodflareThrowing; - } - - // Omega Blue - if (setBonus == "omegablue" || setBonus == "omega blue") - return mp.omegaBlueSet; - - // God Slayer - switch (setBonus) - { - default: - break; - case "godslayer": - case "god slayer": - return mp.godSlayer; - case "godslayer_melee": - case "godslayer melee": - case "god slayer melee": - return mp.godSlayerDamage; // melee helm's unique damage reducing property - case "godslayer_ranged": - case "godslayer ranged": - case "god slayer ranged": - return mp.godSlayerRanged; - case "godslayer_magic": - case "godslayer magic": - case "god slayer magic": - return mp.godSlayerMage; - case "godslayer_summon": - case "godslayer summon": - case "god slayer summon": - return mp.godSlayerSummon; - case "godslayer_rogue": - case "godslayer rogue": - case "god slayer rogue": - return mp.godSlayerThrowing; - } - - // Fearmonger - if (setBonus == "fearmonger") - return mp.fearmongerSet; - - // Silva - switch (setBonus) - { - default: - break; - case "silva": - return mp.silvaSet; - case "silva_melee": - case "silva melee": - return mp.silvaMelee; - case "silva_ranged": - case "silva ranged": - return mp.silvaRanged; - case "silva_magic": - case "silva magic": - return mp.silvaMage; - case "silva_summon": - case "silva summon": - return mp.silvaSummon; - case "silva_rogue": - case "silva rogue": - return mp.silvaThrowing; - } - - // Auric Tesla - if (setBonus == "auric" || setBonus == "aurictesla" || setBonus == "auric tesla") - return mp.auricSet; - - // Demonshade - if (setBonus == "demonshade") - return mp.dsSetBonus; - - return false; - } - - /// - /// Turns the set bonus corresponding to the given string on or off for the specified player. - /// - /// The player whose set bonuses are being toggled. - /// The set bonus to check for. - /// Whether the set bonus should be enabled (true) or disabled (false). - /// Whether any set bonus was adjusted. - public static bool SetSetBonus(Player p, string setBonus, bool enabled) - { - CalamityPlayer mp = p.Calamity(); - setBonus = setBonus.ToLower(); - - // Victide - if (setBonus == "victide_summon" || setBonus == "victide summon") - { - mp.victideSet = enabled; - mp.urchin = enabled; // LATER -- remove this when player.urchin actually controls victide summoner - return true; - } - else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) - { - mp.victideSet = true; - return true; - } - - // Aerospec - if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") - { - mp.aeroSet = enabled; - mp.valkyrie = enabled; // LATER -- remove this when player.valkyrie actually controls aerospec summoner - return true; - } - else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) - { - mp.aeroSet = enabled; - return true; - } - - // Statigel - if (setBonus == "statigel_summon" || setBonus == "statigel summon") - { - mp.statigelSet = enabled; - mp.slimeGod = enabled; // LATER -- remove this when player.slimeGod actually controls statigel summoner - return true; - } - else if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) - { - mp.statigelSet = enabled; - return true; - } - - // Mollusk - if (setBonus == "mollusk") - { - mp.molluskSet = enabled; - return true; - } - - // Daedalus - switch (setBonus) - { - default: - break; - case "daedalus_melee": - case "daedalus melee": - mp.daedalusReflect = enabled; - return true; - case "daedalus_ranged": - case "daedalus ranged": - mp.daedalusShard = enabled; - return true; - case "daedalus_magic": - case "daedalus magic": - mp.daedalusAbsorb = enabled; - return true; - case "daedalus_summon": - case "daedalus summon": - mp.daedalusCrystal = enabled; // LATER -- remove this when player.daedalusCrystal actually controls daedalus summoner - return true; - case "daedalus_rogue": - case "daedalus rogue": - mp.daedalusSplit = enabled; - return true; - } - - // Reaver - switch (setBonus) - { - default: - break; - case "reaver_melee": - case "reaver melee": - mp.reaverBlast = enabled; - return true; - case "reaver_ranged": - case "reaver ranged": - mp.reaverDoubleTap = enabled; - return true; - case "reaver_magic": - case "reaver magic": - mp.reaverBurst = enabled; - return true; - case "reaver_summon": - case "reaver summon": - mp.reaverOrb = enabled; // LATER -- remove this when player.reaverOrb actually controls reaver summoner - return true; - case "reaver_rogue": - case "reaver rogue": - mp.reaverSpore = enabled; - return true; - } - - // Umbraphile - if (setBonus == "umbraphile") - { - mp.umbraphileSet = enabled; - return true; - } - - // Ataxia - switch (setBonus) - { - default: - break; - case "ataxia": - mp.ataxiaBlaze = enabled; - return true; - case "ataxia_melee": - case "ataxia melee": - mp.ataxiaBlaze = enabled; - mp.ataxiaGeyser = enabled; - return true; - case "ataxia_ranged": - case "ataxia ranged": - mp.ataxiaBlaze = enabled; - mp.ataxiaBolt = enabled; - return true; - case "ataxia_magic": - case "ataxia magic": - mp.ataxiaBlaze = enabled; - mp.ataxiaMage = enabled; - return true; - case "ataxia_summon": - case "ataxia summon": - mp.ataxiaBlaze = enabled; - mp.chaosSpirit = enabled; // LATER -- remove this when player.chaosSpirit actually controls ataxia summoner - return true; - case "ataxia_rogue": - case "ataxia rogue": - mp.ataxiaBlaze = enabled; - mp.ataxiaVolley = enabled; - return true; - } - - // Plague Reaper - if (setBonus == "plaguereaper" || setBonus == "plague reaper") - { - mp.plagueReaper = enabled; - return true; - } - - // Astral - if (setBonus == "astral") - { - mp.astralStarRain = enabled; - return true; - } - - // Xeroc - if (setBonus == "xeroc") - { - mp.xerocSet = enabled; - return true; - } - - // Tarragon - switch (setBonus) - { - default: - break; - case "tarragon": - mp.tarraSet = enabled; - return true; - case "tarragon_melee": - case "tarragon melee": - mp.tarraSet = enabled; - mp.tarraMelee = enabled; - return true; - case "tarragon_ranged": - case "tarragon ranged": - mp.tarraSet = enabled; - mp.tarraRanged = enabled; - return true; - case "tarragon_magic": - case "tarragon magic": - mp.tarraSet = enabled; - mp.tarraMage = enabled; - return true; - case "tarragon_summon": - case "tarragon summon": - mp.tarraSet = enabled; - mp.tarraSummon = enabled; // LATER -- remove this when player.tarraSummon actually controls life aura - return true; - case "tarragon_rogue": - case "tarragon rogue": - mp.tarraSet = enabled; - mp.tarraThrowing = enabled; - return true; - } - - // Bloodflare - switch (setBonus) - { - default: - break; - case "bloodflare": - mp.bloodflareSet = enabled; - return true; - case "bloodflare_melee": - case "bloodflare melee": - mp.bloodflareSet = enabled; - mp.bloodflareMelee = enabled; - return true; - case "bloodflare_ranged": - case "bloodflare ranged": - mp.bloodflareSet = enabled; - mp.bloodflareRanged = enabled; - return true; - case "bloodflare_magic": - case "bloodflare magic": - mp.bloodflareSet = enabled; - mp.bloodflareMage = enabled; - return true; - case "bloodflare_summon": - case "bloodflare summon": - mp.bloodflareSet = enabled; - mp.bloodflareSummon = enabled; // LATER -- remove this when player.bloodflareSummon actually controls bloodflare orbs - return true; - case "bloodflare_rogue": - case "bloodflare rogue": - mp.bloodflareSet = enabled; - mp.bloodflareThrowing = enabled; - return true; - } - - // Omega Blue - if (setBonus == "omegablue" || setBonus == "omega blue") - { - mp.omegaBlueSet = enabled; - return true; - } - - // God Slayer - switch (setBonus) - { - default: - break; - case "godslayer": - case "god slayer": - mp.godSlayer = enabled; - return true; - case "godslayer_melee": - case "godslayer melee": - case "god slayer melee": - mp.godSlayer = enabled; - mp.godSlayerDamage = enabled; // melee helm's unique damage reducing property - return true; - case "godslayer_ranged": - case "godslayer ranged": - case "god slayer ranged": - mp.godSlayer = enabled; - mp.godSlayerRanged = enabled; - return true; - case "godslayer_magic": - case "godslayer magic": - case "god slayer magic": - mp.godSlayer = enabled; - mp.godSlayerMage = enabled; - return true; - case "godslayer_summon": - case "godslayer summon": - case "god slayer summon": - mp.godSlayer = enabled; - mp.godSlayerSummon = enabled; // LATER -- remove this when player.godSlayerSummon actually controls mechworm - return true; - case "godslayer_rogue": - case "godslayer rogue": - case "god slayer rogue": - mp.godSlayer = enabled; - mp.godSlayerThrowing = enabled; - return true; - } - - // Fearmonger - if (setBonus == "fearmonger") - { - mp.fearmongerSet = enabled; - return true; - } - - // Silva - switch (setBonus) - { - default: - break; - case "silva": - mp.silvaSet = enabled; - return true; - case "silva_melee": - case "silva melee": - mp.silvaSet = enabled; - mp.silvaMelee = enabled; - return true; - case "silva_ranged": - case "silva ranged": - mp.silvaSet = enabled; - mp.silvaRanged = enabled; - return true; - case "silva_magic": - case "silva magic": - mp.silvaSet = enabled; - mp.silvaMage = enabled; - return true; - case "silva_summon": - case "silva summon": - mp.silvaSet = enabled; - mp.silvaSummon = enabled; // LATER -- remove this when player.silvaSummon actually controls silva crystal - return true; - case "silva_rogue": - case "silva rogue": - mp.silvaSet = enabled; - mp.silvaThrowing = enabled; - return true; - } - - // Auric Tesla (includes all components) - switch (setBonus) - { - default: - break; - case "auric": - case "aurictesla": - case "auric tesla": - mp.tarraSet = enabled; - mp.bloodflareSet = enabled; - mp.godSlayer = enabled; - mp.silvaSet = enabled; - mp.auricSet = enabled; - return true; - case "auric_melee": - case "auric melee": - case "aurictesla_melee": - case "aurictesla melee": - case "auric tesla melee": - mp.tarraSet = enabled; - mp.tarraMelee = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareMelee = enabled; - mp.godSlayer = enabled; - mp.godSlayerDamage = enabled; - mp.silvaSet = enabled; - mp.silvaMelee = enabled; - mp.auricSet = enabled; - return true; - case "auric_ranged": - case "auric ranged": - case "aurictesla_ranged": - case "aurictesla ranged": - case "auric tesla ranged": - mp.tarraSet = enabled; - mp.tarraRanged = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareRanged = enabled; - mp.godSlayer = enabled; - mp.godSlayerRanged = enabled; - mp.silvaSet = enabled; - mp.silvaRanged = enabled; - mp.auricSet = enabled; - return true; - case "auric_magic": - case "auric magic": - case "aurictesla_magic": - case "aurictesla magic": - case "auric tesla magic": - mp.tarraSet = enabled; - mp.tarraMage = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareMage = enabled; - mp.godSlayer = enabled; - mp.godSlayerMage = enabled; - mp.silvaSet = enabled; - mp.silvaMage = enabled; - mp.auricSet = enabled; - return true; - case "auric_summon": - case "auric summon": - case "aurictesla_summon": - case "aurictesla summon": - case "auric tesla summon": - mp.tarraSet = enabled; - mp.tarraSummon = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareSummon = enabled; - mp.godSlayer = enabled; - mp.godSlayerSummon = enabled; - mp.silvaSet = enabled; - mp.silvaSummon = enabled; - mp.auricSet = enabled; - return true; - case "auric_rogue": - case "auric rogue": - case "aurictesla_rogue": - case "aurictesla rogue": - case "auric tesla rogue": - mp.tarraSet = enabled; - mp.tarraThrowing = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareThrowing = enabled; - mp.godSlayer = enabled; - mp.godSlayerThrowing = enabled; - mp.silvaSet = enabled; - mp.silvaThrowing = enabled; - mp.auricSet = enabled; - return true; - } - - // Demonshade - if (setBonus == "demonshade") - { - mp.dsSetBonus = enabled; - mp.rDevil = enabled; // LATER -- remove this when player.rDevil controls demonshade summoned minion - return true; - } - - return false; - } - #endregion - - #region Other Player Stats - public static int GetLightStrength(Player p) => p?.Calamity()?.GetTotalLightStrength() ?? 0; - - public static void AddAbyssLightStrength(Player p, int add) - { - if (p != null) - p.Calamity().externalAbyssLight += add; - } - - public static bool MakeColdImmune(Player p) => p is null ? false : (p.Calamity().externalColdImmunity = true); - public static bool MakeHeatImmune(Player p) => p is null ? false : (p.Calamity().externalHeatImmunity = true); - #endregion - - #region Set Damage Reduction - public static float SetDamageReduction(int npcID, float dr) - { - CalamityMod.DRValues.TryGetValue(npcID, out float oldDR); - CalamityMod.DRValues.Remove(npcID); - CalamityMod.DRValues.Add(npcID, dr); - return oldDR; - } - #endregion - - #region Boss Health Bars - public static bool BossHealthBarVisible() => Main.LocalPlayer.Calamity().drawBossHPBar; - - public static bool SetBossHealthBarVisible(bool visible) => Main.LocalPlayer.Calamity().drawBossHPBar = visible; - #endregion - - #region Call - public static object Call(params object[] args) - { - bool isValidPlayerArg(object o) => o is int || o is Player; - bool isValidProjectileArg(object o) => o is int || o is Projectile; - - Player castPlayer(object o) - { - if (o is int i) - return Main.player[i]; - else if (o is Player p) - return p; - return null; - } - - Projectile castProjectile(object o) - { - if (o is int i) - return Main.projectile[i]; - else if (o is Projectile p) - return p; - return null; - } - - if (args is null || args.Length <= 0) - return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); - if (!(args[0] is string)) - return new ArgumentException("ERROR: First argument must be a string function name."); - - string methodName = args[0].ToString(); - switch (methodName) - { - case "Downed": - case "GetDowned": - case "BossDowned": - case "GetBossDowned": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a boss or event name as a string."); - if (!(args[1] is string)) - return new ArgumentException("ERROR: The argument to \"Downed\" must be a string."); - return GetBossDowned(args[1].ToString()); - - case "Zone": - case "GetZone": - case "InZone": - case "GetInZone": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a zone name as a string."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a zone name as a string."); - if (!(args[2] is string)) - return new ArgumentException("ERROR: The second argument to \"InZone\" must be a string."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"InZone\" must be a Player or an int."); - return GetInZone(castPlayer(args[1]), args[2].ToString()); - - case "Difficulty": - case "GetDifficulty": - case "DifficultyActive": - case "GetDifficultyActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a difficulty mode name as a string."); - if (!(args[1] is string)) - return new ArgumentException("ERROR: The argument to \"Difficulty\" must be a string."); - return GetDifficultyActive(args[1].ToString()); - - case "SetDifficulty": - case "SetDifficultyActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a difficulty mode name as a string and a bool."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a bool."); - if (!(args[2] is bool enabled)) - return new ArgumentException("ERROR: The second argument to \"SetDifficulty\" must be a bool."); - if (!(args[1] is string)) - return new ArgumentException("ERROR: The first argument to \"SetDifficulty\" must be a string."); - return SetDifficultyActive(args[1].ToString(), enabled); - - case "GetLight": - case "GetLightLevel": - case "GetLightStrength": - case "GetAbyssLight": - case "GetAbyssLightLevel": - case "GetAbyssLightStrength": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if(!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"GetLightStrength\" must be a Player or an int."); - return GetLightStrength(castPlayer(args[1])); - - case "AddLight": - case "AddLightLevel": - case "AddLightStrength": - case "AddAbyssLight": - case "AddAbyssLightLevel": - case "AddAbyssLightStrength": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and light strength change as an int."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify light strength change as an int."); - if (!(args[2] is int light)) - return new ArgumentException("ERROR: The second argument to \"AddLightStrength\" must be an int."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddLightStrength\" must be a Player or an int."); - AddAbyssLightStrength(castPlayer(args[1]), light); - return null; - - case "ColdImmune": - case "ColdImmunity": - case "GiveColdImmunity": - case "MakeColdImmune": - case "DeathModeCold": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"DeathModeCold\" must be a Player or an int."); - return MakeColdImmune(castPlayer(args[1])); - - case "HeatImmune": - case "HeatImmunity": - case "GiveHeatImmunity": - case "MakeHeatImmune": - case "DeathModeHeat": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"DeathModeHeat\" must be a Player or an int."); - return MakeHeatImmune(castPlayer(args[1])); - - case "GetRogueDamage": - case "GetRogueDmg": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"GetRogueDamage\" must be a Player or an int."); - return GetRogueDamage(castPlayer(args[1])); - - case "GetRogueCrit": - case "GetRogueCritChance": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"GetRogueCrit\" must be a Player or an int."); - return GetRogueCrit(castPlayer(args[1])); - - case "GetRogueVelocity": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The argument to \"GetRogueVelocity\" must be a Player or an int."); - return GetRogueVelocity(castPlayer(args[1])); - - case "AddRogueDamage": - case "AddRogueDmg": - case "ModifyRogueDamage": - case "ModifyRogueDmg": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue damage change as a float."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify rogue damage change as a float."); - if (!(args[2] is float damage)) - return new ArgumentException("ERROR: The second argument to \"AddRogueDamage\" must be a float."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddRogueDamage\" must be a Player or an int."); - return AddRogueDamage(castPlayer(args[1]), damage); - - case "AddRogueCrit": - case "AddRogueCritChance": - case "ModifyRogueCrit": - case "ModifyRogueCritChance": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue crit change as an int."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify rogue crit change as a float."); - if (!(args[2] is int crit)) - return new ArgumentException("ERROR: The second argument to \"AddRogueCrit\" must be an int."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddRogueCrit\" must be a Player or an int."); - return AddRogueCrit(castPlayer(args[1]), crit); - - case "AddRogueVelocity": - case "ModifyRogueVelocity": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue velocity change as a float."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify rogue velocity change as a float."); - if (!(args[2] is float velocity)) - return new ArgumentException("ERROR: The second argument to \"AddRogueVelocity\" must be a float."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddRogueVelocity\" must be a Player or an int."); - return AddRogueVelocity(castPlayer(args[1]), velocity); - - case "GetStealth": - case "GetCurrentStealth": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"GetStealth\" must be a Player or an int."); - return GetCurrentStealth(castPlayer(args[1])); - - case "GetMaxStealth": - case "GetStealthCap": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"GetMaxStealth\" must be a Player or an int."); - return GetMaxStealth(castPlayer(args[1])); - - case "AddMaxStealth": - case "ModifyMaxStealth": - case "ModifyStealthCap": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue max stealth as a float."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify rogue max stealth as a float."); - if (!(args[2] is float maxStealth)) - return new ArgumentException("ERROR: The second argument to \"AddMaxStealth\" must be a float."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddMaxStealth\" must be a Player or an int."); - return AddMaxStealth(castPlayer(args[1]), maxStealth); - - case "IsRogue": - case "IsProjRogue": - case "IsProjectileRogue": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Projectile object (or int index of a Projectile)."); - if (!isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"IsRogue\" must be a Projectile or an int."); - return IsRogue(castProjectile(args[1])); - - case "SetRogue": - case "SetProjRogue": - case "SetProjectileRogue": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Projectile object (or int index of a Projectile) and a bool."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify rogue status as a bool."); - if (!(args[2] is bool isRogue)) - return new ArgumentException("ERROR: The second argument to \"SetRogue\" must be a bool."); - if (!isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetRogue\" must be a Projectile or an int."); - return SetRogue(castProjectile(args[1]), isRogue); - - case "SetBonus": - case "SetBonusActive": - case "HasSetBonus": - case "GetSetBonus": - case "GetSetBonusActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a set bonus name as a string."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a set bonus name as a string."); - if (!(args[2] is string)) - return new ArgumentException("ERROR: The second argument to \"SetBonus\" must be a string."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetBonus\" must be a Player or an int."); - return GetSetBonus(castPlayer(args[1]), args[2].ToString()); - - case "SetSetBonus": - case "ToggleSetBonus": - case "SetSetBonusActive": - case "ToggleSetBonusActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player), a set bonus name as a string, and a bool."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a set bonus name as a string and a bool."); - if (args.Length < 4) - return new ArgumentNullException("ERROR: Must specify a bool."); - if (!(args[3] is bool setBonusEnabled)) - return new ArgumentException("ERROR: The third argument to \"SetSetBonus\" must be a bool."); - if (!(args[2] is string)) - return new ArgumentException("ERROR: The second argument to \"SetSetBonus\" must be a string."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetSetBonus\" must be a Player or an int."); - return SetSetBonus(castPlayer(args[1]), args[2].ToString(), setBonusEnabled); - - case "DR": - case "DamageReduction": - case "SetDR": - case "SetDamageReduction": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both NPC ID as an int and damage reduction as a float or double."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); - if (!(args[2] is float) && !(args[2] is double)) - return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); - if (!(args[1] is string)) - return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); - - int npcID = (int)args[1]; - float DR = (float)args[2]; - return SetDamageReduction(npcID, DR); - - case "BossHealthBarVisible": - case "BossHealthBarsVisible": - case "GetBossHealthBarVisible": - case "GetBossHealthBarsVisible": - return BossHealthBarVisible(); - - case "SetBossHealthBarVisible": - case "SetBossHealthBarsVisible": - if (args.Length < 2 || !(args[1] is bool bossBarEnabled)) - return new ArgumentNullException("ERROR: Must specify a bool."); - return SetBossHealthBarVisible(bossBarEnabled); - - default: - return new ArgumentException("ERROR: Invalid method name."); - } - } - #endregion - } + case "defiledrune": + case "defiled rune": + case "defiledmode": + case "defiled mode": + return CalamityWorld.defiled = enabled; + + case "armageddon": + case "arma": + case "instakill": + case "instagib": + case "armageddonmode": + case "armageddon mode": + return CalamityWorld.armageddon = enabled; + + case "ironheart": + case "iron heart": + case "steelsoul": + case "steel soul": + case "permadeath": + return CalamityWorld.ironHeart = enabled; + } + } + #endregion + + #region Rogue Class + /// + /// Gets a player's current rogue damage stat. + /// + /// The player whose rogue damage is being queried. + /// Current rogue damage boost. 1f is no bonus, 2f is +100%. + public static float GetRogueDamage(Player p) => p?.Calamity()?.throwingDamage ?? 1f; + + /// + /// Adds a flat amount of rogue damage stat to a player. This amount can be negative. + /// + /// The player whose rogue damage is being modified. + /// The amount of rogue damage to add or subtract (if negative). + /// The player's new rogue damage stat. + public static float AddRogueDamage(Player p, float add) => p is null ? 1f : (p.Calamity().throwingDamage += add); + + /// + /// Gets a player's current rogue critical strike chance. + /// + /// The player whose rogue crit is being queried. + /// Current rogue critical strike chance. 0 is no additional crit, 8 is +8% crit chance. + public static int GetRogueCrit(Player p) => p?.Calamity()?.throwingCrit ?? 0; + + /// + /// Adds a flat amount of rogue crit to a player. This amount can be negative. + /// + /// The player whose rogue crit is being modified. + /// The amount of rogue crit to add or subtract (if negative). + /// The player's new rogue crit stat. + public static int AddRogueCrit(Player p, int add) => p is null ? 0 : (p.Calamity().throwingCrit += add); + + /// + /// Gets a player's current rogue projectile velocity multiplier. + /// + /// The player whose rogue velocity is being queried. + /// Current rogue projectile velocity multiplier. 1f is no bonus, 2f doubles projectile speed. + public static float GetRogueVelocity(Player p) => p?.Calamity()?.throwingVelocity ?? 1f; + + /// + /// Adds a flat amount of rogue velocity stat to a player. This amount can be negative. + /// + /// The player whose rogue velocity is being modified. + /// The amount of rogue velocity to add or subtract (if negative). + /// The player's new rogue velocity stat. + public static float AddRogueVelocity(Player p, float add) => p is null ? 1f : (p.Calamity().throwingVelocity += add); + + public static float GetCurrentStealth(Player p) => p?.Calamity()?.rogueStealth ?? 0f; + + public static float GetMaxStealth(Player p) => p?.Calamity()?.rogueStealthMax ?? 0f; + + public static float AddMaxStealth(Player p, float add) => p is null ? 0f : (p.Calamity().rogueStealthMax += add); + + /// + /// Gets whether the given projectile is classified as rogue. + /// + /// The projectile which is being checked. + /// Whether the projectile is rogue. + public static bool IsRogue(Projectile p) + { + if (p is null || p.Calamity() is null) + return false; + CalamityGlobalProjectile cgp = p.Calamity(); + return cgp.rogue | cgp.forceRogue; + } + + /// + /// Sets whether the given projectile is classified as rogue. If set to true, also forces the projectile to be rogue every single frame. + /// + /// The projectile whose rogue classification is being toggled. + /// The value to apply. + /// Whether the projectile is now rogue. + public static bool SetRogue(Projectile p, bool isRogue) + { + if (p is null || p.Calamity() is null) + return false; + CalamityGlobalProjectile cgp = p.Calamity(); + cgp.forceRogue = cgp.rogue = isRogue; + return cgp.rogue; + } + #endregion + + #region Player Armor Set Bonuses + /// + /// Returns whether the specified player has the set bonus corresponding to the given string. + /// + /// The player whose set bonuses are being questioned. + /// The set bonus to check for. + /// Whether the player currently has the set bonus. + public static bool GetSetBonus(Player p, string setBonus) + { + CalamityPlayer mp = p.Calamity(); + + setBonus = setBonus.ToLower(); + + // LATER -- no summon set bonuses are written well. all use two bools, neither of which actually controls the function + + // Victide + if (setBonus == "victide_summon" || setBonus == "victide summon") + return mp.urchin; // the bool set directly by VictideHelmet.UpdateArmorSet + else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) + return mp.victideSet; + + // Aerospec + if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") + return mp.valkyrie; // the bool set directly by AerospecHelmet.UpdateArmorSet + else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) + return mp.aeroSet; + + // Statigel + if (setBonus == "statigel_summon" || setBonus == "statigel summon") + return mp.slimeGod; // the bool set directly by StatigelHood.UpdateArmorSet + if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) + return mp.statigelSet; + + // Mollusk + if (setBonus == "mollusk") + return mp.molluskSet; + + // Daedalus + switch (setBonus) + { + default: + break; + case "daedalus": + return mp.daedalusReflect || mp.daedalusShard || mp.daedalusAbsorb || mp.daedalusCrystal || mp.daedalusSplit; + case "daedalus_melee": + case "daedalus melee": + return mp.daedalusReflect; + case "daedalus_ranged": + case "daedalus ranged": + return mp.daedalusShard; + case "daedalus_magic": + case "daedalus magic": + return mp.daedalusAbsorb; + case "daedalus_summon": + case "daedalus summon": + return mp.daedalusCrystal; + case "daedalus_rogue": + case "daedalus rogue": + return mp.daedalusSplit; + } + + // Reaver + switch (setBonus) + { + default: + break; + case "reaver": + return mp.reaverBlast || mp.reaverDoubleTap || mp.reaverBurst || mp.reaverOrb || mp.reaverSpore; + case "reaver_melee": + case "reaver melee": + return mp.reaverBlast; + case "reaver_ranged": + case "reaver ranged": + return mp.reaverDoubleTap; + case "reaver_magic": + case "reaver magic": + return mp.reaverBurst; + case "reaver_summon": + case "reaver summon": + return mp.reaverOrb; + case "reaver_rogue": + case "reaver rogue": + return mp.reaverSpore; + } + + // Umbraphile + if (setBonus == "umbraphile") + return mp.umbraphileSet; + + // Ataxia + switch (setBonus) + { + default: + break; + case "ataxia": + return mp.ataxiaBlaze; + case "ataxia_melee": + case "ataxia melee": + return mp.ataxiaGeyser; + case "ataxia_ranged": + case "ataxia ranged": + return mp.ataxiaBolt; + case "ataxia_magic": + case "ataxia magic": + return mp.ataxiaMage; + case "ataxia_summon": + case "ataxia summon": + return mp.chaosSpirit; + case "ataxia_rogue": + case "ataxia rogue": + return mp.ataxiaVolley; + } + + // Plague Reaper + if (setBonus == "plaguereaper" || setBonus == "plague reaper") + return mp.plagueReaper; + + // Astral + if (setBonus == "astral") + return mp.astralStarRain; + + // Xeroc + if (setBonus == "xeroc") + return mp.xerocSet; + + // Tarragon + switch (setBonus) + { + default: + break; + case "tarragon": + return mp.tarraSet; + case "tarragon_melee": + case "tarragon melee": + return mp.tarraMelee; + case "tarragon_ranged": + case "tarragon ranged": + return mp.tarraRanged; + case "tarragon_magic": + case "tarragon magic": + return mp.tarraMage; + case "tarragon_summon": + case "tarragon summon": + return mp.tarraSummon; + case "tarragon_rogue": + case "tarragon rogue": + return mp.tarraThrowing; + } + + // Bloodflare + switch (setBonus) + { + default: + break; + case "bloodflare": + return mp.bloodflareSet; + case "bloodflare_melee": + case "bloodflare melee": + return mp.bloodflareMelee; + case "bloodflare_ranged": + case "bloodflare ranged": + return mp.bloodflareRanged; + case "bloodflare_magic": + case "bloodflare magic": + return mp.bloodflareMage; + case "bloodflare_summon": + case "bloodflare summon": + return mp.bloodflareSummon; + case "bloodflare_rogue": + case "bloodflare rogue": + return mp.bloodflareThrowing; + } + + // Omega Blue + if (setBonus == "omegablue" || setBonus == "omega blue") + return mp.omegaBlueSet; + + // God Slayer + switch (setBonus) + { + default: + break; + case "godslayer": + case "god slayer": + return mp.godSlayer; + case "godslayer_melee": + case "godslayer melee": + case "god slayer melee": + return mp.godSlayerDamage; // melee helm's unique damage reducing property + case "godslayer_ranged": + case "godslayer ranged": + case "god slayer ranged": + return mp.godSlayerRanged; + case "godslayer_magic": + case "godslayer magic": + case "god slayer magic": + return mp.godSlayerMage; + case "godslayer_summon": + case "godslayer summon": + case "god slayer summon": + return mp.godSlayerSummon; + case "godslayer_rogue": + case "godslayer rogue": + case "god slayer rogue": + return mp.godSlayerThrowing; + } + + // Fearmonger + if (setBonus == "fearmonger") + return mp.fearmongerSet; + + // Silva + switch (setBonus) + { + default: + break; + case "silva": + return mp.silvaSet; + case "silva_melee": + case "silva melee": + return mp.silvaMelee; + case "silva_ranged": + case "silva ranged": + return mp.silvaRanged; + case "silva_magic": + case "silva magic": + return mp.silvaMage; + case "silva_summon": + case "silva summon": + return mp.silvaSummon; + case "silva_rogue": + case "silva rogue": + return mp.silvaThrowing; + } + + // Auric Tesla + if (setBonus == "auric" || setBonus == "aurictesla" || setBonus == "auric tesla") + return mp.auricSet; + + // Demonshade + if (setBonus == "demonshade") + return mp.dsSetBonus; + + return false; + } + + /// + /// Turns the set bonus corresponding to the given string on or off for the specified player. + /// + /// The player whose set bonuses are being toggled. + /// The set bonus to check for. + /// Whether the set bonus should be enabled (true) or disabled (false). + /// Whether any set bonus was adjusted. + public static bool SetSetBonus(Player p, string setBonus, bool enabled) + { + CalamityPlayer mp = p.Calamity(); + setBonus = setBonus.ToLower(); + + // Victide + if (setBonus == "victide_summon" || setBonus == "victide summon") + { + mp.victideSet = enabled; + mp.urchin = enabled; // LATER -- remove this when player.urchin actually controls victide summoner + return true; + } + else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) + { + mp.victideSet = true; + return true; + } + + // Aerospec + if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") + { + mp.aeroSet = enabled; + mp.valkyrie = enabled; // LATER -- remove this when player.valkyrie actually controls aerospec summoner + return true; + } + else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) + { + mp.aeroSet = enabled; + return true; + } + + // Statigel + if (setBonus == "statigel_summon" || setBonus == "statigel summon") + { + mp.statigelSet = enabled; + mp.slimeGod = enabled; // LATER -- remove this when player.slimeGod actually controls statigel summoner + return true; + } + else if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) + { + mp.statigelSet = enabled; + return true; + } + + // Mollusk + if (setBonus == "mollusk") + { + mp.molluskSet = enabled; + return true; + } + + // Daedalus + switch (setBonus) + { + default: + break; + case "daedalus_melee": + case "daedalus melee": + mp.daedalusReflect = enabled; + return true; + case "daedalus_ranged": + case "daedalus ranged": + mp.daedalusShard = enabled; + return true; + case "daedalus_magic": + case "daedalus magic": + mp.daedalusAbsorb = enabled; + return true; + case "daedalus_summon": + case "daedalus summon": + mp.daedalusCrystal = enabled; // LATER -- remove this when player.daedalusCrystal actually controls daedalus summoner + return true; + case "daedalus_rogue": + case "daedalus rogue": + mp.daedalusSplit = enabled; + return true; + } + + // Reaver + switch (setBonus) + { + default: + break; + case "reaver_melee": + case "reaver melee": + mp.reaverBlast = enabled; + return true; + case "reaver_ranged": + case "reaver ranged": + mp.reaverDoubleTap = enabled; + return true; + case "reaver_magic": + case "reaver magic": + mp.reaverBurst = enabled; + return true; + case "reaver_summon": + case "reaver summon": + mp.reaverOrb = enabled; // LATER -- remove this when player.reaverOrb actually controls reaver summoner + return true; + case "reaver_rogue": + case "reaver rogue": + mp.reaverSpore = enabled; + return true; + } + + // Umbraphile + if (setBonus == "umbraphile") + { + mp.umbraphileSet = enabled; + return true; + } + + // Ataxia + switch (setBonus) + { + default: + break; + case "ataxia": + mp.ataxiaBlaze = enabled; + return true; + case "ataxia_melee": + case "ataxia melee": + mp.ataxiaBlaze = enabled; + mp.ataxiaGeyser = enabled; + return true; + case "ataxia_ranged": + case "ataxia ranged": + mp.ataxiaBlaze = enabled; + mp.ataxiaBolt = enabled; + return true; + case "ataxia_magic": + case "ataxia magic": + mp.ataxiaBlaze = enabled; + mp.ataxiaMage = enabled; + return true; + case "ataxia_summon": + case "ataxia summon": + mp.ataxiaBlaze = enabled; + mp.chaosSpirit = enabled; // LATER -- remove this when player.chaosSpirit actually controls ataxia summoner + return true; + case "ataxia_rogue": + case "ataxia rogue": + mp.ataxiaBlaze = enabled; + mp.ataxiaVolley = enabled; + return true; + } + + // Plague Reaper + if (setBonus == "plaguereaper" || setBonus == "plague reaper") + { + mp.plagueReaper = enabled; + return true; + } + + // Astral + if (setBonus == "astral") + { + mp.astralStarRain = enabled; + return true; + } + + // Xeroc + if (setBonus == "xeroc") + { + mp.xerocSet = enabled; + return true; + } + + // Tarragon + switch (setBonus) + { + default: + break; + case "tarragon": + mp.tarraSet = enabled; + return true; + case "tarragon_melee": + case "tarragon melee": + mp.tarraSet = enabled; + mp.tarraMelee = enabled; + return true; + case "tarragon_ranged": + case "tarragon ranged": + mp.tarraSet = enabled; + mp.tarraRanged = enabled; + return true; + case "tarragon_magic": + case "tarragon magic": + mp.tarraSet = enabled; + mp.tarraMage = enabled; + return true; + case "tarragon_summon": + case "tarragon summon": + mp.tarraSet = enabled; + mp.tarraSummon = enabled; // LATER -- remove this when player.tarraSummon actually controls life aura + return true; + case "tarragon_rogue": + case "tarragon rogue": + mp.tarraSet = enabled; + mp.tarraThrowing = enabled; + return true; + } + + // Bloodflare + switch (setBonus) + { + default: + break; + case "bloodflare": + mp.bloodflareSet = enabled; + return true; + case "bloodflare_melee": + case "bloodflare melee": + mp.bloodflareSet = enabled; + mp.bloodflareMelee = enabled; + return true; + case "bloodflare_ranged": + case "bloodflare ranged": + mp.bloodflareSet = enabled; + mp.bloodflareRanged = enabled; + return true; + case "bloodflare_magic": + case "bloodflare magic": + mp.bloodflareSet = enabled; + mp.bloodflareMage = enabled; + return true; + case "bloodflare_summon": + case "bloodflare summon": + mp.bloodflareSet = enabled; + mp.bloodflareSummon = enabled; // LATER -- remove this when player.bloodflareSummon actually controls bloodflare orbs + return true; + case "bloodflare_rogue": + case "bloodflare rogue": + mp.bloodflareSet = enabled; + mp.bloodflareThrowing = enabled; + return true; + } + + // Omega Blue + if (setBonus == "omegablue" || setBonus == "omega blue") + { + mp.omegaBlueSet = enabled; + return true; + } + + // God Slayer + switch (setBonus) + { + default: + break; + case "godslayer": + case "god slayer": + mp.godSlayer = enabled; + return true; + case "godslayer_melee": + case "godslayer melee": + case "god slayer melee": + mp.godSlayer = enabled; + mp.godSlayerDamage = enabled; // melee helm's unique damage reducing property + return true; + case "godslayer_ranged": + case "godslayer ranged": + case "god slayer ranged": + mp.godSlayer = enabled; + mp.godSlayerRanged = enabled; + return true; + case "godslayer_magic": + case "godslayer magic": + case "god slayer magic": + mp.godSlayer = enabled; + mp.godSlayerMage = enabled; + return true; + case "godslayer_summon": + case "godslayer summon": + case "god slayer summon": + mp.godSlayer = enabled; + mp.godSlayerSummon = enabled; // LATER -- remove this when player.godSlayerSummon actually controls mechworm + return true; + case "godslayer_rogue": + case "godslayer rogue": + case "god slayer rogue": + mp.godSlayer = enabled; + mp.godSlayerThrowing = enabled; + return true; + } + + // Fearmonger + if (setBonus == "fearmonger") + { + mp.fearmongerSet = enabled; + return true; + } + + // Silva + switch (setBonus) + { + default: + break; + case "silva": + mp.silvaSet = enabled; + return true; + case "silva_melee": + case "silva melee": + mp.silvaSet = enabled; + mp.silvaMelee = enabled; + return true; + case "silva_ranged": + case "silva ranged": + mp.silvaSet = enabled; + mp.silvaRanged = enabled; + return true; + case "silva_magic": + case "silva magic": + mp.silvaSet = enabled; + mp.silvaMage = enabled; + return true; + case "silva_summon": + case "silva summon": + mp.silvaSet = enabled; + mp.silvaSummon = enabled; // LATER -- remove this when player.silvaSummon actually controls silva crystal + return true; + case "silva_rogue": + case "silva rogue": + mp.silvaSet = enabled; + mp.silvaThrowing = enabled; + return true; + } + + // Auric Tesla (includes all components) + switch (setBonus) + { + default: + break; + case "auric": + case "aurictesla": + case "auric tesla": + mp.tarraSet = enabled; + mp.bloodflareSet = enabled; + mp.godSlayer = enabled; + mp.silvaSet = enabled; + mp.auricSet = enabled; + return true; + case "auric_melee": + case "auric melee": + case "aurictesla_melee": + case "aurictesla melee": + case "auric tesla melee": + mp.tarraSet = enabled; + mp.tarraMelee = enabled; + mp.bloodflareSet = enabled; + mp.bloodflareMelee = enabled; + mp.godSlayer = enabled; + mp.godSlayerDamage = enabled; + mp.silvaSet = enabled; + mp.silvaMelee = enabled; + mp.auricSet = enabled; + return true; + case "auric_ranged": + case "auric ranged": + case "aurictesla_ranged": + case "aurictesla ranged": + case "auric tesla ranged": + mp.tarraSet = enabled; + mp.tarraRanged = enabled; + mp.bloodflareSet = enabled; + mp.bloodflareRanged = enabled; + mp.godSlayer = enabled; + mp.godSlayerRanged = enabled; + mp.silvaSet = enabled; + mp.silvaRanged = enabled; + mp.auricSet = enabled; + return true; + case "auric_magic": + case "auric magic": + case "aurictesla_magic": + case "aurictesla magic": + case "auric tesla magic": + mp.tarraSet = enabled; + mp.tarraMage = enabled; + mp.bloodflareSet = enabled; + mp.bloodflareMage = enabled; + mp.godSlayer = enabled; + mp.godSlayerMage = enabled; + mp.silvaSet = enabled; + mp.silvaMage = enabled; + mp.auricSet = enabled; + return true; + case "auric_summon": + case "auric summon": + case "aurictesla_summon": + case "aurictesla summon": + case "auric tesla summon": + mp.tarraSet = enabled; + mp.tarraSummon = enabled; + mp.bloodflareSet = enabled; + mp.bloodflareSummon = enabled; + mp.godSlayer = enabled; + mp.godSlayerSummon = enabled; + mp.silvaSet = enabled; + mp.silvaSummon = enabled; + mp.auricSet = enabled; + return true; + case "auric_rogue": + case "auric rogue": + case "aurictesla_rogue": + case "aurictesla rogue": + case "auric tesla rogue": + mp.tarraSet = enabled; + mp.tarraThrowing = enabled; + mp.bloodflareSet = enabled; + mp.bloodflareThrowing = enabled; + mp.godSlayer = enabled; + mp.godSlayerThrowing = enabled; + mp.silvaSet = enabled; + mp.silvaThrowing = enabled; + mp.auricSet = enabled; + return true; + } + + // Demonshade + if (setBonus == "demonshade") + { + mp.dsSetBonus = enabled; + mp.rDevil = enabled; // LATER -- remove this when player.rDevil controls demonshade summoned minion + return true; + } + + return false; + } + #endregion + + #region Other Player Stats + public static int GetLightStrength(Player p) => p?.Calamity()?.GetTotalLightStrength() ?? 0; + + public static void AddAbyssLightStrength(Player p, int add) + { + if (p != null) + p.Calamity().externalAbyssLight += add; + } + + public static bool MakeColdImmune(Player p) => p is null ? false : (p.Calamity().externalColdImmunity = true); + public static bool MakeHeatImmune(Player p) => p is null ? false : (p.Calamity().externalHeatImmunity = true); + #endregion + + #region Set Damage Reduction + public static float SetDamageReduction(int npcID, float dr) + { + CalamityMod.DRValues.TryGetValue(npcID, out float oldDR); + CalamityMod.DRValues.Remove(npcID); + CalamityMod.DRValues.Add(npcID, dr); + return oldDR; + } + #endregion + + #region Boss Health Bars + public static bool BossHealthBarVisible() => Main.LocalPlayer.Calamity().drawBossHPBar; + + public static bool SetBossHealthBarVisible(bool visible) => Main.LocalPlayer.Calamity().drawBossHPBar = visible; + #endregion + + #region Item Rarity + public static bool SetCalamityRarity(Item item, int rarityNum) + { + CalamityGlobalItem cgi = item.GetGlobalItem(); + cgi.customRarity = (CalamityRarity)rarityNum; + return cgi.customRarity != CalamityRarity.NoEffect; + } + #endregion + + #region Call + public static object Call(params object[] args) + { + bool isValidPlayerArg(object o) => o is int || o is Player; + bool isValidProjectileArg(object o) => o is int || o is Projectile; + + Player castPlayer(object o) + { + if (o is int i) + return Main.player[i]; + else if (o is Player p) + return p; + return null; + } + + Projectile castProjectile(object o) + { + if (o is int i) + return Main.projectile[i]; + else if (o is Projectile p) + return p; + return null; + } + + if (args is null || args.Length <= 0) + return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); + if (!(args[0] is string)) + return new ArgumentException("ERROR: First argument must be a string function name."); + + string methodName = args[0].ToString(); + switch (methodName) + { + case "Downed": + case "GetDowned": + case "BossDowned": + case "GetBossDowned": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a boss or event name as a string."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The argument to \"Downed\" must be a string."); + return GetBossDowned(args[1].ToString()); + + case "Zone": + case "GetZone": + case "InZone": + case "GetInZone": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a zone name as a string."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a zone name as a string."); + if (!(args[2] is string)) + return new ArgumentException("ERROR: The second argument to \"InZone\" must be a string."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"InZone\" must be a Player or an int."); + return GetInZone(castPlayer(args[1]), args[2].ToString()); + + case "Difficulty": + case "GetDifficulty": + case "DifficultyActive": + case "GetDifficultyActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a difficulty mode name as a string."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The argument to \"Difficulty\" must be a string."); + return GetDifficultyActive(args[1].ToString()); + + case "SetDifficulty": + case "SetDifficultyActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a difficulty mode name as a string and a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a bool."); + if (!(args[2] is bool enabled)) + return new ArgumentException("ERROR: The second argument to \"SetDifficulty\" must be a bool."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The first argument to \"SetDifficulty\" must be a string."); + return SetDifficultyActive(args[1].ToString(), enabled); + + case "GetLight": + case "GetLightLevel": + case "GetLightStrength": + case "GetAbyssLight": + case "GetAbyssLightLevel": + case "GetAbyssLightStrength": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if(!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"GetLightStrength\" must be a Player or an int."); + return GetLightStrength(castPlayer(args[1])); + + case "AddLight": + case "AddLightLevel": + case "AddLightStrength": + case "AddAbyssLight": + case "AddAbyssLightLevel": + case "AddAbyssLightStrength": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and light strength change as an int."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify light strength change as an int."); + if (!(args[2] is int light)) + return new ArgumentException("ERROR: The second argument to \"AddLightStrength\" must be an int."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddLightStrength\" must be a Player or an int."); + AddAbyssLightStrength(castPlayer(args[1]), light); + return null; + + case "ColdImmune": + case "ColdImmunity": + case "GiveColdImmunity": + case "MakeColdImmune": + case "DeathModeCold": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"DeathModeCold\" must be a Player or an int."); + return MakeColdImmune(castPlayer(args[1])); + + case "HeatImmune": + case "HeatImmunity": + case "GiveHeatImmunity": + case "MakeHeatImmune": + case "DeathModeHeat": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"DeathModeHeat\" must be a Player or an int."); + return MakeHeatImmune(castPlayer(args[1])); + + case "GetRogueDamage": + case "GetRogueDmg": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"GetRogueDamage\" must be a Player or an int."); + return GetRogueDamage(castPlayer(args[1])); + + case "GetRogueCrit": + case "GetRogueCritChance": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"GetRogueCrit\" must be a Player or an int."); + return GetRogueCrit(castPlayer(args[1])); + + case "GetRogueVelocity": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The argument to \"GetRogueVelocity\" must be a Player or an int."); + return GetRogueVelocity(castPlayer(args[1])); + + case "AddRogueDamage": + case "AddRogueDmg": + case "ModifyRogueDamage": + case "ModifyRogueDmg": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue damage change as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify rogue damage change as a float."); + if (!(args[2] is float damage)) + return new ArgumentException("ERROR: The second argument to \"AddRogueDamage\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddRogueDamage\" must be a Player or an int."); + return AddRogueDamage(castPlayer(args[1]), damage); + + case "AddRogueCrit": + case "AddRogueCritChance": + case "ModifyRogueCrit": + case "ModifyRogueCritChance": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue crit change as an int."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify rogue crit change as a float."); + if (!(args[2] is int crit)) + return new ArgumentException("ERROR: The second argument to \"AddRogueCrit\" must be an int."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddRogueCrit\" must be a Player or an int."); + return AddRogueCrit(castPlayer(args[1]), crit); + + case "AddRogueVelocity": + case "ModifyRogueVelocity": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue velocity change as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify rogue velocity change as a float."); + if (!(args[2] is float velocity)) + return new ArgumentException("ERROR: The second argument to \"AddRogueVelocity\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddRogueVelocity\" must be a Player or an int."); + return AddRogueVelocity(castPlayer(args[1]), velocity); + + case "GetStealth": + case "GetCurrentStealth": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"GetStealth\" must be a Player or an int."); + return GetCurrentStealth(castPlayer(args[1])); + + case "GetMaxStealth": + case "GetStealthCap": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"GetMaxStealth\" must be a Player or an int."); + return GetMaxStealth(castPlayer(args[1])); + + case "AddMaxStealth": + case "ModifyMaxStealth": + case "ModifyStealthCap": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and rogue max stealth as a float."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify rogue max stealth as a float."); + if (!(args[2] is float maxStealth)) + return new ArgumentException("ERROR: The second argument to \"AddMaxStealth\" must be a float."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"AddMaxStealth\" must be a Player or an int."); + return AddMaxStealth(castPlayer(args[1]), maxStealth); + + case "IsRogue": + case "IsProjRogue": + case "IsProjectileRogue": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Projectile object (or int index of a Projectile)."); + if (!isValidProjectileArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"IsRogue\" must be a Projectile or an int."); + return IsRogue(castProjectile(args[1])); + + case "SetRogue": + case "SetProjRogue": + case "SetProjectileRogue": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Projectile object (or int index of a Projectile) and a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify rogue status as a bool."); + if (!(args[2] is bool isRogue)) + return new ArgumentException("ERROR: The second argument to \"SetRogue\" must be a bool."); + if (!isValidProjectileArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetRogue\" must be a Projectile or an int."); + return SetRogue(castProjectile(args[1]), isRogue); + + case "SetBonus": + case "SetBonusActive": + case "HasSetBonus": + case "GetSetBonus": + case "GetSetBonusActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a set bonus name as a string."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a set bonus name as a string."); + if (!(args[2] is string)) + return new ArgumentException("ERROR: The second argument to \"SetBonus\" must be a string."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetBonus\" must be a Player or an int."); + return GetSetBonus(castPlayer(args[1]), args[2].ToString()); + + case "SetSetBonus": + case "ToggleSetBonus": + case "SetSetBonusActive": + case "ToggleSetBonusActive": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player), a set bonus name as a string, and a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a set bonus name as a string and a bool."); + if (args.Length < 4) + return new ArgumentNullException("ERROR: Must specify a bool."); + if (!(args[3] is bool setBonusEnabled)) + return new ArgumentException("ERROR: The third argument to \"SetSetBonus\" must be a bool."); + if (!(args[2] is string)) + return new ArgumentException("ERROR: The second argument to \"SetSetBonus\" must be a string."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetSetBonus\" must be a Player or an int."); + return SetSetBonus(castPlayer(args[1]), args[2].ToString(), setBonusEnabled); + + case "DR": + case "DamageReduction": + case "SetDR": + case "SetDamageReduction": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both NPC ID as an int and damage reduction as a float or double."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); + if (!(args[2] is float) && !(args[2] is double)) + return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); + + int npcID = (int)args[1]; + float DR = (float)args[2]; + return SetDamageReduction(npcID, DR); + + case "BossHealthBarVisible": + case "BossHealthBarsVisible": + case "GetBossHealthBarVisible": + case "GetBossHealthBarsVisible": + return BossHealthBarVisible(); + + case "SetBossHealthBarVisible": + case "SetBossHealthBarsVisible": + if (args.Length < 2 || !(args[1] is bool bossBarEnabled)) + return new ArgumentNullException("ERROR: Must specify a bool."); + return SetBossHealthBarVisible(bossBarEnabled); + + case "SetRarity": + case "SetItemRarity": + case "SetCalamityRarity": + case "SetPostMLRarity": + case "SetPostMoonLordRarity": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both an Item and desired rarity as an int."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify desired rarity as an int."); + if (!(args[2] is int)) + return new ArgumentException("ERROR: The second argument to \"SetCalamityRarity\" must be an int."); + if (!(args[1] is Item)) + return new ArgumentException("ERROR: The first argument to \"SetCalamityRarity\" must be an Item."); + + Item item = (Item)args[1]; + int rarity = (int)args[2]; + return SetCalamityRarity(item, rarity); + + default: + return new ArgumentException("ERROR: Invalid method name."); + } + } + #endregion + } } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index a7d2a719b5..88775376e1 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1,785 +1,760 @@ -using CalamityMod; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Potions; -using CalamityMod.Items.SummonItems; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.DifficultyItems; -using CalamityMod.Items.PermanentBoosters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.FurnitureCosmilite; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Placeables.Furniture.CraftingStations; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; +using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Placeables.FurnitureCosmilite; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.SummonItems; using CalamityMod.Items.Tools; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.TreasureBags; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.Yharon; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; -using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Summon; -using CalamityMod.World; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; + +using static CalamityMod.Downed; +using static Terraria.ModLoader.ModContent; + namespace CalamityMod { - internal class WeakReferenceSupport - { - public static void Setup() - { - BossChecklistSupport(); - CensusSupport(); + internal class WeakReferenceSupport + { + private static readonly Dictionary BossDifficulty = new Dictionary + { + { "DesertScourge", 1.5f }, + { "GiantClam", 1.6f }, + { "Crabulon", 2.5f }, + { "HiveMind", 3.5f }, + { "Perforators", 3.51f }, + { "SlimeGod", 5.5f }, + { "Cryogen", 6.5f }, + { "BrimstoneElemental", 7.5f }, + { "AquaticScourge", 8.5f }, + { "Calamitas", 9.7f }, + { "GreatSandShark", 10.09f }, + { "Leviathan", 10.5f }, + { "AstrumAureus", 10.6f }, + { "PlaguebringerGoliath", 11.5f }, + { "Ravager", 12.5f }, + { "AstrumDeus", 13.5f }, + { "ProfanedGuardians", 14.5f }, + { "Bumblebirb", 14.6f }, + { "Providence", 15.01f }, // Thorium's Ragnarok is 15f + { "CeaselessVoid", 15.5f }, + { "StormWeaver", 15.51f }, + { "Signus", 15.52f }, + { "Polterghast", 16f }, + { "DevourerOfGods", 17f }, + { "Yharon", 18f }, + // { "Draedon", 18.5f }, + { "SupremeCalamitas", 19f }, + // { "Yharim", 20f }, + // { "Noxus", 120f }, + // { "Xeroc", 121f }, + }; + + public static void Setup() + { + BossChecklistSupport(); + FargosSupport(); + CensusSupport(); SummonersAssociationSupport(); - } - - private static void BossChecklistSupport() - { - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - Mod calamity = ModContent.GetInstance(); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - - if (bossChecklist != null) - { - // 14 is moonlord, 12 is duke fishron - - //Desert Scourge - bossChecklist.Call( - "AddBoss", - 1.5f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Desert Scourge", - (Func)(() => CalamityWorld.downedDesertScourge), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ItemID.SandBlock, ModContent.ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GoldenBugNet, ItemID.LesserHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Desert Biome", - "[c/EEE8AA:The scourge of the desert delved back into the sand.]", - "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist"); - - //Giant Clam - bossChecklist.Call( - "AddMiniBoss", - 1.6f, - ModContent.NPCType(), - calamity, - "Giant Clam", - (Func)(() => CalamityWorld.downedCLAM), - null, - null, - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - "Can spawn naturally in the Sunken Sea", - "[c/7FFFD4:The Giant Clam returns into hiding in its grotto.]"); - - //Crabulon - bossChecklist.Call( - "AddBoss", - 2.5f, - ModContent.NPCType(), - calamity, - "Crabulon", - (Func)(() => CalamityWorld.downedCrabulon), - ModContent.ItemType(), - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() { ModContent.ItemType(), ItemID.GlowingMushroom, ItemID.MushroomGrassSeeds, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.LesserHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Mushroom Biome", - "[c/6495ED:The mycelium crab has lost interest.]"); - - //Hive Mind - bossChecklist.Call( - "AddBoss", - 3.5f, - new List() {ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Hive Mind", - (Func)(() => CalamityWorld.downedHiveMind), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ItemID.DemoniteBar, ItemID.RottenChunk, ItemID.CursedFlame, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.LesserHealingPotion}, - "By killing a Cyst in the Corruption or use a [i:" + ModContent.ItemType() + "] in the Corruption", - "[c/9400D3:The corrupted colony began searching for a new breeding ground.]"); - - //Perforators - bossChecklist.Call( - "AddBoss", - 3.5f, - new List() {ModContent.NPCType()}, - calamity, - "The Perforators", - (Func)(() => CalamityWorld.downedPerforator), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ItemID.CrimtaneBar, ItemID.Vertebrae, ItemID.Ichor, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.LesserHealingPotion}, - "By killing a Cyst in the Crimson or use a [i:" + ModContent.ItemType() + "] in the Crimson", - "[c/DC143C:The parasitic hive began searching for a new host.]"); - - //Slime God - bossChecklist.Call( - "AddBoss", - 5.5f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Slime God", - (Func)(() => CalamityWorld.downedSlimeGod), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ItemID.Gel, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.HealingPotion}, - "Use an [i:" + ModContent.ItemType() + "]", - "[c/BA5533:The gelatinous monstrosity achieved vengeance for its breathren.]"); - - //Cryogen - bossChecklist.Call( - "AddBoss", - 6.5f, - ModContent.NPCType(), - calamity, - "Cryogen", - (Func)(() => CalamityWorld.downedCryogen), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ItemID.SoulofMight, ModContent.ItemType(), ModContent.ItemType(), ItemID.FrostCore, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.FrozenKey, ItemID.GreaterHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Snow Biome", - "[c/00FFFF:Cryogen drifts away, carried on a freezing wind.]", - "CalamityMod/NPCs/Cryogen/Cryogen_BossChecklist"); - - //Brimstone Elemental - bossChecklist.Call( - "AddBoss", - 7.5f, - ModContent.NPCType(), - calamity, - "Brimstone Elemental", - (Func)(() => CalamityWorld.downedBrimstoneElemental), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ItemID.SoulofFright, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.GreaterHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Brimstone Crag", - "[c/DC143C:Brimstone Elemental withdraws to the ruins of her shrine.]"); - - //Aquatic Scourge - bossChecklist.Call( - "AddBoss", - 8.5f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Aquatic Scourge", - (Func)(() => CalamityWorld.downedAquaticScourge), - ModContent.ItemType(), - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() { ModContent.ItemType(), ModContent.ItemType(), ItemID.SoulofSight, ModContent.ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GoldenBugNet, ItemID.GreaterHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea", - "[c/F0E68C:The Aquatic Scourge swam back into the open ocean.]", - "CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist"); - - //Calamitas - bossChecklist.Call( - "AddBoss", - 9.7f, - new List() {ModContent.NPCType()}, - calamity, - "Calamitas", - (Func)(() => CalamityWorld.downedCalamitas), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.BrokenHeroSword, ItemID.GreaterHealingPotion}, - "Use an [i:" + ModContent.ItemType() + "] at Night", - "[c/FFA500:If you wanted a fight, you should've came more prepared.]"); - - //Great Sand Shark - bossChecklist.Call( - "AddMiniBoss", - 10.09f, - ModContent.NPCType(), - calamity, - "Great Sand Shark", - (Func)(() => CalamityWorld.downedGSS), - ModContent.ItemType(), - new List() {ItemID.MusicBoxSandstorm}, - new List() {ModContent.ItemType(), ItemID.AncientBattleArmorMaterial}, - "Kill 10 sand sharks after defeating Plantera or use a [i:" + ModContent.ItemType() + "] in the Desert Biome", - "[c/DAA520:The apex predator of the sands disappears into the dunes...]"); - - //Leviathan and Siren - bossChecklist.Call( - "AddBoss", - 10.5f, - new List() {ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Leviathan", - (Func)(() => CalamityWorld.downedLeviathan), - null, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion}, - "By killing an unknown entity in the Ocean Biome", - "[c/7FFFD4:The aquatic entities sink back beneath the ocean depths.]", - "CalamityMod/NPCs/Leviathan/SirenandLevi_BossChecklist"); - - //Astrum Aureus - bossChecklist.Call( - "AddBoss", - 10.6f, - ModContent.NPCType(), - calamity, - "Astrum Aureus", - (Func)(() => CalamityWorld.downedAstrageldon), - ModContent.ItemType(), - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() { ModContent.ItemType(), ModContent.ItemType(), ItemID.FallenStar, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ModContent.ItemType(), ItemID.GreaterHealingPotion}, - "Use an [i:" + ModContent.ItemType() + "] at Night in the Astral Biome", - "[c/FFD700:Astrum Aureus’ program has been executed. Initiate recall.]", - "CalamityMod/NPCs/AstrumAureus/AstrumAureus_BossChecklist"); - - //Plaguebringer Goliath - bossChecklist.Call( - "AddBoss", - 11.5f, - ModContent.NPCType(), - calamity, - "Plaguebringer Goliath", - (Func)(() => CalamityWorld.downedPlaguebringer), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.GreaterHealingPotion}, - "Use an [i:" + ModContent.ItemType() + "] in the Jungle Biome", - "[c/00FF00:HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.]"); - - //Ravager - bossChecklist.Call( - "AddBoss", - 12.5f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Ravager", - (Func)(() => CalamityWorld.downedScavenger), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.GreaterHealingPotion}, - "Use an [i:" + ModContent.ItemType() + "]", - "[c/B22222:The automaton of misshapen victims went looking for the true perpetrator.]", - "CalamityMod/NPCs/Ravager/Ravager_BossChecklist"); - - //Astrum Deus - bossChecklist.Call( - "AddBoss", - 13.5f, - new List() { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Astrum Deus", - (Func)(() => CalamityWorld.downedStarGod), - ModContent.ItemType(), - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion}, - "Defeat 3 empowered astral titans or use a [i:" + ModContent.ItemType() + "] at Night", - "[c/FFD700:The infected deity retreats to the heavens.]", - "CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist"); - - //Profaned Guardians - bossChecklist.Call( - "AddBoss", - 14.5f, - new List() { ModContent.NPCType()}, - calamity, "Profaned Guardians", - (Func)(() => CalamityWorld.downedGuardians), - ModContent.ItemType(), - new List() { ModContent.ItemType(), ModContent.ItemType() }, - new List() { ModContent.ItemType(), ItemID.GreaterHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Hallow or Underworld Biomes", - "[c/FFA500:The guardians must protect their goddess at all costs.]", - "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist"); - - //Bumblebirb - bossChecklist.Call( - "AddBoss", - 14.6f, - ModContent.NPCType(), - calamity, - "Bumblebirb", - (Func)(() => CalamityWorld.downedBumble), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, - "Use [i:" + ModContent.ItemType() + "] in the Jungle Biome", - "[c/FFD700:The failed experiment returns into its reproductive routine.]"); - - //Providence - bossChecklist.Call( - "AddBoss", - 15f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Providence", - (Func)(() => CalamityWorld.downedProvidence), - new List() {ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Hallow or Underworld Biomes", - "[c/FFA500:The Profaned Goddess vanishes in a burning blaze.]", - "CalamityMod/NPCs/Providence/Providence_BossChecklist"); - - //Ceaseless Void - bossChecklist.Call( - "AddBoss", - 15.1f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Ceaseless Void", - (Func)(() => CalamityWorld.downedSentinel1), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, "Use a [i:" + ModContent.ItemType() + "] in the Dungeon", - "[c/4B0082:The rift in time and space has moved away from your reach.]"); - - //Storm Weaver - bossChecklist.Call( - "AddBoss", - 15.2f, - new List() {ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Storm Weaver", - (Func)(() => CalamityWorld.downedSentinel2), ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in Space", - "[c/EE82EE:Storm Weaver hid itself once again within the stormfront.]", - "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist"); - - //Signus - bossChecklist.Call( - "AddBoss", - 15.3f, - ModContent.NPCType(), - calamity, - "Signus", - (Func)(() => CalamityWorld.downedSentinel3), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, - "Use a [i:" + ModContent.ItemType() + "] in the Underworld", - "[c/BA55D3:The Devourer's assassin has finished its easy task.]"); - - //Polterghast - bossChecklist.Call( - "AddBoss", - 15.5f, - new List() {ModContent.NPCType(), ModContent.NPCType()}, - calamity, - "Polterghast", - (Func)(() => CalamityWorld.downedPolterghast), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, - "Kill 30 phantom spirits or use a [i:" + ModContent.ItemType() + "] in the Dungeon", - "[c/B0E0E6:The volatile spirits disperse throughout the depths of the dungeon.]"); - - //Devourer of Gods - bossChecklist.Call( - "AddBoss", - 16f, - new List() {ModContent.NPCType()}, - calamity, - "Devourer of Gods", - (Func)(() => CalamityWorld.downedDoG), ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - "Use a [i:" + ModContent.ItemType() + "]", - "[c/00FFFF:The Devourer of Gods has slain everyone and feasted on their essence.]", - "CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist", - "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"); - - //Yharon - bossChecklist.Call( - "AddBoss", - 17f, - ModContent.NPCType(), - calamity, - "Yharon", - (Func)(() => CalamityWorld.downedYharon), - ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - "Use a [i:" + ModContent.ItemType() + "] in the Jungle Biome", - (CalamityWorld.buffedEclipse ? "[c/FFA500:Yharon prepared itself for the worst possible outcome.]" : "[c/FFA500:Yharon found you too weak to stay near your gravestone.]"), - "CalamityMod/NPCs/Yharon/Yharon_BossChecklist"); - - //Supreme Calamitas - bossChecklist.Call( - "AddBoss", - 18f, - new List() {ModContent.NPCType()}, - calamity, - "Supreme Calamitas", - (Func)(() => CalamityWorld.downedSCal), ModContent.ItemType(), - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - "Use an [i:" + ModContent.ItemType() + "]", - "[c/FFA500:Please don't waste my time.]"); - - //King Slime - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "KingSlime", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "KingSlime", - new List() {ModContent.ItemType()}); - - //Eye of Cthulhu - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "EyeofCthulhu", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "EyeofCthulhu", - new List() {ModContent.ItemType()}); - - //Eater of Worlds - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "EaterofWorldsHead", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //Brain of Cthulhu - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "BrainofCthulhu", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //Queen Bee - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "QueenBee", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "QueenBee", - new List() {ModContent.ItemType()}); - - //Skeletron - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "SkeletronHead", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "SkeletronHead", - new List() {ModContent.ItemType()}); - - //Wall of Flesh - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "WallofFlesh", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.CorruptionKey, ItemID.CrimsonKey}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "WallofFlesh", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - //The Twins - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "TheTwins", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //The Destroyer - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "TheDestroyer", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "TheDestroyer", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //Skeletron Prime - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "SkeletronPrime", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //Plantera - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Plantera", - new List() {ModContent.ItemType(), ModContent.ItemType(), ItemID.JungleKey}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "Plantera", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossSpawnItems", - "Terraria", - "Plantera", - new List() {ModContent.ItemType()}); - - //Golem - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Golem", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "Golem", - new List() {ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossSpawnItems", - "Terraria", - "Golem", - new List() {ModContent.ItemType()}); - - //Duke Fishron - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "DukeFishron", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "DukeFishron", - new List() {ModContent.ItemType()}); - - //Lunatic Cultist - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "CultistBoss", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "CultistBoss", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossSpawnItems", - "Terraria", - "CultistBoss", - new List() {ModContent.ItemType()}); - - //Moon Lord - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "MoonLord", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossCollection", - "Terraria", - "MoonLord", - new List() {ModContent.ItemType()}); - - //Betsy - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "DD2Betsy", - new List() {ModContent.ItemType()}); - - //Blood Moon - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Blood Moon", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - bossChecklist.Call( - "AddToBossSpawnItems", - "Terraria", - "Blood Moon", - new List() {ModContent.ItemType()}); - - //Goblin Army - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Goblin Army", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - //Pirates - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Pirate Invasion", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - //Solar Eclipse - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Solar Eclipse", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - //Pumpkin Moon - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Pumpkin Moon", - new List() {ModContent.ItemType()}); - - //Pumpking - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Pumpking", - new List() {ModContent.ItemType()}); - - //Frost Moon - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Frost Moon", - new List() {ModContent.ItemType(), ModContent.ItemType()}); - - //Ice Queen - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Ice Queen", - new List() {ModContent.ItemType()}); - - //Martian Madness - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Martian Madness", - new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}); - - //Martian Saucer - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Martian Saucer", - new List() {ModContent.ItemType()}); - - //Lunar Events - bossChecklist.Call( - "AddToBossLoot", - "Terraria", - "Lunar Event", - new List() {ModContent.ItemType()}); - } - } - - private static void CensusSupport() - { - Mod censusMod = ModLoader.GetMod("Census"); - if (censusMod != null) - { - censusMod.Call("TownNPCCondition", ModContent.NPCType(), "Defeat a Giant Clam after defeating the Desert Scourge"); - censusMod.Call("TownNPCCondition", ModContent.NPCType(), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); - censusMod.Call("TownNPCCondition", ModContent.NPCType(), "Have [i:" + ModContent.ItemType() + "] in your inventory in Hardmode"); - censusMod.Call("TownNPCCondition", ModContent.NPCType(), "Defeat Cryogen"); - } - } + } + + // Wrapper function to add bosses to Boss Checklist. + private static void AddBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, int npcType, Func downed, object summon, + List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + { + bossChecklist.Call("AddBoss", difficulty, npcType, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); + } + + // Wrapper function to add bosses with multiple segments or phases to Boss Checklist. + private static void AddBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, List npcTypes, Func downed, object summon, + List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + { + bossChecklist.Call("AddBoss", difficulty, npcTypes, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); + } + + // Wrapper function to add minibosses to Boss Checklist. + private static void AddMiniBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, int npcType, Func downed, object summon, + List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + { + bossChecklist.Call("AddMiniBoss", difficulty, npcType, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); + } + + // Wrapper function to add loot and collection items to vanilla bosses for Boss Checklist. + private static void AddLoot(Mod bossChecklist, string bossName, List loot = null, List collection = null) + => AddLoot(bossChecklist, "Terraria", bossName, loot, collection); + + // Wrapper function to add loot and collection items to other mods' bosses for Boss Checklist. + private static void AddLoot(Mod bossChecklist, string mod, string bossName, List loot = null, List collection = null) + { + if (loot != null) + bossChecklist.Call("AddToBossLoot", mod, bossName, loot); + if (collection != null) + bossChecklist.Call("AddToBossCollection", mod, bossName, collection); + } + + // Wrapper function to add summon items to vanilla bosses for Boss Checklist. + private static void AddSummons(Mod bossChecklist, string bossName, List summons) => AddSummons(bossChecklist, "Terraria", bossName, summons); + + // Wrapper function to add summon items to other mods' bosses for Boss Checklist. + private static void AddSummons(Mod bossChecklist, string mod, string bossName, List summons) => bossChecklist.Call("AddToBossSpawnItems", mod, bossName, summons); + + /// + /// 1.0 = King Slime
+ /// 2.0 = Eye of Cthulhu
+ /// 3.0 = Eater of Worlds / Brain of Cthulhu
+ /// 4.0 = Queen Bee
+ /// 5.0 = Skeletron
+ /// 6.0 = Wall of Flesh
+ /// 7.0 = The Twins
+ /// 8.0 = The Destroyer
+ /// 9.0 = Skeletron Prime
+ /// 10.0 = Plantera
+ /// 11.0 = Golem
+ /// 12.0 = Duke Fishron
+ /// 13.0 = Lunatic Cultist
+ /// 14.0 = Moon Lord + ///
+ private static void BossChecklistSupport() + { + Mod bossChecklist = ModLoader.GetMod("BossChecklist"); + Mod calamity = GetInstance(); + + // TODO -- calamity music mod should call boss checklist to add loot to calamity bosses on its own + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + + if (bossChecklist is null) + return; + + // Adds every single Calamity boss and miniboss to Boss Checklist's Boss Log. + AddCalamityBosses(bossChecklist, calamity); + + // Loot which Calamity adds to vanilla bosses and events is also added to Boss Checklist's Boss Log. + AddCalamityBossLoot(bossChecklist); + AddCalamityEventLoot(bossChecklist); + } + + private static void AddCalamityBosses(Mod bossChecklist, Mod calamity) + { + // Desert Scourge + { + BossDifficulty.TryGetValue("DesertScourge", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.SandBlock, ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GoldenBugNet, ItemID.LesserHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Desert Biome"; + string despawn = CalamityUtils.ColorMessage("The scourge of the desert delved back into the sand.", new Color(0xEE, 0xE8, 0xAA)); + string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist"; + AddBoss(bossChecklist, calamity, "Desert Scourge", order, segments, DownedDesertScourge, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Giant Clam + { + BossDifficulty.TryGetValue("GiantClam", out float order); + int type = NPCType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = "Can spawn naturally in the Sunken Sea"; + string despawn = CalamityUtils.ColorMessage("The Giant Clam returns into hiding in its grotto.", new Color(0x7F, 0xFF, 0xD4)); + AddMiniBoss(bossChecklist, calamity, "Giant Clam", order, type, DownedGiantClam, null, loot, null, instructions, despawn); + } + + // Crabulon + { + BossDifficulty.TryGetValue("Crabulon", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.GlowingMushroom, ItemID.MushroomGrassSeeds, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Mushroom Biome"; + string despawn = CalamityUtils.ColorMessage("The mycleium crab has lost interest.", new Color(0x64, 0x95, 0xED)); + AddBoss(bossChecklist, calamity, "Crabulon", order, type, DownedCrabulon, summon, loot, collection, instructions, despawn); + } + + // Hive Mind + { + BossDifficulty.TryGetValue("HiveMind", out float order); + List phases = new List() { NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemID.DemoniteBar, ItemID.RottenChunk, ItemID.CursedFlame, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Kill a Cyst in the Corruption or use a [i:{summon}] in the Corruption"; + string despawn = CalamityUtils.ColorMessage("The corrupted colony began searching for a new breeding ground.", new Color(0x94, 0x00, 0xD3)); + AddBoss(bossChecklist, calamity, "Hive Mind", order, phases, DownedHiveMind, summon, loot, collection, instructions, despawn); + } + + // Perforators + { + BossDifficulty.TryGetValue("Perforators", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemID.CrimtaneBar, ItemID.Vertebrae, ItemID.Ichor, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Kill a Cyst in the Crimson or use a [i:{summon}] in the Crimson"; + string despawn = CalamityUtils.ColorMessage("The parasitic hive began searching for a new host.", new Color(0xDC, 0x14, 0x3C)); + AddBoss(bossChecklist, calamity, "The Perforators", order, type, DownedPerfs, summon, loot, collection, instructions, despawn); + } + + // Slime God + { + BossDifficulty.TryGetValue("SlimeGod", out float order); + List bosses = new List() { NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.Gel, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its breathren.", new Color(0xBA, 0x55, 0x33)); + AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, loot, collection, instructions, despawn); + } + + // Cryogen + { + BossDifficulty.TryGetValue("Cryogen", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.SoulofMight, ItemType(), ItemType(), ItemID.FrostCore, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FrozenKey, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Snow Biome"; + string despawn = CalamityUtils.ColorMessage("Cryogen drifts away, carried on a freezing wind.", new Color(0x00, 0xFF, 0xFF)); + string bossLogTex = "CalamityMod/NPCs/Cryogen/Cryogen_BossChecklist"; + AddBoss(bossChecklist, calamity, "Cryogen", order, type, DownedCryogen, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Brimstone Elemental + { + BossDifficulty.TryGetValue("BrimstoneElemental", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.SoulofFright, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Brimstone Crag"; + string despawn = CalamityUtils.ColorMessage("Brimstone Elemental withdraws to the ruins of her shrine.", new Color(0xDC, 0x14, 0x3C)); + AddBoss(bossChecklist, calamity, "Brimstone Elemental", order, type, DownedBrimstoneElemental, summon, loot, collection, instructions, despawn); + } + + // Aquatic Scourge + { + BossDifficulty.TryGetValue("AquaticScourge", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemID.SoulofSight, ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GoldenBugNet, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"; + string despawn = CalamityUtils.ColorMessage("The Aquatic Scourge swam back into the open ocean.", new Color(0xF0, 0xE6, 0x8C)); + string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist"; + AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Calamitas + { + BossDifficulty.TryGetValue("Calamitas", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.BrokenHeroSword, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}] at Night"; + string despawn = CalamityUtils.ColorMessage("If you wanted a fight, you should've came more prepared.", new Color(0xFF, 0xA5, 0x00)); + AddBoss(bossChecklist, calamity, "Calamitas", order, type, DownedCalamitas, summon, loot, collection, instructions, despawn); + } + + // Great Sand Shark + { + BossDifficulty.TryGetValue("GreatSandShark", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.AncientBattleArmorMaterial }; + List collection = new List() { ItemID.MusicBoxSandstorm }; + string instructions = $"Kill 10 sand sharks after defeating Plantera or use a [i:{summon}] in the Desert Biome"; + string despawn = CalamityUtils.ColorMessage("The apex predator of the sands disappears into the dunes...", new Color(0xDA, 0xA5, 0x20)); + AddMiniBoss(bossChecklist, calamity, "Great Sand Shark", order, type, DownedGSS, summon, loot, collection, instructions, despawn); + } + + // Siren and Leviathan + { + BossDifficulty.TryGetValue("Leviathan", out float order); + List bosses = new List() { NPCType(), NPCType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = "By killing an unknown entity in the Ocean Biome"; + string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4)); + string bossLogTex = "CalamityMod/NPCs/Leviathan/SirenandLevi_BossChecklist"; + AddBoss(bossChecklist, calamity, "Leviathan", order, bosses, DownedLeviathan, null, loot, collection, instructions, despawn, bossLogTex); + } + + // Astrum Aureus + { + BossDifficulty.TryGetValue("AstrumAureus", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; + string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); + string bossLogTex = "CalamityMod/NPCs/AstrumAureus/AstrumAureus_BossChecklist"; + AddBoss(bossChecklist, calamity, "Astrum Aureus", order, type, DownedAureus, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Plaguebringer Goliath + { + BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}] in the Jungle Biome"; + string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); + AddBoss(bossChecklist, calamity, "Plaguebringer Goliath", order, type, DownedPBG, summon, loot, collection, instructions, despawn); + } + + // Ravager + { + BossDifficulty.TryGetValue("Ravager", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The automaton of misshapen victims went looking for the true perpetrator.", new Color(0xB2, 0x22, 0x22)); + string bossLogTex = "CalamityMod/NPCs/Ravager/Ravager_BossChecklist"; + AddBoss(bossChecklist, calamity, "Ravager", order, segments, DownedRavager, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Astrum Deus + { + BossDifficulty.TryGetValue("AstrumDeus", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Defeat 3 empowered astral titans or use a [i:{summon}] at Night"; + string despawn = CalamityUtils.ColorMessage("The infected deity retreats to the heavens.", new Color(0xFF, 0xD7, 0x00)); + string bossLogTex = "CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist"; + AddBoss(bossChecklist, calamity, "Astrum Deus", order, segments, DownedDeus, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Profaned Guardians + { + BossDifficulty.TryGetValue("ProfanedGuardians", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Hallow or Underworld Biomes"; + string despawn = CalamityUtils.ColorMessage("The guardians must protect their goddess at all costs.", new Color(0xFF, 0xA5, 0x00)); + string bossLogTex = "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist"; + AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Bumblebirb + { + BossDifficulty.TryGetValue("Bumblebirb", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use [i:{summon}] in the Jungle Biome"; + string despawn = CalamityUtils.ColorMessage("The failed experiment returns into its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); + AddBoss(bossChecklist, calamity, "Bumblebirb", order, type, DownedBirb, summon, loot, collection, instructions, despawn); + } + + // Providence + { + BossDifficulty.TryGetValue("Providence", out float order); + List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + List summons = new List() { ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use either [i:{ItemType()}] or [i:{ItemType()}] in the Hallow or Underworld Biomes"; + string despawn = CalamityUtils.ColorMessage("The Profaned Goddess vanishes in a burning blaze.", new Color(0xFF, 0xA5, 0x00)); + string bossLogTex = "CalamityMod/NPCs/Providence/Providence_BossChecklist"; + AddBoss(bossChecklist, calamity, "Providence", order, bosses, DownedProvidence, summons, loot, collection, instructions, despawn, bossLogTex); + } + + // Ceaseless Void + { + BossDifficulty.TryGetValue("CeaselessVoid", out float order); + List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Dungeon"; + string despawn = CalamityUtils.ColorMessage("The rift in time and space has moved away from your reach.", new Color(0x4B, 0x00, 0x82)); + AddBoss(bossChecklist, calamity, "Ceaseless Void", order, bosses, DownedCeaselessVoid, summon, loot, collection, instructions, despawn); + } + + // Storm Weaver + { + BossDifficulty.TryGetValue("StormWeaver", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in Space"; + string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE)); + string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist"; + AddBoss(bossChecklist, calamity, "Storm Weaver", order, segments, DownedStormWeaver, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Signus + { + BossDifficulty.TryGetValue("Signus", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Underworld"; + string despawn = CalamityUtils.ColorMessage("The Devourer's assassin has finished its easy task.", new Color(0xBA, 0x55, 0xD3)); + AddBoss(bossChecklist, calamity, "Signus", order, type, DownedSignus, summon, loot, collection, instructions, despawn); + } + + // Polterghast + { + BossDifficulty.TryGetValue("Polterghast", out float order); + List bosses = new List() { NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Kill 30 phantom spirits or use a [i:{summon}] in the Dungeon"; + string despawn = CalamityUtils.ColorMessage("The volatile spirits disperse throughout the depths of the dungeon.", new Color(0xB0, 0xE0, 0xE6)); + AddBoss(bossChecklist, calamity, "Polterghast", order, bosses, DownedPolterghast, summon, loot, collection, instructions, despawn); + } + + // Devourer of Gods + { + BossDifficulty.TryGetValue("DevourerOfGods", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); + string bossLogTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist"; + string bossHeadTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; + AddBoss(bossChecklist, calamity, "Devourer of Gods", order, type, DownedDoG, summon, loot, collection, instructions, despawn, bossLogTex, bossHeadTex); + } + + // Yharon + { + BossDifficulty.TryGetValue("Yharon", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Jungle Biome"; + // TODO -- this setup code is only run once, so the despawn message can't be changed post-eclipse. Find a way around this. + string despawn = CalamityUtils.ColorMessage("Yharon found you too weak to stay near your gravestone.", new Color(0xFF, 0xA5, 0x00)); + string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_BossChecklist"; + AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, loot, collection, instructions, despawn, bossLogTex); + } + + // Supreme Calamitas + { + BossDifficulty.TryGetValue("SupremeCalamitas", out float order); + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType() }; + string instructions = $"Use an [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); + AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summon, loot, collection, instructions, despawn); + } + } + + private static void AddCalamityBossLoot(Mod bossChecklist) + { + // King Slime + AddLoot(bossChecklist, "KingSlime", + new List() { ItemType() }, + new List() { ItemType() } + ); + + // Eye of Cthulhu + AddLoot(bossChecklist, "EyeofCthulhu", + new List() { ItemType(), ItemType(), ItemType() }, + new List() { ItemType() } + ); + + // Eater of Worlds + AddLoot(bossChecklist, "EaterofWorldsHead", + null, + new List() { ItemType(), ItemType() } + ); + + // Brain of Cthulhu + AddLoot(bossChecklist, "BrainofCthulhu", + null, + new List() { ItemType(), ItemType() } + ); + + // Queen Bee + AddLoot(bossChecklist, "QueenBee", + new List() { ItemType() }, + new List() { ItemType() } + ); + + // Skeletron + AddLoot(bossChecklist, "SkeletronHead", + new List() { ItemType() }, + new List() { ItemType() } + ); + + // Wall of Flesh + AddLoot(bossChecklist, "WallofFlesh", + new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.CorruptionKey, ItemID.CrimsonKey }, + new List() { ItemType(), ItemType(), ItemType() } + ); + + // The Twins + AddLoot(bossChecklist, "TheTwins", + null, + new List() { ItemType(), ItemType() } + ); + + // The Destroyer + AddLoot(bossChecklist, "TheDestroyer", + new List() { ItemType() }, + new List() { ItemType(), ItemType() } + ); + + // Skeletron Prime + AddLoot(bossChecklist, "SkeletronPrime", + null, + new List() { ItemType(), ItemType() } + ); + + // Plantera + AddLoot(bossChecklist, "Plantera", + new List() { ItemType(), ItemType(), ItemID.JungleKey }, + new List() { ItemType() } + ); + AddSummons(bossChecklist, "Plantera", new List() { ItemType() }); + + // Golem + AddLoot(bossChecklist, "Golem", + new List() { ItemType(), ItemType() }, + new List() { ItemType() } + ); + AddSummons(bossChecklist, "Golem", new List() { ItemType() }); + + // Duke Fishron + AddLoot(bossChecklist, "DukeFishron", + new List() { ItemType(), ItemType() }, + new List() { ItemType() } + ); + + // Betsy + AddLoot(bossChecklist, "DD2Betsy", + null, + new List() { ItemType() } + ); + + // Lunatic Cultist + AddLoot(bossChecklist, "CultistBoss", + new List() { ItemType(), ItemType() }, + new List() { ItemType(), ItemType() } + ); + AddSummons(bossChecklist, "CultistBoss", new List() { ItemType() }); + + // Moon Lord + AddLoot(bossChecklist, "MoonLord", + new List() { ItemType(), ItemType(), ItemType(), ItemType() }, + new List() { ItemType() } + ); + } + + private static void AddCalamityEventLoot(Mod bossChecklist) + { + // Blood Moon + AddLoot(bossChecklist, "Blood Moon", + new List() { ItemType(), ItemType(), ItemType() }, + null + ); + AddSummons(bossChecklist, "Blood Moon", new List() { ItemType() }); + + // Goblin Army + AddLoot(bossChecklist, "Goblin Army", + new List() { ItemType(), ItemType(), ItemType(), ItemType() }, + null + ); + + // Pirates + AddLoot(bossChecklist, "Pirate Invasion", + new List() { ItemType(), ItemType(), ItemType() }, + null + ); + + // Solar Eclipse + AddLoot(bossChecklist, "Solar Eclipse", + new List() { ItemType(), ItemType(), ItemType() }, + null + ); + + // Pumpkin Moon + AddLoot(bossChecklist, "Pumpkin Moon", + new List() { ItemType() }, + null + ); + AddLoot(bossChecklist, "Pumpking", + new List() { ItemType() }, + null + ); + + // Frost Moon + AddLoot(bossChecklist, "Frost Moon", + new List() { ItemType(), ItemType() }, + null + ); + AddLoot(bossChecklist, "Ice Queen", + new List() { ItemType() }, + null + ); + + // Martian Madness + AddLoot(bossChecklist, "Martian Madness", + new List() { ItemType(), ItemType(), ItemType() }, + null + ); + AddLoot(bossChecklist, "Martian Saucer", + new List() { ItemType() }, + null + ); + + // Lunar Events + AddLoot(bossChecklist, "Lunar Event", + new List() { ItemType() }, + null + ); + } + + private static void FargosSupport() + { + Mod fargos = ModLoader.GetMod("Fargowiltas"); + if (fargos is null) + return; + + // Mark Fargo's Mutant Mod as loaded so that Calamity doesn't add ANY boss summons to vanilla NPCs, even for its own bosses + GetInstance().fargosMutant = true; + + void AddToMutantShop(string bossName, string summonItemName, Func downed, int price) + { + BossDifficulty.TryGetValue(bossName, out float order); + fargos.Call("AddSummon", order, "CalamityMod", summonItemName, downed, price); + } + + AddToMutantShop("Crabulon", "DecapoditaSprout", DownedCrabulon, Item.buyPrice(gold: 4)); + AddToMutantShop("HiveMind", "Teratoma", DownedHiveMind, Item.buyPrice(gold: 10)); + AddToMutantShop("Perforators", "BloodyWormFood", DownedPerfs, Item.buyPrice(gold: 10)); + AddToMutantShop("SlimeGod", "OverloadedSludge", DownedSlimeGod, Item.buyPrice(gold: 15)); + AddToMutantShop("BrimstoneElemental", "CharredIdol", DownedBrimstoneElemental, Item.buyPrice(gold: 20)); + AddToMutantShop("AstrumAureus", "AstralChunk", DownedAureus, Item.buyPrice(gold: 25)); + AddToMutantShop("PlaguebringerGoliath", "Abombination", DownedPBG, Item.buyPrice(gold: 50)); + AddToMutantShop("Ravager", "AncientMedallion", DownedRavager, Item.buyPrice(gold: 50)); + AddToMutantShop("ProfanedGuardians", "ProfanedShard", DownedGuardians, Item.buyPrice(platinum: 5)); + AddToMutantShop("Bumblebirb", "BirbPheromones", DownedBirb, Item.buyPrice(platinum: 5)); + } + + private static void CensusSupport() + { + Mod censusMod = ModLoader.GetMod("Census"); + if (censusMod != null) + { + censusMod.Call("TownNPCCondition", NPCType(), "Defeat a Giant Clam after defeating the Desert Scourge"); + censusMod.Call("TownNPCCondition", NPCType(), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); + censusMod.Call("TownNPCCondition", NPCType(), "Have [i:" + ItemType() + "] in your inventory in Hardmode"); + censusMod.Call("TownNPCCondition", NPCType(), "Defeat Cryogen"); + } + } private static void SummonersAssociationSupport() { - Mod SummonersAssociation = ModLoader.GetMod("SummonersAssociation"); - if(SummonersAssociation != null) + Mod sAssociation = ModLoader.GetMod("SummonersAssociation"); + if(sAssociation != null) { - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), new List() {ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType()}, new List() {(1f-0.6666666f), 0.3333333f, 0.3333333f}); //Entropy's Vigil is a bruh moment - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), new List() {ModContent.ProjectileType(), ModContent.ProjectileType()}); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType(), 1f); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); - SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType(), ProjectileType()}, new List() {1f-0.6666666f, 0.3333333f, 0.3333333f}); + //Entropy's Vigil is a bruh moment + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType()}); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType(), 1f); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); } } - } + } } diff --git a/NPCs/Abyss/Catfish.cs b/NPCs/Abyss/Catfish.cs index 177ef4e248..74a8fd3345 100644 --- a/NPCs/Abyss/Catfish.cs +++ b/NPCs/Abyss/Catfish.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Materials; using CalamityMod.World; using System; using System.IO; @@ -210,7 +211,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } @@ -251,7 +252,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 25); + DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 67dec3f4bf..739ff992a4 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -522,7 +522,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 1e4e6c8bb5..2d9392f00e 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return brokenMask; } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index dc7fb26ca2..fa38820a2e 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -446,7 +446,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return detectsPlayer; } diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 404c31eff8..f6b912278b 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -455,7 +455,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return detectsPlayer; } diff --git a/NPCs/Abyss/Flounder.cs b/NPCs/Abyss/Flounder.cs index 06dd60e888..186a47c74b 100644 --- a/NPCs/Abyss/Flounder.cs +++ b/NPCs/Abyss/Flounder.cs @@ -282,10 +282,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Frogfish.cs b/NPCs/Abyss/Frogfish.cs index 017429266d..ab5c6995d8 100644 --- a/NPCs/Abyss/Frogfish.cs +++ b/NPCs/Abyss/Frogfish.cs @@ -251,10 +251,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index ec4b9ae967..430a054eca 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/Gnasher.cs b/NPCs/Abyss/Gnasher.cs index 66bcd7bc69..4717e964a7 100644 --- a/NPCs/Abyss/Gnasher.cs +++ b/NPCs/Abyss/Gnasher.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -109,10 +110,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.hardMode && Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); - } + DropHelper.DropItemCondition(npc, ItemID.TurtleShell, Main.hardMode, 10, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index c4dcfc7a71..cdc7c2acaf 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -343,7 +343,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return detectsPlayer; } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index d926ddc4ac..a8ecfee816 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 1b2b7c3960..9716346b52 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/Mauler.cs b/NPCs/Abyss/Mauler.cs index b7e1e1090d..5bef5db037 100644 --- a/NPCs/Abyss/Mauler.cs +++ b/NPCs/Abyss/Mauler.cs @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } @@ -350,13 +350,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); 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); diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index ee4ac1fe71..2d13f653de 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -159,6 +159,13 @@ namespace CalamityMod.NPCs.Abyss } } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + return false; + return null; + } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index cfb4e6eaa1..c155a9971e 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -216,7 +216,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 15); - DropHelper.DropItemChance(npc, ItemID.Flipper, 25); + DropHelper.DropItemChance(npc, ItemID.Flipper, 20); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 88373753d8..3be5385cec 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -622,7 +622,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/SeaUrchin.cs b/NPCs/Abyss/SeaUrchin.cs index 2a804219ff..13c71a7023 100644 --- a/NPCs/Abyss/SeaUrchin.cs +++ b/NPCs/Abyss/SeaUrchin.cs @@ -325,7 +325,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(15, 26)); + DropHelper.DropItem(npc, ModContent.ItemType(), 15, 25); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index a787b3490e..def272c924 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Abyss/Trasher.cs b/NPCs/Abyss/Trasher.cs index 16d84e4d1f..e44866e80e 100644 --- a/NPCs/Abyss/Trasher.cs +++ b/NPCs/Abyss/Trasher.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Pets; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -291,7 +292,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } @@ -354,18 +355,10 @@ namespace CalamityMod.NPCs.Abyss NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); NPC.savedAngler = true; } - if (Main.rand.NextBool(25)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - if (Main.rand.NextBool(20)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(10) && Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gatligator); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); + DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 20); + DropHelper.DropItemCondition(npc, ItemID.Gatligator, Main.hardMode, 10, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index ae77ce4572..6d27efdca2 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -219,7 +219,7 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs new file mode 100644 index 0000000000..0d6f3dfe1b --- /dev/null +++ b/NPCs/AcidRain/AcidEel.cs @@ -0,0 +1,106 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class AcidEel : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Eel"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.width = 72; + npc.height = 18; + npc.defense = 4; + npc.damage = 58; + npc.LifeMaxNERB(Main.expertMode ? 500 : 455, 500); + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 3, 32); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.aiStyle = -1; + aiType = -1; + npc.lavaImmune = false; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void AI() + { + npc.TargetClosest(false); + + if (npc.wet) + { + npc.ai[1] += 1f; + if (npc.ai[1] % 150f == 0f || npc.direction == 0) + { + npc.direction = (Main.player[npc.target].position.X > npc.position.X).ToDirectionInt(); + } + npc.velocity.X += npc.direction * 0.3f; + + if (npc.collideX) + npc.direction *= -1; + + npc.spriteDirection = npc.direction; + + npc.velocity.Y += (Main.player[npc.target].position.Y > npc.position.Y).ToDirectionInt() * 0.075f; + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-15f, -3f), new Vector2(15f, 3f)); + npc.rotation = npc.velocity.X * 0.02f; + } + else + { + npc.rotation = npc.rotation.AngleLerp(0f, 0.1f); + npc.velocity.X *= 0.95f; + if (npc.velocity.Y < 14f) + npc.velocity.Y += 0.15f; + } + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 5) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 8; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore3"), npc.scale); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/NPCs/AcidRain/AcidEel.png b/NPCs/AcidRain/AcidEel.png new file mode 100644 index 0000000000..1f913c9b1e Binary files /dev/null and b/NPCs/AcidRain/AcidEel.png differ diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs new file mode 100644 index 0000000000..8e37e3e65b --- /dev/null +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -0,0 +1,68 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.AcidRain +{ + public class BloodwormFleeing : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodworm"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 12; + npc.height = 42; + npc.defense = 0; + npc.lifeMax = 5; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit20; + npc.DeathSound = SoundID.NPCDeath12; + } + + public override void AI() + { + Player player = Main.player[Player.FindClosest(npc.Center, 1, 1)]; + if (npc.velocity == Vector2.Zero) + npc.velocity = Vector2.UnitY * 12f; + float intertia = 24f; + npc.velocity = (npc.velocity * intertia - npc.DirectionTo(player.Center) * 12f) / (intertia + 1f); + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 5) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/AcidRain/BloodwormFleeing.png b/NPCs/AcidRain/BloodwormFleeing.png new file mode 100644 index 0000000000..daf475a2da Binary files /dev/null and b/NPCs/AcidRain/BloodwormFleeing.png differ diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs new file mode 100644 index 0000000000..be417a321c --- /dev/null +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -0,0 +1,112 @@ +using CalamityMod.Items.SummonItems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.AcidRain +{ + public class BloodwormNormal : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodworm"); + Main.npcFrameCount[npc.type] = 7; + Main.npcCatchable[npc.type] = true; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 36; + npc.height = 16; + npc.defense = 0; + npc.lifeMax = 5; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.catchItem = (short)ModContent.ItemType(); + npc.dontTakeDamageFromHostiles = true; + } + + public override void AI() + { + if (npc.collideY) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = Main.rand.NextBool(2).ToDirectionInt(); + npc.netUpdate = true; + } + if (npc.collideX) + { + npc.ai[0] *= -1; + } + } + float xSpeed = 3f; + npc.velocity.X = xSpeed * npc.ai[0]; + npc.spriteDirection = (int)npc.ai[0]; + bool flee = false; + for (int i = 0; i < Main.player.Length; i++) + { + Player player = Main.player[i]; + if (player.active && !player.dead && Vector2.Distance(player.Center, npc.Center) <= 220f) + { + flee = true; + break; + } + } + int timeBeforeFlee = 60; + if (flee && npc.ai[1] < timeBeforeFlee) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] == timeBeforeFlee && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.position.Y += 16f; + npc.Transform(ModContent.NPCType()); + npc.netUpdate = true; + return; + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 6) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + } + } + public override void OnCatchNPC(Player player, Item item) + { + try + { + + } + catch + { + return; + } + } + } +} diff --git a/NPCs/AcidRain/BloodwormNormal.png b/NPCs/AcidRain/BloodwormNormal.png new file mode 100644 index 0000000000..b33cd58a7e Binary files /dev/null and b/NPCs/AcidRain/BloodwormNormal.png differ diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs new file mode 100644 index 0000000000..976cbd4d12 --- /dev/null +++ b/NPCs/AcidRain/NuclearToad.cs @@ -0,0 +1,128 @@ +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class NuclearToad : ModNPC + { + public const float ExplodeDistance = 185f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Toad"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.width = 62; + npc.height = 34; + npc.defense = 4; + npc.damage = 75; + npc.lifeMax = 255; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 302; + } + public override void AI() + { + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + // Hover on the top of the water + if (npc.wet) + { + if (npc.velocity.Y > 2f) + { + npc.velocity.Y *= 0.9f; + } + npc.velocity.Y -= 0.16f; + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < -2f) + { + npc.velocity.Y *= 0.9f; + } + npc.velocity.Y += 0.16f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + npc.ai[0] = 5f; + } + if (npc.Distance(player.Center) < ExplodeDistance) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 7; i++) + { + float angle = Main.rand.NextFloat(MathHelper.TwoPi); + Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * Main.rand.NextFloat(6f, 9f), ModContent.ProjectileType(), 27, 1f); + } + } + npc.life = 0; + npc.HitEffect(); + npc.netUpdate = true; + npc.active = false; + } + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 4) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 8; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore1"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore3"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore4"), npc.scale); + for (int i = 0; i < 25; i++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } +} diff --git a/NPCs/AcidRain/NuclearToad.png b/NPCs/AcidRain/NuclearToad.png new file mode 100644 index 0000000000..2aa70fa1f1 Binary files /dev/null and b/NPCs/AcidRain/NuclearToad.png differ diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs new file mode 100644 index 0000000000..ce739cf600 --- /dev/null +++ b/NPCs/AcidRain/Orthocera.cs @@ -0,0 +1,167 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class Orthocera : ModNPC + { + public const float MaxSpeed = 10.5f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orthocera"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.width = 62; + npc.height = 34; + npc.defense = 10; + npc.damage = 60; + npc.lifeMax = 380; + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 4, 20); + npc.lavaImmune = false; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath13; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 500; + } + public override void AI() + { + npc.TargetClosest(false); + npc.ai[1] += 1f; + if (npc.target >= 0 && npc.target < 255) + { + Player player = Main.player[npc.target]; + // Swim + if (npc.ai[1] % 250f < 180f) + { + if (npc.wet) + { + // Reset so we can jum again. + npc.ai[3] = 0f; + + // Swim towards the player if we're not too close. + // If we're close, simply resume our current movement. + if (npc.Distance(player.Center) > 150f) + { + npc.velocity = (npc.velocity * 17f + npc.DirectionTo(player.Center) * MaxSpeed) / 18f; + npc.ai[0] = 12f; + } + // Variable for X movement later. + // It seems to slow down for some dumb reason in the jump phase without this value + npc.ai[2] = npc.velocity.X; + + // Make sure the value isn't 0 since we're relying on multiplication + if (npc.ai[2] == 0f) + npc.ai[2] = 0.1f; + + if (Math.Abs(npc.ai[2]) < 7f) + npc.ai[2] = Math.Abs(npc.ai[2]) * 7f; + if (Math.Abs(npc.ai[2]) > 16f) + npc.ai[2] = Math.Abs(npc.ai[2]) * 16f; + npc.ai[2] = Math.Abs(npc.ai[2]) * (player.Center.X - npc.Center.X > 0).ToDirectionInt(); + } + else + { + if (npc.ai[0] <= 0f) + npc.velocity.Y += 0.2f; + else + npc.ai[0] -= 1f; + } + npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + } + // And jump/shoot + else if (npc.ai[1] % 220f > 180f) + { + if (npc.ai[1] % 220f < 200f) + { + npc.velocity.Y -= 0.05f; + } + else + { + npc.velocity.Y += 0.05f; + } + if (npc.ai[1] % 220f == 219f) + npc.ai[3] = 1f; + if (!npc.wet) + npc.velocity.X = npc.ai[2]; + } + // Don't jump mid-air + if (npc.ai[1] % 220f > 180f && npc.ai[3] == 1f) + npc.ai[1] = 0f; + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4 + MathHelper.PiOver2 + MathHelper.Pi; + + if (npc.spriteDirection == -1) + npc.rotation -= MathHelper.PiOver2; + // If sitting on land, slow down and, if in the middle of a jump, release a stream of acid. + if (!npc.wet) + { + npc.velocity.X *= 0.92f; + // Spit out a stream of acid based on our rotation + if (npc.ai[1] % 220f == 195f) + { + float rotation = npc.rotation - MathHelper.Pi - MathHelper.PiOver2 - MathHelper.PiOver4; + if (npc.spriteDirection == -1) + rotation += MathHelper.PiOver2; + + Projectile.NewProjectile(npc.Center, rotation.ToRotationVector2() * 12f, ModContent.ProjectileType(), 27, 2f); + } + } + // Prevent yeeting into the sky at the speed of light + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-MaxSpeed), new Vector2(MaxSpeed)); + } + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 6) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore2"), npc.scale); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/NPCs/AcidRain/Orthocera.png b/NPCs/AcidRain/Orthocera.png new file mode 100644 index 0000000000..f835bc06a6 Binary files /dev/null and b/NPCs/AcidRain/Orthocera.png differ diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs new file mode 100644 index 0000000000..b48b1be021 --- /dev/null +++ b/NPCs/AcidRain/Skyfin.cs @@ -0,0 +1,150 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class Skyfin : ModNPC + { + public const float DiveDelay = 120f; + public const float DiveTime = 90f; + public const float TotalTime = DiveDelay + DiveTime; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyfin"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.width = 46; + npc.height = 22; + npc.defense = 6; + npc.damage = 62; + npc.lifeMax = 280; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 3, 65); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 333; + } + public override void AI() + { + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + npc.ai[0] += 1f; + if (npc.ai[1] > 0f) + npc.ai[1] -= 1f; + if (npc.wet) + { + // Swim around, moving towards the player + bool canSwimToPlayer = Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); + if (canSwimToPlayer) + { + if (npc.ai[0] % 55f == 54f) + { + npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 27f; + } + if ((Math.Abs(player.Center.Y - npc.Center.Y) > 50f && player.wet) || (!player.wet && npc.ai[1] <= 0f)) + { + npc.velocity.Y = (player.Center.Y - npc.Center.Y > 0).ToDirectionInt() * 6f; + } + if (Math.Abs(npc.velocity.X) < 6f) + npc.velocity.X *= 1.04f; + } + else if (!canSwimToPlayer && Math.Abs(npc.velocity.Y) < 4f) + { + npc.velocity.Y *= 0.97f; + } + // Turn around if we hit a tile on the X axis + if (!canSwimToPlayer && npc.collideX) + { + npc.velocity.X *= -1f; + } + + // Check if we can dive + if (player.Center.Y < npc.Top.Y - 10f && + npc.ai[1] <= 0f) + { + npc.ai[1] = TotalTime; + npc.ai[2] = (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f; + } + } + else + { + // Dive upward in an attempt to hit to the player + if (npc.ai[1] > TotalTime - DiveTime) + { + npc.velocity.X = npc.ai[2]; + if (npc.ai[1] > TotalTime - DiveTime * 0.5f) + npc.velocity.Y -= 0.135f; + else + npc.velocity.Y += 0.2f; + } + else + { + // Don't fall too fast because of wings + npc.velocity.Y += 0.1f; + } + } + npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + // If sitting on land, rotate in a way that looks like we're stuck on the ground + if (!npc.wet) + { + npc.velocity.X *= 0.92f; + } + npc.rotation = npc.velocity.ToRotation() + + (npc.direction > 0).ToInt() * MathHelper.Pi; + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 5) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 8; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore3"), npc.scale); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/NPCs/AcidRain/Skyfin.png b/NPCs/AcidRain/Skyfin.png new file mode 100644 index 0000000000..42c3aa3d2a Binary files /dev/null and b/NPCs/AcidRain/Skyfin.png differ diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs new file mode 100644 index 0000000000..2a4a58af76 --- /dev/null +++ b/NPCs/AcidRain/Trilobite.cs @@ -0,0 +1,146 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class Trilobite : ModNPC + { + // When the abs(velocity) is less than this, lunge in the water + public const float MinSpeedLungePrompt = 0.5f; + public const float MinYDriftSpeed = 0.9f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trilobite"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.width = 36; + npc.height = 38; + npc.defense = 20; + npc.damage = 47; + npc.lifeMax = 405; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 4, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit42; + npc.DeathSound = SoundID.NPCDeath27; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 450; + } + public override void AI() + { + npc.TargetClosest(false); + if (npc.ai[0] > 0) + npc.ai[0]--; + if (!npc.wet) + { + if (npc.ai[0] > 0) + npc.ai[0]--; + npc.rotation += npc.velocity.X * 0.1f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X *= 0.99f; + if (Math.Abs(npc.velocity.X) < 0.01f) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y += 0.3f; + if (npc.velocity.Y > 13f) + { + npc.velocity.Y = 13f; + } + } + else + { + Player player = Main.player[npc.target]; + if (npc.velocity.Length() < MinSpeedLungePrompt) + { + npc.TargetClosest(true); + npc.velocity = npc.DirectionTo(player.Center) * 24f; + npc.velocity.X *= 1.6f; + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + } + else + { + npc.velocity.X += npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (Math.Abs(npc.velocity.Y) < MinYDriftSpeed) + { + npc.velocity.Y *= 0.9925f; + } + else if (Math.Abs(npc.velocity.X) < 2f) + { + npc.velocity = npc.DirectionTo(player.Center) * new Vector2(36f, 9f); + } + } + } + } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] <= 0f) + { + Projectile.NewProjectile(npc.Center + Utils.NextVector2Unit(Main.rand) * npc.Size * 0.7f, + -npc.velocity.RotatedByRandom(MathHelper.ToRadians(10f)), ModContent.ProjectileType(), + 24, 3f); + npc.ai[0] = Main.rand.Next(50, 65); + npc.netUpdate = true; + } + } + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 4) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore3"), npc.scale); + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/NPCs/AcidRain/Trilobite.png b/NPCs/AcidRain/Trilobite.png new file mode 100644 index 0000000000..7d2f8b1eb7 Binary files /dev/null and b/NPCs/AcidRain/Trilobite.png differ diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs new file mode 100644 index 0000000000..497a8fcd6b --- /dev/null +++ b/NPCs/AcidRain/WaterLeech.cs @@ -0,0 +1,141 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class WaterLeech : ModNPC + { + public const float SwimIntertia = 24f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Leech"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.width = 26; + npc.height = 14; + npc.defense = 10; + npc.damage = 55; + npc.lifeMax = 75; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 2, 5); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 100; + } + public override void AI() + { + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + // Latch onto player + if (npc.ai[0] == 1f) + { + if (!player.active || player.dead) + { + // Revert back to swimming around after successfully devouring the player + npc.ai[0] = 0f; + return; + } + // Stick to player and make them bleed + if (npc.ai[1] > 0f) + { + npc.position = player.position; + npc.ai[1] -= 1f; + player.AddBuff(BuffID.Bleeding, 180); + } + // Die + else + { + for (int i = 0; i < 25; i++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); + } + npc.life = 0; + npc.HitEffect(); + npc.netUpdate = true; + npc.active = false; + } + return; + } + if (!npc.wet) + { + npc.velocity.X *= 0.97f; + npc.velocity.Y += 0.5f; + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.life = 0; + npc.HitEffect(); + npc.netUpdate = true; + npc.active = false; + } + } + else if (player.wet) + { + float speed = player.wet ? 23f : 15f; + if (npc.Distance(player.Center) < 26f) + { + npc.ai[0] = 1f; + npc.ai[1] = 300f; + } + npc.velocity = (npc.velocity * (SwimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / SwimIntertia; + } + else if (!player.wet) + { + npc.velocity *= 0.9f; + } + npc.dontTakeDamage = !player.wet; + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter >= 4) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + { + npc.frame.Y = 0; + } + } + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) + { + return 0f; + } + return 0.115f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 8; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/NPCs/AcidRain/WaterLeech.png b/NPCs/AcidRain/WaterLeech.png new file mode 100644 index 0000000000..17bc7c88b0 Binary files /dev/null and b/NPCs/AcidRain/WaterLeech.png differ diff --git a/NPCs/AcidRain/WaterLeechGlow.png b/NPCs/AcidRain/WaterLeechGlow.png new file mode 100644 index 0000000000..48aaa585d2 Binary files /dev/null and b/NPCs/AcidRain/WaterLeechGlow.png differ diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 0536dc7aaa..59f6fe5f8d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return npc.Calamity().newAI[0] == 1f; } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index 5a9f61731f..b6cd131321 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -338,7 +338,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(15, 26)); + DropHelper.DropItem(npc, ModContent.ItemType(), 15, 25); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 964cf9b76c..dd5ee4f390 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -127,6 +128,10 @@ namespace CalamityMod.NPCs.Astral { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); } + if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); + } } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 3131b0aa76..a29aa9f10b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -7,6 +7,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Potions; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; @@ -56,6 +57,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -3473,6 +3475,30 @@ namespace CalamityMod.NPCs } } + if (modPlayer.hallowedRune) + { + if (isSummon && npc.damage > 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.AddBuff(ModContent.BuffType(), 120); + break; + + case 1: + player.AddBuff(ModContent.BuffType(), 120); + break; + + case 2: + player.AddBuff(ModContent.BuffType(), 120); + break; + + default: + break; + } + } + } + if (modPlayer.bloodflareSet) { if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life < npc.lifeMax * 0.5) && @@ -3642,6 +3668,12 @@ namespace CalamityMod.NPCs { spawnRate = (int)(spawnRate * 0.7); maxSpawns = (int)(maxSpawns * 1.2f); + + if (player.Calamity().ZoneSulphur && !player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) + { + spawnRate = 23; + maxSpawns = 20; + } } } else if (player.Calamity().ZoneAbyss) @@ -3770,6 +3802,14 @@ namespace CalamityMod.NPCs { pool[0] = 0f; } + if (spawnInfo.player.Calamity().ZoneSulphur && !spawnInfo.player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) + { + pool.Clear(); + foreach (int enemy in AcidRainEvent.PossibleEnemies.Select(enemyType => enemyType.Item1)) + { + pool.Add(enemy, 1f); + } + } } #endregion @@ -4494,7 +4534,17 @@ namespace CalamityMod.NPCs chat = Main.npc[fapsol].GivenName + " is always trying to brighten my mood...even if, deep down, I know she's sad."; } } - + if ((npc.GivenName == "Amber" ? Main.rand.NextBool(10) : Main.rand.NextBool(15)) && Main.LocalPlayer.Calamity().pArtifact) + { + if (Main.LocalPlayer.Calamity().profanedCrystalBuffs) + { + chat = Main.rand.NextBool(2) ? "They look so cute and yet, I can feel their immense power just by being near them. What are you?" : "I hate to break it to you, but you don't have hair to cut or style, hun."; + } + else if (Main.LocalPlayer.Calamity().gDefense && Main.LocalPlayer.Calamity().gOffense) + { + chat = "Aww, they're so cute, do they have names?"; + } + } break; case NPCID.GoblinTinkerer: diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 5c92d6e53f..924c75378f 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.DifficultyItems; @@ -32,6 +33,7 @@ using CalamityMod.NPCs.StormWeaver; using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -755,6 +757,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.armageddon) ArmageddonLoot(npc); + AcidRainProgression(npc); CheckBossSpawn(npc); ArmorSetLoot(npc); RareLoot(npc); @@ -1579,6 +1582,17 @@ namespace CalamityMod.NPCs } #endregion + #region Acid Rain + private void AcidRainProgression(NPC npc) + { + if (AcidRainEvent.PossibleEnemies.Select(enemy => enemy.Item1).Contains(npc.type) && CalamityWorld.rainingAcid) + { + Main.invasionSize -= AcidRainEvent.PossibleEnemies.Find(enemy => enemy.Item1 == npc.type).Item2; + } + AcidRainEvent.UpdateInvasion(); + } + #endregion + #region Common Loot private void CommonLoot(NPC npc) { diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index cf8bd594b9..de6d14ce7a 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index fcfcf771f2..e7f7337063 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 8ac94f0b2e..f6ab96e2f4 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 9d190fe3e4..ff809e9659 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -1073,6 +1074,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Blight Spewer DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 984b6e6163..3767f964f3 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles.FurnitureProfaned; using CalamityMod.Tiles.Ores; @@ -24,8 +25,9 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; + namespace CalamityMod.NPCs.Providence { [AutoloadBossHead] @@ -40,6 +42,7 @@ namespace CalamityMod.NPCs.Providence private int immuneTimer = 300; private int frameUsed = 0; private int healTimer = 0; + private bool challenge = true; //Used to determine if Profaned Soul Crystal should drop. public static float normalDR = 0.35f; public static float cocoonDR = 0.9f; @@ -1141,7 +1144,8 @@ namespace CalamityMod.NPCs.Providence //Accessories clientside only in Expert DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, biomeType != 2 && Main.expertMode); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, biomeType == 2 && Main.expertMode); - + bool psc = challenge && Main.expertMode; + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, psc); //drops pre-scal, cannot be sold, does nothing aka purely vanity. Requires at least expert for consistency with other post scal dev items. // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { @@ -1156,6 +1160,7 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 40); @@ -1193,6 +1198,18 @@ namespace CalamityMod.NPCs.Providence } } + if (psc) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue("Mods.CalamityMod.ProfanedBossText4"), Color.DarkOrange); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey("Mods.CalamityMod.ProfanedBossText4"), Color.DarkOrange); + } + } + // Mark Providence as dead CalamityWorld.downedProvidence = true; CalamityMod.UpdateServerBoolean(); @@ -1319,6 +1336,18 @@ namespace CalamityMod.NPCs.Providence npc.damage = (int)(npc.damage * 0.8f); } + public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) + { + bool goldenGun = projectile.type == ModContent.ProjectileType(); + if (challenge && (!goldenGun && (projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) || Main.player[projectile.owner].Calamity().profanedCrystal)) + challenge = false; + } + + public override void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit) + { + challenge = false; + } + public override void HitEffect(int hitDirection, double damage) { if(npc.soundDelay == 0) diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 8b4335eef4..870ea55717 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index c6e38b5803..2da9967774 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index ed88e73757..9e9fb8ae5a 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index d0afc16470..c78a3fa318 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/GhostBellSmall.cs b/NPCs/SunkenSea/GhostBellSmall.cs index bdd6b1b5c0..636460a826 100644 --- a/NPCs/SunkenSea/GhostBellSmall.cs +++ b/NPCs/SunkenSea/GhostBellSmall.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 8a8836fa32..86f7a413dc 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index 80d8b15ba2..0f4a8058b3 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -246,7 +246,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool? CanBeHitByProjectile(Projectile projectile) { - if (projectile.minion) + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { return hasBeenHit; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 9f662c66d2..da1c5cb0e3 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -144,7 +144,6 @@ namespace CalamityMod.NPCs.Yharon useTornado = bb[5]; startSecondAI = bb[6]; npc.dontTakeDamage = bb[7]; - BitsByte bb2 = reader.ReadByte(); healCounter = reader.ReadInt32(); secondPhasePhase = reader.ReadInt32(); teleportLocation = reader.ReadInt32(); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index aa475be2e3..77a1c2c46a 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -62,6 +62,8 @@ namespace CalamityMod.Projectiles public int lineColor = 0; //holy mother of god, Eater of Shoals was a pain in the ass public bool extorterBoost = false; + public bool overridesMinionDamagePrevention = false; + #region SetDefaults public override void SetDefaults(Projectile projectile) { @@ -517,6 +519,8 @@ namespace CalamityMod.Projectiles projectile.magic = false; projectile.minion = false; rogue = false; + ProjectileID.Sets.MinionShot[projectile.type] = false; + ProjectileID.Sets.SentryShot[projectile.type] = false; } else if (forceRanged) { @@ -527,6 +531,8 @@ namespace CalamityMod.Projectiles projectile.magic = false; projectile.minion = false; rogue = false; + ProjectileID.Sets.MinionShot[projectile.type] = false; + ProjectileID.Sets.SentryShot[projectile.type] = false; } else if (forceMagic) { @@ -537,6 +543,8 @@ namespace CalamityMod.Projectiles projectile.magic = true; projectile.minion = false; rogue = false; + ProjectileID.Sets.MinionShot[projectile.type] = false; + ProjectileID.Sets.SentryShot[projectile.type] = false; } else if (forceRogue) { @@ -547,6 +555,8 @@ namespace CalamityMod.Projectiles projectile.magic = false; projectile.minion = false; rogue = true; + ProjectileID.Sets.MinionShot[projectile.type] = false; + ProjectileID.Sets.SentryShot[projectile.type] = false; } else if (forceMinion) { @@ -1645,9 +1655,9 @@ namespace CalamityMod.Projectiles } else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) { - if (modPlayer.pArtifact) + if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), modPlayer.profanedCrystalBuffs ? 600 : 300); } if (modPlayer.tearMinions) diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs new file mode 100644 index 0000000000..443a006389 --- /dev/null +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -0,0 +1,51 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class NuclearToadGoo : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goop"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.timeLeft = 600; + projectile.tileCollide = true; + projectile.ignoreWater = false; + } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.frame = Main.rand.Next(3); + projectile.localAI[0] = 1f; + } + if (projectile.velocity.Y < 10f) + projectile.velocity.Y += 0.175f; + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 4; i++) + { + int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Enemy/NuclearToadGoo.png b/Projectiles/Enemy/NuclearToadGoo.png new file mode 100644 index 0000000000..988e3482b1 Binary files /dev/null and b/Projectiles/Enemy/NuclearToadGoo.png differ diff --git a/Projectiles/Enemy/OrthoceraStream.cs b/Projectiles/Enemy/OrthoceraStream.cs new file mode 100644 index 0000000000..b62d66ee44 --- /dev/null +++ b/Projectiles/Enemy/OrthoceraStream.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class OrthoceraStream : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Stream"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + } + + public override void AI() + { + projectile.ai[1]++; + if (projectile.ai[1] >= 4f) + { + projectile.tileCollide = true; + } + 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 i = 0; i < 3; i++) + { + Vector2 positionDelta = projectile.velocity / 3f * i; + int spawnDelta = 14; + int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[dustIdx]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.5f; + dust.position -= positionDelta; + } + if (Main.rand.NextBool(8)) + { + int spawnDelta = 16; + int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + Main.dust[dustIdx].velocity *= 0.25f; + Main.dust[dustIdx].velocity += projectile.velocity * 0.5f; + } + } + } +} diff --git a/Projectiles/Enemy/OrthoceraStream.png b/Projectiles/Enemy/OrthoceraStream.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/Enemy/OrthoceraStream.png differ diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs new file mode 100644 index 0000000000..e9b64c31ee --- /dev/null +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class TrilobiteSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 22; + projectile.hostile = true; + projectile.timeLeft = 600; + projectile.tileCollide = true; + projectile.ignoreWater = false; + } + public override void AI() + { + if (projectile.velocity.Y < 10f) + projectile.velocity.Y += 0.25f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Enemy/TrilobiteSpike.png b/Projectiles/Enemy/TrilobiteSpike.png new file mode 100644 index 0000000000..d91935f3d4 Binary files /dev/null and b/Projectiles/Enemy/TrilobiteSpike.png differ diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs new file mode 100644 index 0000000000..20cb99f6d2 --- /dev/null +++ b/Projectiles/Environment/AcidDrop.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class AcidDrop : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 20; + projectile.hostile = true; + projectile.tileCollide = true; + projectile.ignoreWater = false; + projectile.timeLeft = 360; + } + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Water drip + for (int i = 0; i < 4; i++) + { + int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + Dust dust = Main.dust[idx]; + dust.position.X -= 2f; + Main.dust[idx].alpha = 38; + Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].scale = 0.75f; + } + return true; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + // 1 to 3 seconds of poisoned + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(1, 4)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Environment/AcidDrop.png b/Projectiles/Environment/AcidDrop.png new file mode 100644 index 0000000000..f5e4db998f Binary files /dev/null and b/Projectiles/Environment/AcidDrop.png differ diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs new file mode 100644 index 0000000000..fd57ffbdff --- /dev/null +++ b/Projectiles/Environment/HotSteam.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class HotSteam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Steam"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.tileCollide = true; + projectile.ignoreWater = false; + projectile.timeLeft = 30; + } + public override void AI() + { + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 4); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + dust.alpha = 127; + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + } +} diff --git a/Projectiles/Environment/HotSteam.png b/Projectiles/Environment/HotSteam.png new file mode 100644 index 0000000000..3c8f498e7b Binary files /dev/null and b/Projectiles/Environment/HotSteam.png differ diff --git a/Projectiles/Magic/AcidGunStream.cs b/Projectiles/Magic/AcidGunStream.cs new file mode 100644 index 0000000000..f23905b6a5 --- /dev/null +++ b/Projectiles/Magic/AcidGunStream.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class AcidGunStream : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Stream"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + } + + public override void AI() + { + projectile.ai[1]++; + if (projectile.ai[1] >= 4f) + { + projectile.tileCollide = true; + } + 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 i = 0; i < 3; i++) + { + Vector2 positionDelta = projectile.velocity / 3f * i; + int spawnDelta = 14; + int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[dustIdx]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.5f; + dust.position -= positionDelta; + } + if (Main.rand.NextBool(8)) + { + int spawnDelta = 16; + int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + Main.dust[dustIdx].velocity *= 0.25f; + Main.dust[dustIdx].velocity += projectile.velocity * 0.5f; + } + } + } +} diff --git a/Projectiles/Magic/AcidGunStream.png b/Projectiles/Magic/AcidGunStream.png new file mode 100644 index 0000000000..2f776c6c06 Binary files /dev/null and b/Projectiles/Magic/AcidGunStream.png differ diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs new file mode 100644 index 0000000000..2eb7bb14ca --- /dev/null +++ b/Projectiles/Magic/EternityBook.cs @@ -0,0 +1,84 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EternityBook : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Visage"); + Main.projFrames[projectile.type] = 8; + } + + 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() + { + Player player = Main.player[projectile.owner]; + + projectile.Center = player.Center + 19f * player.direction * Vector2.UnitX; + + if (player.channel && !player.noItems && !player.CCed) + { + projectile.ai[0]++; + if (projectile.ai[0] == 1f) + { + NPC target = projectile.Center.ClosestNPCAt(4400f, true); + + if (target != null) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay")); + int hex = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, player.whoAmI, target.whoAmI); + Main.projectile[hex].localAI[1] = projectile.whoAmI; + for (int i = 0; i < 5f; i++) + { + float theta = MathHelper.TwoPi / 5f * i; + int idx = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, target.whoAmI, theta); + Main.projectile[idx].frame = i % 2; + Main.projectile[idx].localAI[1] = projectile.whoAmI; + } + for (int i = 0; i < 10f; i++) + { + float theta = MathHelper.TwoPi / 10f * i; + int idx = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, target.whoAmI, theta); + Main.projectile[idx].localAI[1] = projectile.whoAmI; + } + } + } + projectile.frameCounter++; + if (projectile.frameCounter > (int)MathHelper.Lerp(10f, 1f, MathHelper.Clamp(projectile.ai[0] / 200f, 0f, 1f))) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + else projectile.Kill(); + + projectile.spriteDirection = projectile.direction = player.direction; + projectile.timeLeft = 2; + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (projectile.direction * projectile.velocity).ToRotation(); + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Magic/EternityBook.png b/Projectiles/Magic/EternityBook.png new file mode 100644 index 0000000000..1127e8d453 Binary files /dev/null and b/Projectiles/Magic/EternityBook.png differ diff --git a/Projectiles/Magic/EternityCircle.cs b/Projectiles/Magic/EternityCircle.cs new file mode 100644 index 0000000000..3157d8ee14 --- /dev/null +++ b/Projectiles/Magic/EternityCircle.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EternityCircle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternity"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = EternityHex.trueTimeLeft; + projectile.alpha = 255; + projectile.magic = true; + } + + public override void AI() + { + // Circle around the enemy + if (!Main.npc[(int)projectile.ai[0]].active) + { + projectile.active = false; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = Main.rand.NextFloat(MathHelper.TwoPi); + } + projectile.position = Main.npc[(int)projectile.ai[0]].Center + projectile.ai[1].ToRotationVector2() * 670f; + projectile.ai[1] += MathHelper.ToRadians(3.5f); + + projectile.localAI[0] += 0.18f; + + if (projectile.localAI[1] >= Main.projectile.Length || projectile.localAI[0] < 0) + { + projectile.Kill(); + return; + } + + Projectile book = Main.projectile[(int)projectile.localAI[1]]; + + if (!book.active) + { + projectile.Kill(); + return; + } + + float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(projectile.localAI[0] * 3f); + float radius = 8f; + Vector2 offset = angle.ToRotationVector2() * pulse * radius; + Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 132, Vector2.Zero); + dust.noGravity = true; + dust = Dust.NewDustPerfect(projectile.Center - offset, 133, Vector2.Zero); + dust.noGravity = true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/EternityCircle.png b/Projectiles/Magic/EternityCircle.png new file mode 100644 index 0000000000..5a928deac0 Binary files /dev/null and b/Projectiles/Magic/EternityCircle.png differ diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs new file mode 100644 index 0000000000..2ff624e32f --- /dev/null +++ b/Projectiles/Magic/EternityCrystal.cs @@ -0,0 +1,172 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EternityCrystal : ModProjectile + { + public float Radius = 480f; + public float DegreesToSpin = 2f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 36; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = EternityHex.trueTimeLeft; + projectile.alpha = 0; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.localAI[1] >= Main.projectile.Length || projectile.localAI[0] < 0) + { + DeathDust(); + projectile.Kill(); + return; + } + + Projectile book = Main.projectile[(int)projectile.localAI[1]]; + + if (!book.active) + { + DeathDust(); + projectile.Kill(); + return; + } + + if (projectile.ai[0] >= Main.npc.Length || projectile.ai[0] < 0) + { + DeathDust(); + projectile.Kill(); + return; + } + + if (!Main.npc[(int)projectile.ai[0]].active) + { + DeathDust(); + projectile.Kill(); + return; + } + + projectile.localAI[0] += 1f; + if (projectile.timeLeft == 1) + { + projectile.velocity = projectile.DirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 2f; + projectile.timeLeft = 1000; + } + if (projectile.timeLeft < 920 && projectile.timeLeft > EternityHex.trueTimeLeft || + CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 10) + { + projectile.Kill(); + } + else + { + projectile.damage = 0; + projectile.rotation = projectile.AngleTo(Main.npc[(int)projectile.ai[0]].Center) - MathHelper.PiOver2; + projectile.position = Main.npc[(int)projectile.ai[0]].Center + projectile.ai[1].ToRotationVector2() * Radius; + projectile.ai[1] -= MathHelper.ToRadians(DegreesToSpin); + + if (projectile.timeLeft > 920) + { + Radius *= 0.95f; + if (projectile.alpha < 255) + { + projectile.alpha += 3; + } + DegreesToSpin *= 1.035f; + } + } + if (projectile.Hitbox.Intersects(Main.npc[(int)projectile.ai[0]].Hitbox)) + { + int damage = (int)(Eternity.ExplosionDamage * Main.rand.NextFloat(0.9f, 1.1f)); + Main.player[projectile.owner].addDPS(damage); + Main.npc[(int)projectile.ai[0]].StrikeNPC(damage, 0f, 0, false); + Vector2 randomCirclePointVector = Vector2.One.RotatedBy(projectile.rotation); + float lerpStart = Main.rand.Next(12, 17); + float lerpEnd = Main.rand.Next(3, 7); + NPC target = Main.npc[(int)projectile.ai[0]]; + Main.PlaySound(ModLoader.GetMod("CalamityMod").GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), (int)target.Center.X, (int)target.Center.Y); + for (float i = 0; i < 9f; ++i) + { + for (int j = 0; j < 2; ++j) + { + Vector2 randomCirclePointRotated = randomCirclePointVector.RotatedBy((j == 0 ? 1 : -1) * MathHelper.TwoPi / 18f); + for (float k = 0f; k < 20f; ++k) + { + Vector2 randomCirclePointLerped = Vector2.Lerp(randomCirclePointVector, randomCirclePointRotated, k / 20f); + float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 4f; + int dustIndex = Dust.NewDust(new Vector2(target.Center.X, target.Center.Y), 0, 0, + Main.rand.Next(132, 133 + 1), + 0f, 0f, 100, default, 1.3f); + Main.dust[dustIndex].velocity *= 0.1f; + Main.dust[dustIndex].noGravity = true; + Main.dust[dustIndex].color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(61, 141, 235), + new Color(229, 52, 220), + }); + Main.dust[dustIndex].velocity += randomCirclePointLerped * lerpMultiplier; + } + } + + randomCirclePointVector = randomCirclePointVector.RotatedBy(MathHelper.TwoPi / 9f); + } + projectile.Kill(); + } + } + public void DeathDust() + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, Eternity.dustID, newColor: new Color(245, 112, 218)); + dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(2f, 6f); + dust.noGravity = true; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Variables/parameters to be used in the spriteBatch.Draw method later. + Color colorAtCenter = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16); + Texture2D myTexture = Main.projectileTexture[projectile.type]; + Rectangle frame = myTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Color alphaFromCenter = projectile.GetAlpha(colorAtCenter); + Vector2 origin = frame.Size() / 2f; + //This is for wrapping back so that we don't just blip back to 0 after going above pi/2 + const float maxTheta = 60f; + const float pixelOutwardMin = 5f; + const float pixelOutwardMax = 10f - pixelOutwardMin; + float angleWrapped = projectile.localAI[0]; + + //The modulo operator is used so that we never go below 0 or above pi/2 in the given calculations + float theta = MathHelper.Pi * angleWrapped / maxTheta; + + //Cos(0)/2 + 1/2 is 1, Cos(pi)/2 + 1/2 is 0. So, we can use this cosine to iterate down from 1 to 0 in strength + //in a wave pattern + float rotationFactor = ((float)Math.Cos(theta) * 0.5f + 0.5f) * pixelOutwardMax + pixelOutwardMin; + + //Iterate through 2pi in 2 operations. We want to show two of the transparent crystals right next to the main one + for (float i = 0f; i < 2f; i += 1f) + { + double angle = MathHelper.TwoPi / 2f * i + MathHelper.PiOver2; + Vector2 drawPosition = projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition + + Vector2.UnitY.RotatedBy(angle).RotatedBy(projectile.rotation) * rotationFactor; + Main.spriteBatch.Draw(myTexture, drawPosition, new Rectangle?(frame), + alphaFromCenter * 0.6f, projectile.rotation, origin, + projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/EternityCrystal.png b/Projectiles/Magic/EternityCrystal.png new file mode 100644 index 0000000000..1c799ffbc2 Binary files /dev/null and b/Projectiles/Magic/EternityCrystal.png differ diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs new file mode 100644 index 0000000000..690b44b3ec --- /dev/null +++ b/Projectiles/Magic/EternityHex.cs @@ -0,0 +1,210 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EternityHex : ModProjectile + { + public const float bossLifeMaxDamageMult = 1f / 350f; + public const float normalEnemyLifeMaxDamageMult = 1f / 100f; + public const int trueTimeLeft = 310; + public const int extraUpdateCount = 1; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternity"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.tileCollide = false; + projectile.timeLeft = int.MaxValue; //Killed manually + projectile.extraUpdates = extraUpdateCount; + projectile.alpha = 255; + } + public override void AI() + { + if (projectile.ai[0] >= Main.npc.Length || projectile.ai[0] < 0) + { + DeathDust(); + projectile.Kill(); + return; + } + + NPC target = Main.npc[(int)projectile.ai[0]]; + + if (!target.active) + { + NPC potentialNPC = projectile.Center.ClosestNPCAt(4400f, true); + if (potentialNPC != null) + { + projectile.ai[0] = potentialNPC.whoAmI; + target = Main.npc[(int)projectile.ai[0]]; + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile proj = Main.projectile[i]; + if ((proj.whoAmI == projectile.whoAmI || + proj.type == ModContent.ProjectileType()) && + proj.active && proj.owner == projectile.owner) + { + if (proj.type == ModContent.ProjectileType()) + proj.ai[0] = projectile.ai[0]; + for (int j = 0; j < 44; j++) + { + Dust dust = Dust.NewDustPerfect(proj.Center, Eternity.dustID, newColor: new Color(245, 112, 218)); + dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(2f, 6f); + dust.noGravity = true; + } + } + } + } + else + { + DeathDust(); + projectile.Kill(); + return; + } + } + + if (projectile.localAI[1] >= Main.projectile.Length || projectile.localAI[0] < 0) + { + DeathDust(); + projectile.Kill(); + return; + } + + Projectile book = Main.projectile[(int)projectile.localAI[1]]; + + if (!book.active) + { + DeathDust(); + projectile.Kill(); + return; + } + + projectile.localAI[0] += 1f; + //Infinity loop in dust + for (int i = 0; i < 3; i++) + { + projectile.ai[1] += MathHelper.TwoPi / 175f; + + //Causes the lemniscate to smoothen out and look better + float scale = 2f / (3f - (float)Math.Cos(2 * projectile.ai[1])); + float outwardMultiplier = MathHelper.Clamp(projectile.localAI[0] / 2f + 20f, 20f, 230f); + Vector2 additiveVector = new Vector2(scale * (float)Math.Cos(projectile.ai[1]), scale * (float)Math.Sin(2f * projectile.ai[1]) / 2f); + + projectile.Center = target.Center + additiveVector * outwardMultiplier; + + float timeRatio = MathHelper.Clamp(projectile.localAI[0] / trueTimeLeft, 0f, 1f); + Color dustColor = Color.Lerp(new Color(245, 112, 218), new Color(28, 13, 118), timeRatio); + int dustIndex = Dust.NewDust(projectile.Center, 0, 0, Eternity.dustID, newColor: dustColor); + Main.dust[dustIndex].velocity = Vector2.Zero; + Main.dust[dustIndex].noGravity = true; + Main.dust[dustIndex].scale = MathHelper.Clamp(timeRatio * 1.5f, 0.6f, 1.5f); + } + if (projectile.localAI[0] < trueTimeLeft * 2 - 40) + { + float range = projectile.localAI[0] / (trueTimeLeft * 2f - 40); + float random = Main.rand.NextFloat(); + if (random <= (range * 0.6f + 0.4f)) + { + for (int iterative = 0; iterative < 12; iterative++) + { + //For where on the imaginary circle the dust appears + float randTwoPi = Main.rand.NextFloat() * MathHelper.TwoPi; + //For determining the circle of the radius and the velocity + float rand01 = Main.rand.NextFloat(); + Vector2 spawnPosition = target.Center + randTwoPi.ToRotationVector2() * (70f + 530f * rand01); + Vector2 velocity = (randTwoPi - 3f * MathHelper.Pi / 8f).ToRotationVector2() * (10f + 9f * Main.rand.NextFloat() + 4f * rand01); + Dust swirlingDust = Dust.NewDustPerfect(spawnPosition, Eternity.dustID, new Vector2?(velocity), 0, Main.rand.NextBool(3) ? Eternity.blueColor : Eternity.pinkColor, 1.4f); + swirlingDust.scale = 0.8f; + swirlingDust.fadeIn = 0.95f + rand01 * 0.3f; + swirlingDust.noGravity = true; + } + } + if (random <= (range * 0.6f + 0.4f) / 30f) + { + if (!target.immortal && + !target.dontTakeDamage) + { + int damage = 2; + //To give a bit of variety in how damage is calculated, I decided to incorporate width and height + damage += (int)Math.Sqrt(target.width * target.height) * 10; //Leviathan damage from this calculation = floor(sqrt(850, 450)) * 10 = 6184 damage + damage += (int)(target.boss ? target.lifeMax * bossLifeMaxDamageMult : target.lifeMax * normalEnemyLifeMaxDamageMult); + damage += target.damage * 5; + //The same damage value on each hit could cause the bugs channel to go apeshit lol + damage = (int)(damage * Main.rand.NextFloat(0.9f, 1.1f)); + damage = (int)MathHelper.Clamp(damage, 1f, Eternity.BaseDamage * 3); + RegisterDPS(damage); + + target.StrikeNPC(damage, 0f, 0, false); + } + } + //This is where most of the damage comes from. Be careful when messing with this + if ((int)projectile.localAI[0] % 30 == 0 && + CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < Eternity.MaxHomers) + { + int homerCount = 6; + int trueMeleeID = ModContent.ProjectileType(); + int trueMeleeDamage = Eternity.BaseDamage; + float angleVariance = MathHelper.TwoPi / homerCount; + float spinOffsetAngle = MathHelper.Pi / (2f * homerCount); + Vector2 posVec = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * 10f; + + for (int i = 0; i < homerCount; ++i) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity = Vector2.Normalize(velocity) * 10f; + Projectile.NewProjectile(target.Center + posVec * 4f, velocity, trueMeleeID, trueMeleeDamage, 0f, projectile.owner, projectile.ai[0]); + } + } + } + else if (projectile.localAI[0] < trueTimeLeft * 2) + { + if (Main.rand.NextBool(3)) + { + int damage = 4000; + damage = (int)(damage * Main.rand.NextFloat(0.9f, 1.1f)); + RegisterDPS(damage); + target.StrikeNPC(damage, 0f, 0, false); + int totalProjectiles = Main.rand.Next(8, 14) * 2; + float spread = MathHelper.ToRadians(Main.rand.Next(24, 36)); + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this + double deltaAngle = spread / totalProjectiles; // Angle between each projectile + double offsetAngle; + float velocity = Main.rand.NextFloat(6f, 26f); + + for (int i = 0; i < 6; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Dust.NewDustPerfect(target.Center, Eternity.dustID, -velocity * ((float)offsetAngle).ToRotationVector2(), 0, Eternity.pinkColor); + Dust.NewDustPerfect(target.Center, Eternity.dustID, velocity * ((float)offsetAngle).ToRotationVector2(), 0, Eternity.blueColor); + } + } + } + else + { + projectile.Kill(); + } + } + public void DeathDust() + { + for (int i = 0; i < 44; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, Eternity.dustID, newColor: new Color(245, 112, 218)); + dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(2f, 6f); + dust.noGravity = true; + } + } + //So that the player can gauge the DPS of this weapon effectively (StrikeNPC alone will not register the DPS to the player. I have to do this myself) + private void RegisterDPS(int damage) + { + Main.player[projectile.owner].addDPS(damage); + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/EternityHex.png b/Projectiles/Magic/EternityHex.png new file mode 100644 index 0000000000..c6616b4227 Binary files /dev/null and b/Projectiles/Magic/EternityHex.png differ diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs new file mode 100644 index 0000000000..8e92df58a8 --- /dev/null +++ b/Projectiles/Magic/EternityHoming.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EternityHoming : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternity"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 120; + projectile.alpha = 255; + projectile.magic = true; + } + + public override void AI() + { + NPC target = null; + float distance = 4400f; + for (int index = 0; index < Main.npc.Length; index++) + { + if (Main.npc[index].CanBeChasedBy(null, false)) + { + if (Main.npc[index].boss && Vector2.Distance(projectile.Center, Main.npc[index].Center) <= 4400f) + { + target = Main.npc[index]; + break; + } + if (Vector2.Distance(projectile.Center, Main.npc[index].Center) < distance) + { + distance = Vector2.Distance(projectile.Center, Main.npc[index].Center); + target = Main.npc[index]; + } + } + } + if (target != null) + { + projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(target.Center) * 10f) / 8f; + } + projectile.ai[0] += 0.18f; + float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(projectile.ai[0]); + float radius = 10f; + Vector2 offset = angle.ToRotationVector2() * pulse * radius; + Dust dust = Dust.NewDustPerfect(projectile.Center + offset, Eternity.dustID, Vector2.Zero, 0, Eternity.pinkColor); + dust.noGravity = true; + dust = Dust.NewDustPerfect(projectile.Center - offset, Eternity.dustID, Vector2.Zero, 0, Eternity.blueColor); + dust.noGravity = true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/EternityHoming.png b/Projectiles/Magic/EternityHoming.png new file mode 100644 index 0000000000..c6616b4227 Binary files /dev/null and b/Projectiles/Magic/EternityHoming.png differ diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs new file mode 100644 index 0000000000..18cde801de --- /dev/null +++ b/Projectiles/Magic/MiasmaGas.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class MiasmaGas : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gas"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 28; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.penetrate = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.alpha = Main.rand.Next(35, 75); + projectile.localAI[0] = 1f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 360f) + { + projectile.ai[1] = 1f; + } + if (projectile.ai[1] == 1f) + { + projectile.velocity *= 0.9865f; + } + projectile.rotation += projectile.velocity.X * 0.0003f; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.ai[1] = 1f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 25; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, 48, 30, 189, 0f, 0f); + dust.velocity = projectile.velocity.RotatedByRandom(MathHelper.ToRadians(39f)); + dust.alpha = 127; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Magic/MiasmaGas.png b/Projectiles/Magic/MiasmaGas.png new file mode 100644 index 0000000000..153a63122d Binary files /dev/null and b/Projectiles/Magic/MiasmaGas.png differ diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs new file mode 100644 index 0000000000..84d21e24f6 --- /dev/null +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -0,0 +1,57 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VitriolicViperFang : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 34; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 4; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (projectile.penetrate == 0) + { + projectile.alpha += 4; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, (int)CalamityDusts.SulfurousSeaAcid); + dust.noGravity = true; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Magic/VitriolicViperFang.png b/Projectiles/Magic/VitriolicViperFang.png new file mode 100644 index 0000000000..b370b7816a Binary files /dev/null and b/Projectiles/Magic/VitriolicViperFang.png differ diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs new file mode 100644 index 0000000000..a267716701 --- /dev/null +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VitriolicViperSpit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spit"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 26; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 14; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, 27); + dust.noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/VitriolicViperSpit.png b/Projectiles/Magic/VitriolicViperSpit.png new file mode 100644 index 0000000000..7382b42d0e Binary files /dev/null and b/Projectiles/Magic/VitriolicViperSpit.png differ diff --git a/Projectiles/Pets/BabyGhostBell.cs b/Projectiles/Pets/BabyGhostBell.cs index 3e751a52f9..cf33effb9a 100644 --- a/Projectiles/Pets/BabyGhostBell.cs +++ b/Projectiles/Pets/BabyGhostBell.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Pets 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 && + if (num20 < (float)num17 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs new file mode 100644 index 0000000000..f363c9165f --- /dev/null +++ b/Projectiles/Pets/Sparks.cs @@ -0,0 +1,456 @@ +using CalamityMod.CalPlayer; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Sparks : ModProjectile + { + private int color = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sparks"); + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 44; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + projectile.ignoreWater = true; + } + + private void Pickup() + { + int defaultItemGrabRange = 38; + Player player = Main.player[projectile.owner]; + + for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) + { + Item item = Main.item[itemIndex]; + if (item.active && item.noGrabDelay == 0 && item.owner == projectile.owner && ItemLoader.CanPickup(item, player)) + { + int num = defaultItemGrabRange;//Player.defaultItemGrabRange; + + if (new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height).Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height))) + { + if (projectile.owner == Main.myPlayer && (player.inventory[player.selectedItem].type != 0 || player.itemAnimation <= 0)) + { + // TODO, fix this maybe? + if (!ItemLoader.OnPickup(item, player)) + { + Main.item[itemIndex] = new Item(); + if (Main.netMode == 1) + { + NetMessage.SendData(21, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0); + } + continue; + } + + if (ItemID.Sets.NebulaPickup[item.type]) + { + continue; + //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); + //int num2 = item.buffType; + //Main.item[itemIndex] = new Item(); + //if (Main.netMode == 1) + //{ + // NetMessage.SendData(102, -1, -1, "", projectile.owner, (float)num2, player.Center.X, player.Center.Y, 0, 0, 0); + // NetMessage.SendData(21, -1, -1, "", itemIndex, 0f, 0f, 0f, 0, 0, 0); + //} + //else + //{ + // player.NebulaLevelup(num2); + //} + } + if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) + { + continue; + //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); + //player.statLife += 20; + //if (Main.myPlayer == player.whoAmI) + //{ + // player.HealEffect(20, true); + //} + //if (player.statLife > player.statLifeMax2) + //{ + // player.statLife = player.statLifeMax2; + //} + //Main.item[itemIndex] = new Item(); + //if (Main.netMode == 1) + //{ + // NetMessage.SendData(21, -1, -1, "", itemIndex, 0f, 0f, 0f, 0, 0, 0); + //} + } + else if (item.type == ItemID.Star || item.type == ItemID.SoulCake || item.type == ItemID.SugarPlum) + { + continue; + //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); + //player.statMana += 100; + //if (Main.myPlayer == player.whoAmI) + //{ + // player.ManaEffect(100); + //} + //if (player.statMana > player.statManaMax2) + //{ + // player.statMana = player.statManaMax2; + //} + //Main.item[itemIndex] = new Item(); + //if (Main.netMode == 1) + //{ + // NetMessage.SendData(21, -1, -1, "", itemIndex, 0f, 0f, 0f, 0, 0, 0); + //} + } + else + { + Main.item[itemIndex] = player.GetItem(projectile.owner, item, false, false); + if (Main.netMode == 1) + { + NetMessage.SendData(21, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.active && (npc.type == NPCID.Butterfly || npc.type == NPCID.GoldButterfly)) + { + if (new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height).Intersects(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height))) + { + npc.life = 0; + npc.active = false; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 2); + npc.netUpdate = true; + } + } + } + } + + private void PassiveAI() + { + Player player = Main.player[projectile.owner]; + float num16 = 0.5f; + projectile.tileCollide = false; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float xDist = player.position.X + (float)(player.width / 2) - vector3.X; + float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y; + yDist += (float)Main.rand.Next(-10, 21); + xDist += (float)Main.rand.Next(-10, 21); + xDist += (float)(60 * -(float)player.direction); + yDist -= 60f; + float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + float num21 = 18f; + if (playerDist < 160f) + projectile.ai[0] = 0f; + if (playerDist < 100f && player.velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDist < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + num16 = 0.01f; + } + else + { + if (playerDist < 100f) + { + num16 = 0.1f; + } + if (playerDist > 300f) + { + num16 = 1f; + } + playerDist = num21 / playerDist; + xDist *= playerDist; + yDist *= playerDist; + } + if (projectile.velocity.X < xDist) + { + 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 > xDist) + { + 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 < yDist) + { + 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 > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //Change color based on health + if (player.statLife >= (int)((double)player.statLifeMax2 * 0.75)) + { + if (Main.myPlayer == projectile.owner) + { + color = 0; //gold + } + } + else if (player.statLife >= (int)((double)player.statLifeMax2 * 0.5)) + { + if (Main.myPlayer == projectile.owner) + { + color = 1; //blue + } + } + else + { + if (Main.myPlayer == projectile.owner) + { + color = 2; //green + } + } + + //give off light based on Dragonfly color + if (color == 0) //gold + { + Lighting.AddLight(projectile.Center, 1.5f, 1.5f, 0.1f); + } + else if (color == 1) //blue + { + Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 1.5f); + } + else //green + { + Lighting.AddLight(projectile.Center, 0.1f, 1.5f, 0.1f); + } + + //framing and sprite direction + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 4) + { + projectile.frame = 0; + } + if ((double)projectile.velocity.X >= 0.25) + { + projectile.direction = 1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.direction = -1; + } + + if (!player.active) + { + projectile.active = false; + return; + } + if (player.dead) + { + modPlayer.sparks = false; + } + if (modPlayer.sparks) + { + projectile.timeLeft = 2; + } + + Pickup(); //pickup items + + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + + //find a target + Vector2 targetLocation = projectile.position; + bool foundFood = false; + float range = 160f; //10 block range + + for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) + { + Item item = Main.item[itemIndex]; + if (item.active && item.noGrabDelay == 0 && item.owner == projectile.owner && ItemLoader.CanPickup(item, Main.player[item.owner]) && Main.player[item.owner].ItemSpace(item)) + { + if (ItemID.Sets.NebulaPickup[item.type]) + { + continue; + } + if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) + { + continue; + } + else if (item.type == ItemID.Star || item.type == ItemID.SoulCake || item.type == ItemID.SugarPlum) + { + continue; + } + + float itemDist = Vector2.Distance(item.Center, projectile.Center); + float distanceToPotential = Vector2.Distance(projectile.Center, targetLocation); + if (distanceToPotential < itemDist && itemDist < range) + { + range = itemDist; + targetLocation = item.Center; + foundFood = true; + } + } + } + //prioritize butterflies over items + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.active && (npc.type == NPCID.Butterfly || npc.type == NPCID.GoldButterfly)) + { + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float distanceToPotential = Vector2.Distance(projectile.Center, targetLocation); + if (distanceToPotential < npcDist && npcDist < range) + { + range = npcDist; + targetLocation = npc.Center; + foundFood = true; + } + } + } + + float num647 = 100f; + if (foundFood) + { + num647 = 200f; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (foundFood && projectile.ai[0] == 0f) + { + Vector2 vector47 = targetLocation - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + PassiveAI(); + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 3); + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundFood && range < 300f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = targetLocation - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 12f; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (color == 1) + texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/SparksBlue"); + if (color == 2) + texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/SparksGreen"); + int height = texture.Height / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Pets/Sparks.png b/Projectiles/Pets/Sparks.png new file mode 100644 index 0000000000..04cd4bfba0 Binary files /dev/null and b/Projectiles/Pets/Sparks.png differ diff --git a/Projectiles/Pets/SparksBlue.png b/Projectiles/Pets/SparksBlue.png new file mode 100644 index 0000000000..b170bd4e53 Binary files /dev/null and b/Projectiles/Pets/SparksBlue.png differ diff --git a/Projectiles/Pets/SparksGreen.png b/Projectiles/Pets/SparksGreen.png new file mode 100644 index 0000000000..7a2354ad79 Binary files /dev/null and b/Projectiles/Pets/SparksGreen.png differ diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs new file mode 100644 index 0000000000..4fc2e0abe3 --- /dev/null +++ b/Projectiles/Ranged/EmesisGore.cs @@ -0,0 +1,80 @@ +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class EmesisGore : ModProjectile + { + public int HurtCounter = 0; + public const int HurtTimeIncrement = 10; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rotten Gore"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 10; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(HurtCounter); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + HurtCounter = reader.ReadInt32(); + } + public override void AI() + { + CalamityUtils.StickyProjAI(projectile); + + // Override the default DOT used in the method above. + if (projectile.ai[0] == 1f) + { + projectile.localAI[0] = 5f; + projectile.velocity = Vector2.Zero; + HurtCounter++; + if (HurtCounter % HurtTimeIncrement == 0) + { + Main.npc[(int)projectile.ai[1]].HitEffect(0, 50.0); + } + } + else + { + projectile.rotation += (projectile.velocity.X > 0).ToDirectionInt() * MathHelper.ToRadians(8f); + } + if (projectile.timeLeft % 12 == 11) + { + for (int i = 0; i < (projectile.ai[0] == 1f ? 3 : 1); i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, 27); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + dust.noGravity = true; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 8, true); + } + + 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; + } + } +} diff --git a/Projectiles/Ranged/EmesisGore.png b/Projectiles/Ranged/EmesisGore.png new file mode 100644 index 0000000000..85ceeb4584 Binary files /dev/null and b/Projectiles/Ranged/EmesisGore.png differ diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs new file mode 100644 index 0000000000..d3c2b49446 --- /dev/null +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -0,0 +1,56 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ToxicArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 32; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 32; + projectile.position = projectile.position - projectile.Size / 2f; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + int count = Main.rand.Next(6, 15); + for (int i = 0; i < count; i++) + { + int idx = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Ranged/ToxicArrow.png b/Projectiles/Ranged/ToxicArrow.png new file mode 100644 index 0000000000..a791e861f1 Binary files /dev/null and b/Projectiles/Ranged/ToxicArrow.png differ diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs new file mode 100644 index 0000000000..738960feb8 --- /dev/null +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -0,0 +1,57 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Corrocloud1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrocloud"); + Main.projFrames[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] % 7f == 6f) + { + projectile.frame++; + } + if (projectile.frame >= 8) + projectile.Kill(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + } + } + } +} diff --git a/Projectiles/Rogue/Corrocloud1.png b/Projectiles/Rogue/Corrocloud1.png new file mode 100644 index 0000000000..6f588c2551 Binary files /dev/null and b/Projectiles/Rogue/Corrocloud1.png differ diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs new file mode 100644 index 0000000000..7c6728b281 --- /dev/null +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -0,0 +1,57 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Corrocloud2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrocloud"); + Main.projFrames[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] % 7f == 6f) + { + projectile.frame++; + } + if (projectile.frame >= 8) + projectile.Kill(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + } + } + } +} diff --git a/Projectiles/Rogue/Corrocloud2.png b/Projectiles/Rogue/Corrocloud2.png new file mode 100644 index 0000000000..761490cc8d Binary files /dev/null and b/Projectiles/Rogue/Corrocloud2.png differ diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs new file mode 100644 index 0000000000..20a2041dba --- /dev/null +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -0,0 +1,57 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Corrocloud3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrocloud"); + Main.projFrames[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] % 7f == 6f) + { + projectile.frame++; + } + if (projectile.frame >= 8) + projectile.Kill(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + } + } + } +} diff --git a/Projectiles/Rogue/Corrocloud3.png b/Projectiles/Rogue/Corrocloud3.png new file mode 100644 index 0000000000..13d7443906 Binary files /dev/null and b/Projectiles/Rogue/Corrocloud3.png differ diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs new file mode 100644 index 0000000000..6d37dd7f89 --- /dev/null +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToxicantTwisterDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.tileCollide = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 0f; + } + } +} diff --git a/Projectiles/Rogue/ToxicantTwisterDust.png b/Projectiles/Rogue/ToxicantTwisterDust.png new file mode 100644 index 0000000000..55a2f41495 Binary files /dev/null and b/Projectiles/Rogue/ToxicantTwisterDust.png differ diff --git a/Projectiles/Rogue/ToxicantTwisterProjectile.cs b/Projectiles/Rogue/ToxicantTwisterProjectile.cs new file mode 100644 index 0000000000..a1a85be682 --- /dev/null +++ b/Projectiles/Rogue/ToxicantTwisterProjectile.cs @@ -0,0 +1,69 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToxicantTwisterProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxicant Twister"); + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 46; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.aiStyle = 3; + projectile.timeLeft = 180; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + public override void AI() + { + if (projectile.Calamity().stealthStrike) + { + if (projectile.timeLeft % 25f == 0f) + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(projectile.Center, + (-1f * projectile.velocity).RotatedByRandom(0.1f) * 0.6f, + ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + } + } + projectile.rotation += 0.125f * (projectile.velocity.X > 0).ToDirectionInt(); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + 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, (int)CalamityDusts.SulfurousSeaAcid, + projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + 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, (int)CalamityDusts.SulfurousSeaAcid, + projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/ToxicantTwisterProjectile.png b/Projectiles/Rogue/ToxicantTwisterProjectile.png new file mode 100644 index 0000000000..f54ead37b4 Binary files /dev/null and b/Projectiles/Rogue/ToxicantTwisterProjectile.png differ diff --git a/Projectiles/Summon/BloodBreath.cs b/Projectiles/Summon/BloodBreath.cs new file mode 100644 index 0000000000..66441b8dcd --- /dev/null +++ b/Projectiles/Summon/BloodBreath.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BloodBreath : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 2; + projectile.extraUpdates = 3; + projectile.timeLeft = 40; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.77f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.08f / 255f); + if (projectile.ai[0] > 7f) + { + float dustScale = 1f; + if (projectile.ai[0] == 8f) + { + dustScale = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + dustScale = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + dustScale = 0.75f; + } + projectile.ai[0] += 1f; + if (Main.rand.NextBool(2)) + { + for (int i = 0; i < 1; i++) + { + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[idx]; + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 3f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.5f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= dustScale; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * projectile.direction; + } + } +} diff --git a/Projectiles/Summon/BloodBreath.png b/Projectiles/Summon/BloodBreath.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Summon/BloodBreath.png differ diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs new file mode 100644 index 0000000000..e9601a6e31 --- /dev/null +++ b/Projectiles/Summon/BloodSpit.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BloodSpit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spit"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 150; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.77f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.08f / 255f); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 2f); + dust.noGravity = true; + } + Main.player[projectile.owner].HealEffect(1, false); + Main.player[projectile.owner].statLife += 1; + if (Main.player[projectile.owner].statLife > Main.player[projectile.owner].statLifeMax2) + { + Main.player[projectile.owner].statLife = Main.player[projectile.owner].statLifeMax2; + } + } + } +} diff --git a/Projectiles/Summon/BloodSpit.png b/Projectiles/Summon/BloodSpit.png new file mode 100644 index 0000000000..06cd860ae2 Binary files /dev/null and b/Projectiles/Summon/BloodSpit.png differ diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs new file mode 100644 index 0000000000..242204111c --- /dev/null +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -0,0 +1,154 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class DazzlingStabber : ModProjectile + { + public const float DistanceToCheck = 1500f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dazzling Stabber"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 58; + 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.providenceStabber = false; + } + if (modPlayer.providenceStabber) + { + projectile.timeLeft = 2; + } + } + + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + if (potentialTarget != null) + { + projectile.ai[0] += 1f; + // Alternate between normal charge and slower charge/knife summon + if (projectile.ai[0] % 160f < 100f) + { + if (projectile.ai[0] % 90f < 30f) + { + projectile.velocity *= 0.99f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2, 0.15f); + } + else if (projectile.ai[0] % 90f == 30f) + { + projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * 20f; + } + + else if (projectile.ai[0] % 90f < 60f) + { + projectile.velocity *= 0.99f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2, 0.15f); + } + else if (projectile.ai[0] % 90f == 60f) + { + projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * 16f; + for (int i = 0; i < 3; i++) + { + float angle = MathHelper.Lerp(-0.3f, 0.3f, i / 3f); + Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(angle), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 1f, projectile.owner); + } + } + else projectile.velocity *= 0.99f; + } + else + { + float angleMax = MathHelper.ToRadians(23f); + if (projectile.ai[0] % 160f == 120f) + { + float angleStart = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 30; i++) + { + float angle = MathHelper.TwoPi / 30f * i + angleStart; + Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * 10f, (int)CalamityDusts.ProfanedFire); + dust.velocity = angle.ToRotationVector2() * 5f * MathHelper.Lerp(1f, 0f, (i % 6f) / 6f); + } + Vector2 positionDelta = Utils.RandomVector2(Main.rand, -12f, 12f); + + while (positionDelta == Vector2.Zero) + positionDelta = Utils.RandomVector2(Main.rand, -12f, 12f); + + projectile.Center = potentialTarget.Center + positionDelta; + projectile.rotation = projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2; + projectile.rotation += angleMax; + projectile.velocity = Vector2.Zero; + } + if (projectile.ai[0] % 160f > 120f) + { + projectile.rotation -= angleMax * 2f / 40f; + } + } + } + else + { + projectile.rotation = projectile.rotation.AngleTowards(projectile.ai[1], 0.05f); + Vector2 destination = player.Center + new Vector2(0f, -120f).RotatedBy(projectile.ai[1]); + projectile.velocity = (destination - projectile.Center) / 40f; + } + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + } + } +} diff --git a/Projectiles/Summon/DazzlingStabber.png b/Projectiles/Summon/DazzlingStabber.png new file mode 100644 index 0000000000..0a22d893bf Binary files /dev/null and b/Projectiles/Summon/DazzlingStabber.png differ diff --git a/Projectiles/Summon/DazzlingStabberKnife.cs b/Projectiles/Summon/DazzlingStabberKnife.cs new file mode 100644 index 0000000000..055d513bcd --- /dev/null +++ b/Projectiles/Summon/DazzlingStabberKnife.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class DazzlingStabberKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 24; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + NPC potentialTarget = projectile.Center.MinionHoming(750f, Main.player[projectile.owner]); + if (potentialTarget != null) + { + if (projectile.Distance(potentialTarget.Center) > 70f) + { + projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(potentialTarget.Center) * 17f) / 20f; + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Summon/DazzlingStabberKnife.png b/Projectiles/Summon/DazzlingStabberKnife.png new file mode 100644 index 0000000000..35d51ec4d1 Binary files /dev/null and b/Projectiles/Summon/DazzlingStabberKnife.png differ diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs new file mode 100644 index 0000000000..2da4af702b --- /dev/null +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -0,0 +1,104 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class EXPLODINGFROG : ModProjectile + { + public const float MinExplodeDistance = 120f; + public const float ExplodeWaitTime = 45f; + public const float ExplosionAngleVariance = 0.8f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A not frog of the explosive variety"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 26; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } + + public override void AI() + { + if (projectile.frameCounter++ > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool canExplode = projectile.Center.ClosestNPCAt(MinExplodeDistance) != null; + if (player.HasMinionAttackTargetNPC) + { + canExplode = Main.npc[player.MinionAttackTargetNPC].Distance(projectile.Center) < MinExplodeDistance; + } + if (canExplode) + projectile.ai[0]++; + if (projectile.ai[0] >= ExplodeWaitTime) + { + if (Main.myPlayer == projectile.owner) + { + // Goop projectiles + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectile(projectile.Center, + new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(projectile.Center, + new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + } + // Normally I would do something like mod.ProjectileType($"FrogGore1 + i") in a loop, but I suppose I'll let it go. + Projectile.NewProjectile(projectile.Center, + new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(projectile.Center, + new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(projectile.Center, + new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + } + // WoF vomit sound. + Main.PlaySound(SoundID.NPCKilled, projectile.Center, 13); + projectile.Kill(); + } + projectile.velocity.Y += 0.5f; + + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + } + + public override bool CanDamage() => false; + // Don't die on tile collision + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/Summon/EXPLODINGFROG.png b/Projectiles/Summon/EXPLODINGFROG.png new file mode 100644 index 0000000000..5bf153c3d9 Binary files /dev/null and b/Projectiles/Summon/EXPLODINGFROG.png differ diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs new file mode 100644 index 0000000000..ba170ca56b --- /dev/null +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -0,0 +1,99 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class EndoHydraBody : ModProjectile + { + public const float DistanceToCheck = 1350f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra Body"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 86; + 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() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.ai[0] = -1f; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.endoHydra = false; + } + if (modPlayer.endoHydra) + { + projectile.timeLeft = 2; + } + } + + Vector2 returnLocation = player.Center; + returnLocation.X -= (18 + player.width / 2) * player.direction; + returnLocation.Y -= 25f; + + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + if (potentialTarget != null) + { + if (projectile.ai[0] != potentialTarget.whoAmI) + { + projectile.ai[0] = potentialTarget.whoAmI; + Main.PlaySound(SoundID.Zombie, projectile.Center, 53); // Ethereal whisper indicating a new target has been spotted. + } + } + + projectile.frameCounter++; + if (projectile.frameCounter > (projectile.ai[0] == -1 ? 8 : 6)) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.Center = Vector2.Lerp(projectile.Center, returnLocation, 0.25f); + projectile.direction = projectile.spriteDirection = player.direction; + Lighting.AddLight(projectile.Center - Vector2.UnitY * 21f, 0.25f, 0.865f, 0.825f); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/EndoHydraBody.png b/Projectiles/Summon/EndoHydraBody.png new file mode 100644 index 0000000000..8f49219457 Binary files /dev/null and b/Projectiles/Summon/EndoHydraBody.png differ diff --git a/Projectiles/Summon/EndoHydraChain.png b/Projectiles/Summon/EndoHydraChain.png new file mode 100644 index 0000000000..a3c00033a9 Binary files /dev/null and b/Projectiles/Summon/EndoHydraChain.png differ diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs new file mode 100644 index 0000000000..8e4df16022 --- /dev/null +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -0,0 +1,190 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class EndoHydraHead : ModProjectile + { + public Vector2 DeltaPosition; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra Head"); + Main.projFrames[projectile.type] = 5; + 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 ReceiveExtraAI(BinaryReader reader) + { + DeltaPosition = reader.ReadVector2(); + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(DeltaPosition); + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length) + { + projectile.Kill(); + return; + } + Projectile body = Main.projectile[(int)projectile.ai[0]]; + if (!body.active) + { + projectile.Kill(); + return; + } + + if (projectile.localAI[0] == 0f) + { + int totalHeads = CalamityUtils.CountProjectiles(projectile.type); + DeltaPosition = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); + projectile.netUpdate = true; + + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + Vector2 bodyTop = body.Center + new Vector2(body.spriteDirection == 1 ? 12 : -14, -50f) + DeltaPosition; + + // Beam shooting + if (body.ai[0] != -1) + { + if (Main.npc[(int)body.ai[0]].active && + Main.npc[(int)body.ai[0]].CanBeChasedBy(null, false) && + projectile.Distance(Main.npc[(int)body.ai[0]].Center) < EndoHydraBody.DistanceToCheck && + Collision.CanHit(projectile.Center, projectile.width, projectile.height, Main.npc[(int)body.ai[0]].Center, Main.npc[(int)body.ai[0]].width, Main.npc[(int)body.ai[0]].height) && + Main.myPlayer == projectile.owner) + { + if (projectile.timeLeft % 40f == 24f) + { + Projectile.NewProjectile(projectile.Center, + 6f * projectile.DirectionTo(Main.npc[(int)body.ai[0]].Center), + ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + } + + if (projectile.timeLeft % 40f >= 33f) + projectile.frame = Main.projFrames[projectile.type] - 1; + else if (projectile.timeLeft % 40f >= 27f) + projectile.frame = Main.projFrames[projectile.type] - 2; + else if (projectile.timeLeft % 40f >= 22f) + projectile.frame = Main.projFrames[projectile.type] - 3; + else if (projectile.timeLeft % 40f >= 17f) + projectile.frame = Main.projFrames[projectile.type] - 4; + + projectile.direction = projectile.spriteDirection = (Main.npc[(int)body.ai[0]].Center.X - projectile.Center.X > 0).ToDirectionInt(); + bodyTop.X -= 48f * (Main.npc[(int)body.ai[0]].Center.X - projectile.Center.X > 0).ToDirectionInt(); + } + else + { + projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); + projectile.frame = 0; + } + } + else + { + projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); + projectile.frame = 0; + } + + if (projectile.Distance(bodyTop) > 28f) + { + projectile.velocity += new Vector2(Math.Sign(bodyTop.X - projectile.Center.X), Math.Sign(bodyTop.Y - projectile.Center.Y)) * new Vector2(0.015f, 0.025f) * Main.rand.NextFloat(0.98f, 1.02f); + if (Math.Abs(projectile.velocity.X) > 2.5f) + { + projectile.velocity.X = 2.5f * Math.Sign(projectile.velocity.X); + } + if (Math.Abs(projectile.velocity.Y) > 1.6f) + { + projectile.velocity.Y = 1.6f * Math.Sign(projectile.velocity.Y); + } + projectile.velocity += (bodyTop - projectile.Center) / 10f; + } + else projectile.velocity *= 0.98f; + projectile.Center = new Vector2(projectile.Center.X, MathHelper.Clamp(projectile.Center.Y, 1f, bodyTop.Y - 8f)); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 67); + } + } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length) + { + return; + } + Projectile body = Main.projectile[(int)projectile.ai[0]]; + if (!body.active) + { + return; + } + + Texture2D chain = ModContent.GetTexture("CalamityMod/Projectiles/Summon/EndoHydraChain"); + Vector2 start = projectile.Center + (projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; + Vector2 end = body.Center - projectile.DirectionTo(body.Center) * 20f; + Vector2 bodyTop = body.Center + new Vector2(body.spriteDirection == 1 ? 12 : -12, -32f); + + for (int i = 0; i <= (int)projectile.Distance(end) / 10 + 1; i++) + { + float ratio = i / (projectile.Distance(end) / 10 + 1); + Vector2 positionAtPoint = start + (bodyTop - start) * ratio; + if (projectile.Distance(positionAtPoint) > 9) + { + float angleAtPoint = (start - positionAtPoint).ToRotation(); + if (i < (int)projectile.Distance(end) / 10 + 1) + { + float nextRatio = (i + 1f) / (projectile.Distance(end) / 10 + 1); + Vector2 nextPositionAtPoint = start + (bodyTop - start) * nextRatio; + + angleAtPoint = (nextPositionAtPoint - positionAtPoint).ToRotation(); + } + angleAtPoint += MathHelper.PiOver2; + spriteBatch.Draw(chain, + positionAtPoint - Main.screenPosition, + null, + Color.Lerp(Color.White, Color.Transparent, 0.6f), + angleAtPoint, + chain.Size() / 2f, + 1f, + SpriteEffects.None, + 0f); + } + } + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/EndoHydraHead.png b/Projectiles/Summon/EndoHydraHead.png new file mode 100644 index 0000000000..e2dae66976 Binary files /dev/null and b/Projectiles/Summon/EndoHydraHead.png differ diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoRay.cs new file mode 100644 index 0000000000..8ec7067ca4 --- /dev/null +++ b/Projectiles/Summon/EndoRay.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class EndoRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 265; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 5f) + { + for (int i = 0; i < 3; i++) + { + Vector2 spawnPosition = projectile.position; + spawnPosition -= projectile.velocity * i * 0.25f; + int idx = Dust.NewDust(spawnPosition, 1, 1, 113, 0f, 0f, 0, default, 1.25f); + Main.dust[idx].position = spawnPosition; + Main.dust[idx].scale = Main.rand.NextFloat(0.71f, 0.93f); + Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Summon/EndoRay.png b/Projectiles/Summon/EndoRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Summon/EndoRay.png differ diff --git a/Projectiles/Summon/FrogGore1.cs b/Projectiles/Summon/FrogGore1.cs new file mode 100644 index 0000000000..566a576086 --- /dev/null +++ b/Projectiles/Summon/FrogGore1.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class FrogGore1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gore from a not frog of the explosive variety"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 14; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation += projectile.velocity.X * 0.03f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/FrogGore1.png b/Projectiles/Summon/FrogGore1.png new file mode 100644 index 0000000000..3a18959830 Binary files /dev/null and b/Projectiles/Summon/FrogGore1.png differ diff --git a/Projectiles/Summon/FrogGore2.cs b/Projectiles/Summon/FrogGore2.cs new file mode 100644 index 0000000000..1e375ffd82 --- /dev/null +++ b/Projectiles/Summon/FrogGore2.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class FrogGore2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gore from a not frog of the explosive variety"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 14; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation += projectile.velocity.X * 0.03f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/FrogGore2.png b/Projectiles/Summon/FrogGore2.png new file mode 100644 index 0000000000..bafc614fac Binary files /dev/null and b/Projectiles/Summon/FrogGore2.png differ diff --git a/Projectiles/Summon/FrogGore3.cs b/Projectiles/Summon/FrogGore3.cs new file mode 100644 index 0000000000..dbe53db248 --- /dev/null +++ b/Projectiles/Summon/FrogGore3.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class FrogGore3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gore from a not frog of the explosive variety"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 16; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation += projectile.velocity.X * 0.03f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/FrogGore3.png b/Projectiles/Summon/FrogGore3.png new file mode 100644 index 0000000000..5ce32f907c Binary files /dev/null and b/Projectiles/Summon/FrogGore3.png differ diff --git a/Projectiles/Summon/FrogGore4.cs b/Projectiles/Summon/FrogGore4.cs new file mode 100644 index 0000000000..1179192a9e --- /dev/null +++ b/Projectiles/Summon/FrogGore4.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class FrogGore4 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gore from a not frog of the explosive variety"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 16; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation += projectile.velocity.X * 0.03f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/FrogGore4.png b/Projectiles/Summon/FrogGore4.png new file mode 100644 index 0000000000..092f80956e Binary files /dev/null and b/Projectiles/Summon/FrogGore4.png differ diff --git a/Projectiles/Summon/FrogGore5.cs b/Projectiles/Summon/FrogGore5.cs new file mode 100644 index 0000000000..6363b6cbcb --- /dev/null +++ b/Projectiles/Summon/FrogGore5.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class FrogGore5 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gore from a not frog of the explosive variety"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 16; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation += projectile.velocity.X * 0.03f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/FrogGore5.png b/Projectiles/Summon/FrogGore5.png new file mode 100644 index 0000000000..ce765e0ff1 Binary files /dev/null and b/Projectiles/Summon/FrogGore5.png differ diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 8e5c9a284e..da8b324723 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon } } float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) + for (int num638 = 0; num638 < Main.maxProjectiles; num638++) { bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon } else { - for (int num645 = 0; num645 < 200; num645++) + for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs new file mode 100644 index 0000000000..74cd54deb3 --- /dev/null +++ b/Projectiles/Summon/IgneousBlade.cs @@ -0,0 +1,121 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class IgneousBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Igneous Blade"); + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 86; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.igneousExaltation = false; + } + if (modPlayer.igneousExaltation) + { + projectile.timeLeft = 2; + } + } + + // Orbiting. 1 = Shooting + if (projectile.localAI[1] == 0f) + { + const float outwardPosition = 180f; + projectile.Center = player.Center + projectile.ai[0].ToRotationVector2() * outwardPosition; + projectile.rotation = projectile.ai[0] + MathHelper.PiOver2 + MathHelper.PiOver4; + projectile.ai[0] -= MathHelper.ToRadians(4f); + } + else + { + projectile.ai[0]--; + if (projectile.ai[0] == 1) + projectile.Kill(); + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.localAI[1] == 1f) + { + projectile.ai[0] = 50; + for (int i = 0; i < 3; i++) + { + Vector2 spawnPosition = target.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.ToRadians(8f)); + Projectile.NewProjectile(spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), + (int)(projectile.damage * 0.666), projectile.knockBack, projectile.owner); + } + for (int i = 0; i < Main.rand.Next(28, 41); i++) + { + Dust.NewDustPerfect( + projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + 6, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + projectile.netUpdate = true; + } + } + public override void Kill(int timeLeft) + { + for (int j = 0; j < 40; j++) + { + Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6); + dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/IgneousBlade.png b/Projectiles/Summon/IgneousBlade.png new file mode 100644 index 0000000000..81d7df8b2c Binary files /dev/null and b/Projectiles/Summon/IgneousBlade.png differ diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs new file mode 100644 index 0000000000..5f185bd8d4 --- /dev/null +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class IgneousBladeStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 86; + projectile.height = 36; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.timeLeft = 360; + projectile.alpha = 127; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(28, 41); i++) + { + Dust.NewDustPerfect( + projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + 6, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + Main.PlaySound(SoundID.Item14, projectile.Center); + } + } +} diff --git a/Projectiles/Summon/IgneousBladeStrike.png b/Projectiles/Summon/IgneousBladeStrike.png new file mode 100644 index 0000000000..81d7df8b2c Binary files /dev/null and b/Projectiles/Summon/IgneousBladeStrike.png differ diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs new file mode 100644 index 0000000000..77583f5e91 --- /dev/null +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MK2FlaskSummon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flask"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 26; + projectile.height = 26; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 240; + } + + public override void AI() + { + projectile.velocity.Y += 0.2f; + projectile.rotation += 0.1f * (projectile.velocity.X > 0).ToDirectionInt(); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(18, 21); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.Plague, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + Main.PlaySound(SoundID.Item107, projectile.Center); + int idx = Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); + Main.projectile[idx].ai[1] = CalamityUtils.CountProjectiles(ModContent.ProjectileType()); + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/MK2FlaskSummon.png b/Projectiles/Summon/MK2FlaskSummon.png new file mode 100644 index 0000000000..191e5f6570 Binary files /dev/null and b/Projectiles/Summon/MK2FlaskSummon.png differ diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs new file mode 100644 index 0000000000..29d7cf5828 --- /dev/null +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -0,0 +1,71 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MK2RocketHoming : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + NPC potentialTarget = projectile.Center.MinionHoming(1000f, player); + + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(potentialTarget.Center) * 14f) / 25f; + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item14, projectile.Center); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 599) + return false; + return true; + } + } +} diff --git a/Projectiles/Summon/MK2RocketHoming.png b/Projectiles/Summon/MK2RocketHoming.png new file mode 100644 index 0000000000..1a501fcdd3 Binary files /dev/null and b/Projectiles/Summon/MK2RocketHoming.png differ diff --git a/Projectiles/Summon/MK2RocketNormal.cs b/Projectiles/Summon/MK2RocketNormal.cs new file mode 100644 index 0000000000..0babae7582 --- /dev/null +++ b/Projectiles/Summon/MK2RocketNormal.cs @@ -0,0 +1,65 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MK2RocketNormal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.light = 0.5f; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item14, projectile.Center); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 599) + return false; + return true; + } + } +} diff --git a/Projectiles/Summon/MK2RocketNormal.png b/Projectiles/Summon/MK2RocketNormal.png new file mode 100644 index 0000000000..ca373e2a8a Binary files /dev/null and b/Projectiles/Summon/MK2RocketNormal.png differ diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs new file mode 100644 index 0000000000..f3f1be5dbc --- /dev/null +++ b/Projectiles/Summon/MagicAxe.cs @@ -0,0 +1,271 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicAxe : ModProjectile + { + private int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Axe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.minion = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + projectile.rotation += 0.075f; + projectile.alpha -= 50; + float num634 = 1200f; + float num635 = 2500f; + float num637 = 0.05f; + for (int num638 = 0; num638 < Main.projectile.Length; num638++) + { + bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (projectile.ai[1] <= 30) + { + projectile.ai[1]++; + return; + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + counter += 1; + projectile.extraUpdates = 4; + if (counter > 30) + { + counter = 1; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + float homingRange = 700f; + bool homeIn = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !homeIn) + { + homingRange = num646; + vector46 = npc.Center; + homeIn = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; 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 < homingRange) || !homeIn) + { + homingRange = num646; + vector46 = nPC2.Center; + homeIn = true; + } + } + } + } + float num647 = num634; + if (homeIn) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (homeIn && 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; + float num636 = 400f; + 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 playerDist = vector48.Length(); + if (playerDist > 200f && num650 < 8f) + { + num650 = 8f; + } + if (playerDist < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDist > 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 (counter > 0) + { + counter += Main.rand.Next(1, 4); + } + if (counter > 30) + { + counter = 0; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (counter == 0 && homeIn && homingRange < 500f) + { + counter += 1; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 16f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255, 111, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicAxe.png b/Projectiles/Summon/MagicAxe.png new file mode 100644 index 0000000000..4790f40a3f Binary files /dev/null and b/Projectiles/Summon/MagicAxe.png differ diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs new file mode 100644 index 0000000000..ed58a72851 --- /dev/null +++ b/Projectiles/Summon/MagicBat.cs @@ -0,0 +1,56 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicBat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baseball Bat"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 150; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(80, 200, 120, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/MagicBat.png b/Projectiles/Summon/MagicBat.png new file mode 100644 index 0000000000..b574ad0753 Binary files /dev/null and b/Projectiles/Summon/MagicBat.png differ diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs new file mode 100644 index 0000000000..2bb8f5ba5a --- /dev/null +++ b/Projectiles/Summon/MagicBird.cs @@ -0,0 +1,145 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicBird : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bird"); + Main.projFrames[projectile.type] = 7; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 14; + projectile.height = 14; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 7) + { + projectile.frame = 0; + } + projectile.ai[0]++; + projectile.ai[1]++; + if (projectile.ai[0] >= 20f) + { + Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + projectile.ai[0] = 0f; + } + + //Homing + if (projectile.ai[1] > 30f) + HomingAI(); + //Fade in + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + + private void HomingAI() + { + Player player = Main.player[projectile.owner]; + int targetIdx = -1; + float maxHomingRange = 700f; + bool hasHomingTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = player.MinionAttackTargetNPC; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + else + { + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC npc = Main.npc[i]; + if (npc == null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = i; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + } + + // Home in on said closest NPC. + if (hasHomingTarget) + { + NPC target = Main.npc[targetIdx]; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 32f; + float homingRatio = 15f; + projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 239, 0, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Summon/MagicBird.png b/Projectiles/Summon/MagicBird.png new file mode 100644 index 0000000000..b9eb9d0c27 Binary files /dev/null and b/Projectiles/Summon/MagicBird.png differ diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs new file mode 100644 index 0000000000..c81f50813b --- /dev/null +++ b/Projectiles/Summon/MagicBullet.cs @@ -0,0 +1,58 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + 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.minion = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.tileCollide = false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(189, 51, 164, projectile.alpha); + } + } +} diff --git a/Projectiles/Summon/MagicBullet.png b/Projectiles/Summon/MagicBullet.png new file mode 100644 index 0000000000..2fabfdd09a Binary files /dev/null and b/Projectiles/Summon/MagicBullet.png differ diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs new file mode 100644 index 0000000000..78361808a5 --- /dev/null +++ b/Projectiles/Summon/MagicHammer.cs @@ -0,0 +1,165 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicHammer : ModProjectile + { + private int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 10; + projectile.timeLeft = 180; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + { + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + projectile.rotation += 0.075f; + if (counter <= 30) + { + counter++; + return; + } + int num716 = -1; + Vector2 vector59 = projectile.Center; + float num717 = 700f; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + Player player = Main.player[projectile.owner]; + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(player.MinionAttackTargetNPC + 1))) + { + Vector2 center4 = npc.Center; + float num719 = Vector2.Distance(center4, vector59); + if (num719 < num717) + { + num717 = num719; + vector59 = center4; + num716 = player.MinionAttackTargetNPC; + } + } + } + else + { + for (int num718 = 0; num718 < Main.npc.Length; 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) + { + 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); + num726 = MathHelper.WrapAngle((float)num726); + projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.25, default); + } + float num727 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity *= num727 + 0.0025f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 56, 0, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicHammer.png b/Projectiles/Summon/MagicHammer.png new file mode 100644 index 0000000000..d29c139954 Binary files /dev/null and b/Projectiles/Summon/MagicHammer.png differ diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs new file mode 100644 index 0000000000..77af61d0fc --- /dev/null +++ b/Projectiles/Summon/MagicHat.cs @@ -0,0 +1,178 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MagicHat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magic Hat"); + 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 = 5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); + + //set up minion buffs and bools + bool hatExists = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (hatExists) + { + if (player.dead) + { + modPlayer.magicHat = false; + } + if (modPlayer.magicHat) + { + projectile.timeLeft = 2; + } + } + + //projectile movement + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + if (player.gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 150f; + projectile.rotation = MathHelper.Pi; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)(int)projectile.position.X; + projectile.position.Y = (float)(int)projectile.position.Y; + + //I don't know what this is + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + + //on summon dust and flexible damage + if (projectile.localAI[0] == 0f) + { + int dustAmt = 50; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + int dustEffects = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Main.dust[dustEffects].velocity *= 2f; + Main.dust[dustEffects].scale *= 1.15f; + } + modProj.spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = damage2; + } + + //finding an enemy, then shooting projectiles at it + if (projectile.owner == Main.myPlayer) + { + float projPosX = projectile.position.X; + float projPosY = projectile.position.Y; + float detectionRange = 1500f; + bool enemyDetected = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float xDist = npc.position.X + (float)(npc.width / 2); + float yDist = npc.position.Y + (float)(npc.height / 2); + float enemyDist = Math.Abs(projPosX + (float)(projectile.width / 2) - xDist) + Math.Abs(projPosY + (float)(projectile.height / 2) - yDist); + if (enemyDist < detectionRange) + { + detectionRange = enemyDist; + projPosX = xDist; + projPosY = yDist; + enemyDetected = true; + } + } + } + else + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC target = Main.npc[index]; + if (target.CanBeChasedBy(projectile, true)) + { + float xDist = target.position.X + (float)(target.width / 2); + float yDist = target.position.Y + (float)(target.height / 2); + float enemyDist = Math.Abs(projPosX + (float)(projectile.width / 2) - xDist) + Math.Abs(projPosY + (float)(projectile.height / 2) - yDist); + if (enemyDist < detectionRange) + { + detectionRange = enemyDist; + projPosX = xDist; + projPosY = yDist; + enemyDetected = true; + } + } + } + } + if (enemyDetected) + { + projectile.ai[1] += 1f; + if ((projectile.ai[1] % 5f) == 0f) + { + int amount = Main.rand.Next(1, 2); + for (int i = 0; i < amount; i++) + { + int projType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + float velocityX = Main.rand.NextFloat(-10f, 10f); + float velocityY = Main.rand.NextFloat(-15f, -8f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, projType, projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + } + } + + //glowmask effect + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + //no contact damage + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/MagicHat.png b/Projectiles/Summon/MagicHat.png new file mode 100644 index 0000000000..6cef86e8d3 Binary files /dev/null and b/Projectiles/Summon/MagicHat.png differ diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs new file mode 100644 index 0000000000..91c2fe8592 --- /dev/null +++ b/Projectiles/Summon/MagicRifle.cs @@ -0,0 +1,235 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicRifle : ModProjectile + { + private int counter = 0; + private bool canHome = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rifle"); + ProjectileID.Sets.MinionShot[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 = 180; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num637 = 0.05f; + for (int num638 = 0; num638 < Main.projectile.Length; num638++) + { + bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (counter <= 30) + { + counter++; + canHome = true; + } + float homingRange = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !flag25) + { + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < homingRange) || !flag25) + { + homingRange = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 18f; //12 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = projectile.ai[0] == 1f; + } + float num650 = 12f; + if (flag26) + { + num650 = 30f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 16f) + { + num650 = 16f; + } + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.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.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = (vector46 - projectile.Center).ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(315) : MathHelper.ToRadians(135)); + } + else + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(315) : MathHelper.ToRadians(135)); + } + 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 projType = ModContent.ProjectileType(); + if (flag25 && projectile.ai[1] == 0f) + { + if (Main.rand.NextBool(6)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20, 0.1f); + } + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + Main.PlaySound(SoundID.Item40, projectile.position); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, projType, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(148, 0, 211, projectile.alpha); + } + + public override bool CanDamage() + { + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MagicRifle.png b/Projectiles/Summon/MagicRifle.png new file mode 100644 index 0000000000..5e84792f42 Binary files /dev/null and b/Projectiles/Summon/MagicRifle.png differ diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs new file mode 100644 index 0000000000..45742d251f --- /dev/null +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -0,0 +1,298 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MagicUmbrella : ModProjectile + { + private int counter = 0; + private bool canHome = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Umbrella"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.rotation += 0.075f; + projectile.alpha -= 50; + float num633 = 700f; + float num634 = 1000f; + float num635 = 2200f; + float num636 = 150f; + float num637 = 0.05f; + for (int num638 = 0; num638 < Main.projectile.Length; num638++) + { + bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + if (counter <= 30) + { + counter++; + canHome = true; + } + 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; + } + if (!canHome) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && canHome) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.npc.Length; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false) && canHome) + { + 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 = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.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 * 9f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(75, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(3)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats + { + 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 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.1 * Main.rand.Next(4, 7)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(3)) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats + { + 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 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.1 * Main.rand.Next(4, 7)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Summon/MagicUmbrella.png b/Projectiles/Summon/MagicUmbrella.png new file mode 100644 index 0000000000..277fb1483e Binary files /dev/null and b/Projectiles/Summon/MagicUmbrella.png differ diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 55282fa852..a4e1726638 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -9,9 +10,143 @@ namespace CalamityMod.Projectiles.Summon { public class MiniGuardianAttack : ModProjectile { + private void ai(int type, float num535, float num536, Player player) + { + switch (type) + { + case 1: //offensive bab (profaned soul artifact) + case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) + if (projectile.ai[1] <= -1f) + { + projectile.ai[1] = 17f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= type; + } + if (projectile.ai[1] == 0f) + { + float num550 = 24f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + + if (type == 2) + num550 *= 2f; + else if (player.Calamity().gDefense) + num550 *= 0.95f; + + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 14f : 20f) + num551) / (type == 1 ? 15f : 21f); + projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 14f : 20f) + num552) / (type == 1 ? 15f : 21f); + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + break; + case 3: //bored bab - (idle) + float num16 = 0.5f; + projectile.tileCollide = false; + int num17 = 100; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + num19 += (float)Main.rand.Next(-10, 21); + num18 += (float)Main.rand.Next(-10, 21); + num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num19 -= 60f; + float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num21 = 18f; + + if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num20 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num20 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.90f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + + if (projectile.velocity.X < num18) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > num18) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y < num19) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > num19) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + break; + } + } + public override void SetStaticDefaults() { - DisplayName.SetDefault("Offensive Guardian"); + DisplayName.SetDefault("Offensive Guardian"); // *swears at u* Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -31,6 +166,28 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().magicHat && !Main.player[projectile.owner].Calamity().endoCooper) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + else + { + return true; + } + } + + public override bool? CanCutTiles() + { + if (projectile.damage == 0) + return false; + return null; } public override void AI() @@ -45,9 +202,11 @@ namespace CalamityMod.Projectiles.Summon { projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || (!modPlayer.tarraSummon && !modPlayer.bloodflareSummon && + bool shouldKill = projectile.damage == 0 && (!modPlayer.profanedCrystal || modPlayer.profanedCrystalBuffs); + if (shouldKill || !modPlayer.pArtifact || (!modPlayer.profanedCrystal && !modPlayer.tarraSummon && !modPlayer.bloodflareSummon && !modPlayer.godSlayerSummon && !modPlayer.silvaSummon && !modPlayer.dsSetBonus && !modPlayer.omegaBlueSet && !modPlayer.fearmongerSet)) { + modPlayer.gOffense = false; projectile.active = false; return; } @@ -90,131 +249,16 @@ namespace CalamityMod.Projectiles.Summon num3 = num542; } } - if (!flag19) + if (!flag19 || projectile.damage == 0) { - float num16 = 0.5f; - projectile.tileCollide = false; - int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - num19 += (float)Main.rand.Next(-10, 21); - num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); - num19 -= 60f; - float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - float num21 = 18f; - - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num20 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num20 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.90f; - } - num16 = 0.01f; - } - else - { - if (num20 < 100f) - { - num16 = 0.1f; - } - if (num20 > 300f) - { - num16 = 1f; - } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; - } - - if (projectile.velocity.X < num18) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > num18) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y < num19) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > num19) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } + ai(3, num535, num536, player); } else { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 17f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 28f; //14 - } - if (modPlayer.gDefense) - { - num550 *= 0.95f; - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } + if (player.Calamity().profanedCrystalBuffs) + ai(2, num535, num536, player); else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } + ai(1, num535, num536, player); } if ((double)projectile.velocity.X > 0.25) { diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 203df0a6f8..3cf214a242 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -9,6 +10,138 @@ namespace CalamityMod.Projectiles.Summon { public class MiniGuardianDefense : ModProjectile { + private void ai(int type, float num535, float num536, Player player) + { + switch (type) + { + case 1: //defensive bab (profaned soul artifact) + case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) + if (projectile.ai[1] <= -1f) + { + projectile.ai[1] = 17f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= type; + } + if (projectile.ai[1] == 0f) + { + float num550 = 24f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + if (type == 2) + num550 *= 2f; + else if (player.Calamity().gOffense) + num550 *= 0.95f; + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 14f : 20f) + num551) / (type == 1 ? 15f : 21f); + projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 14f : 20f) + num552) / (type == 1 ? 15f : 21f); + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + break; + case 3: //bored bab - (idle) + float num16 = 0.5f; + projectile.tileCollide = false; + int num17 = 100; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + num19 += (float)Main.rand.Next(-10, 21); + num18 += (float)Main.rand.Next(-10, 21); + num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num19 -= 60f; + float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num21 = 18f; + + if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num20 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num20 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.90f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + + if (projectile.velocity.X < num18) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > num18) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y < num19) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > num19) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + break; + } + } + public override void SetStaticDefaults() { DisplayName.SetDefault("Defensive Guardian"); @@ -31,6 +164,27 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override bool? CanCutTiles() + { + if (projectile.damage == 0) + return false; + return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().magicHat && !Main.player[projectile.owner].Calamity().endoCooper) { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + else + { + return true; + } } public override void AI() @@ -45,8 +199,10 @@ namespace CalamityMod.Projectiles.Summon { projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || player.maxMinions < 10) + bool shouldKill = projectile.damage == 0 && (!modPlayer.profanedCrystal || modPlayer.profanedCrystalBuffs); + if (shouldKill || !modPlayer.pArtifact || (modPlayer.minionSlotStat < 10 && !modPlayer.profanedCrystal)) { + modPlayer.gDefense = false; projectile.active = false; return; } @@ -89,131 +245,16 @@ namespace CalamityMod.Projectiles.Summon num3 = num542; } } - if (!flag19) + if (!flag19 || projectile.damage == 0) { - float num16 = 0.5f; - projectile.tileCollide = false; - int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; - num19 += (float)Main.rand.Next(-10, 21); - num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); - num19 -= 60f; - float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - float num21 = 18f; - - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num20 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num20 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.90f; - } - num16 = 0.01f; - } - else - { - if (num20 < 100f) - { - num16 = 0.1f; - } - if (num20 > 300f) - { - num16 = 1f; - } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; - } - - if (projectile.velocity.X < num18) - { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num16; - } - } - if (projectile.velocity.X > num18) - { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num16; - } - } - if (projectile.velocity.Y < num19) - { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; - } - } - if (projectile.velocity.Y > num19) - { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; - } - } + ai(3, num535, num536, player); } else { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 17f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 28f; //14 - } - if (modPlayer.gOffense) - { - num550 *= 0.95f; - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } + if (player.Calamity().profanedCrystalBuffs) + ai(2, num535, num536, player); else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } + ai(1, num535, num536, player); } if ((double)projectile.velocity.X > 0.25) { diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 37c644b2fc..555088e8b8 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -31,6 +31,15 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; } + public override bool? CanCutTiles() + { + CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + bool psa = modPlayer.pArtifact && !modPlayer.profanedCrystal; + if (!psa && !modPlayer.profanedCrystalBuffs) + return false; + return null; + } + public override void AI() { Player player = Main.player[projectile.owner]; @@ -43,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.timeLeft = 2; } - if (!modPlayer.pArtifact) + if (!modPlayer.pArtifact || player.dead) { projectile.active = false; return; diff --git a/Projectiles/Summon/MiniGuardianSpear.png b/Projectiles/Summon/MiniGuardianSpear.png new file mode 100644 index 0000000000..e64b5053e6 Binary files /dev/null and b/Projectiles/Summon/MiniGuardianSpear.png differ diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs new file mode 100644 index 0000000000..ef269b7f5f --- /dev/null +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class OldDukeHeadCorpse : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Absolutely Disgusting Shark Puker"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 64; + projectile.height = 60; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + NPC target = projectile.Center.MinionHoming(845f, player); + // No sense in targeting something below this sentry. + if (target != null) + { + if (target.Bottom.Y > projectile.Top.Y) + { + target = null; + } + } + projectile.frame = (target != null).ToInt(); + if (target != null) + { + projectile.ai[0] += 1f; + if (Main.myPlayer == projectile.owner && + projectile.ai[0] % 8f == 0f) + { + float angle = (float)Math.Atan(Math.Abs(target.Center.X - projectile.Center.X) / 450f); + angle *= Math.Sign(target.Center.X - projectile.Center.X); + Projectile.NewProjectile(projectile.Top + Vector2.UnitY * 7f, + new Vector2(0f, -Main.rand.NextFloat(21f, 30.5f)).RotatedBy(angle), + ModContent.ProjectileType(), projectile.damage, 5f, + projectile.owner); + } + } + projectile.velocity.Y += 0.5f; + + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + } + + public override bool CanDamage() => false; + // Don't die on tile collision + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/Summon/OldDukeHeadCorpse.png b/Projectiles/Summon/OldDukeHeadCorpse.png new file mode 100644 index 0000000000..877667a886 Binary files /dev/null and b/Projectiles/Summon/OldDukeHeadCorpse.png differ diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs new file mode 100644 index 0000000000..c1c762a2bf --- /dev/null +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class OldDukeSharkVomit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Puke"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 86; + projectile.height = 36; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 360; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 10f) + { + projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + } + projectile.velocity.Y += 0.2f; + projectile.rotation = projectile.velocity.ToRotation(); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < Main.rand.Next(28, 41); i++) + { + Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + (int)CalamityDusts.SulfurousSeaAcid, + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); + } + } + } +} diff --git a/Projectiles/Summon/OldDukeSharkVomit.png b/Projectiles/Summon/OldDukeSharkVomit.png new file mode 100644 index 0000000000..1f774a618b Binary files /dev/null and b/Projectiles/Summon/OldDukeSharkVomit.png differ diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index b5e33b2aa9..8063ad335d 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) + if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) + if ((nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) && nPC2.active) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs new file mode 100644 index 0000000000..b634d60803 --- /dev/null +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -0,0 +1,144 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PlaguebringerMK2 : ModProjectile + { + public const float DistanceToCheck = 1000.0001f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer MK2"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 38; + 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() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.plaguebringerMK2 = false; + } + if (modPlayer.plaguebringerMK2) + { + projectile.timeLeft = 2; + } + } + + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + + if (potentialTarget != null) + { + int sign = (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); + Vector2 destination = potentialTarget.Center + new Vector2((125f + 40f * projectile.ai[1]) * sign, -160f); + if (projectile.Distance(destination) < 65f) + { + projectile.velocity *= 0.9f; + } + else + { + Vector2 velocity = projectile.DirectionTo(destination) * projectile.Distance(destination) / 36f; + projectile.velocity = velocity; + } + int timeNeeded = (int)MathHelper.Lerp(60f, 18f, MathHelper.Clamp(projectile.localAI[1] / 320f, 0f, 1f)); + if (projectile.ai[0] >= timeNeeded) + { + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(potentialTarget.Center) * 14f, + ModContent.ProjectileType(), + (int)(projectile.damage / 0.3), + 3f, + projectile.owner); + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(potentialTarget.Center) * 11.5f, + ModContent.ProjectileType(), + (int)(projectile.damage / 0.3), + 3f, + projectile.owner); + projectile.ai[0] = 0; + } + else projectile.ai[0]++; + projectile.localAI[1]++; + projectile.direction = projectile.spriteDirection = -sign; + } + else + { + projectile.localAI[1] = 0; + Vector2 distanceToDestination = player.Center - projectile.Center; + distanceToDestination.X -= 10f * player.direction; + distanceToDestination.X -= projectile.ai[1] * 40 * player.direction; + distanceToDestination.Y -= 10f; + float distance = distanceToDestination.Length(); + if (distance > 10f) + { + float speed = 20f; + if (distance < 50f) + { + speed /= 2f; + } + Vector2 velocity = distanceToDestination.SafeNormalize(projectile.direction * Vector2.UnitX) * speed; + projectile.velocity = (projectile.velocity * 20f + velocity) / 21f; + if (distance > 2250f) + projectile.Center = player.Center; + } + else + { + projectile.direction = player.direction; + projectile.velocity *= 0.9f; + } + projectile.direction = projectile.spriteDirection = player.direction; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + Lighting.AddLight(projectile.Center - Vector2.UnitY * 21f, 0.25f, 0.865f, 0.825f); + } + } +} diff --git a/Projectiles/Summon/PlaguebringerMK2.png b/Projectiles/Summon/PlaguebringerMK2.png new file mode 100644 index 0000000000..15cce7e358 Binary files /dev/null and b/Projectiles/Summon/PlaguebringerMK2.png differ diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs new file mode 100644 index 0000000000..9e6f5bed57 --- /dev/null +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -0,0 +1,160 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PowerfulRaven : ModProjectile + { + public const float DistanceToCheck = 3200f; + public const float TeleportDistance = 2700f; + public const float SeparationAnxietyDistance = 2000f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Raven"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 24; + 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.ai[0] = -1f; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.powerfulRaven = false; + } + if (modPlayer.powerfulRaven) + { + projectile.timeLeft = 2; + } + } + + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + + if (potentialTarget != null) + { + projectile.ai[1] += 1f; + if (projectile.Distance(potentialTarget.Center) > TeleportDistance) + { + projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; + } + else + { + if (projectile.ai[1] % 45f == 28f || projectile.Distance(potentialTarget.Center) > 450f) + { + if (Main.rand.NextBool(6)) + { + projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; + for (int i = 0; i < 40; i++) + { + float angle = MathHelper.TwoPi / 20f * i; + float lerp = MathHelper.Lerp(0f, 1f, (float)Math.Sin(i / 8f * MathHelper.TwoPi) * 0.5f + 0.5f); + Dust dust = Dust.NewDustPerfect(projectile.position, DustID.Fire); + dust.velocity = Vector2.Lerp(Vector2.Zero, angle.ToRotationVector2() * 6f, lerp); + dust.noGravity = true; + } + } + projectile.velocity = (potentialTarget.Center - projectile.Center) / 50f; + if (projectile.velocity.Length() < 34f) + { + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * 34f; + } + for (int i = 0; i < 20; i++) + { + float angle = MathHelper.TwoPi / 20f * i; + Dust dust = Dust.NewDustPerfect(projectile.position + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(14f, 21f), DustID.Fire); + dust.velocity = angle.ToRotationVector2().RotatedBy(projectile.rotation) * 2f; + dust.noGravity = true; + } + } + if (projectile.ai[1] % 45f >= 28f) + { + projectile.frame = Main.projFrames[projectile.type] - 1; + Lighting.AddLight(projectile.Center, 1f, 1f, 1f); + } + else + { + projectile.velocity *= 0.95f; + projectile.rotation = projectile.rotation.AngleTowards(0f, 0.3f); + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type] - 1) + { + projectile.frame = 0; + } + } + } + } + else + { + projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type] - 1) + { + projectile.frame = 0; + } + if (projectile.Distance(player.Center) > SeparationAnxietyDistance) + { + projectile.Center = player.Center; + projectile.velocity = Utils.NextVector2Unit(Main.rand) * 12f; + } + else if (projectile.Distance(player.Center) > 90f) + { + projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(player.Center) * 12f) / 20f; + } + } + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + } + } +} diff --git a/Projectiles/Summon/PowerfulRaven.png b/Projectiles/Summon/PowerfulRaven.png new file mode 100644 index 0000000000..e94f199700 Binary files /dev/null and b/Projectiles/Summon/PowerfulRaven.png differ diff --git a/Projectiles/Summon/ProfanedCrystalMageFireball.png b/Projectiles/Summon/ProfanedCrystalMageFireball.png new file mode 100644 index 0000000000..d83b5f5d2b Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalMageFireball.png differ diff --git a/Projectiles/Summon/ProfanedCrystalMageFireballSplit.png b/Projectiles/Summon/ProfanedCrystalMageFireballSplit.png new file mode 100644 index 0000000000..edcdd5d8b7 Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalMageFireballSplit.png differ diff --git a/Projectiles/Summon/ProfanedCrystalMeleeSpear.png b/Projectiles/Summon/ProfanedCrystalMeleeSpear.png new file mode 100644 index 0000000000..e64b5053e6 Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalMeleeSpear.png differ diff --git a/Projectiles/Summon/ProfanedCrystalRangedHuges.png b/Projectiles/Summon/ProfanedCrystalRangedHuges.png new file mode 100644 index 0000000000..ca9b1d8ac6 Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalRangedHuges.png differ diff --git a/Projectiles/Summon/ProfanedCrystalRangedSmalls.png b/Projectiles/Summon/ProfanedCrystalRangedSmalls.png new file mode 100644 index 0000000000..385e7d67b1 Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalRangedSmalls.png differ diff --git a/Projectiles/Summon/ProfanedCrystalRogueShard.png b/Projectiles/Summon/ProfanedCrystalRogueShard.png new file mode 100644 index 0000000000..5104abbbe6 Binary files /dev/null and b/Projectiles/Summon/ProfanedCrystalRogueShard.png differ diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs new file mode 100644 index 0000000000..09dffb60fb --- /dev/null +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -0,0 +1,1308 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + #region Mage Projectiles + + #region Main Fireball + class ProfanedCrystalMageFireball : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bab Fireball"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + private void Split(bool hit) + { + Player player = Main.player[projectile.owner]; + bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + player.Calamity().rollBabSpears(hit ? 1 : 0); + int outerSplits = enrage ? 20 : 10; + int innerSplits = enrage ? 16 : 8; + float mult = enrage ? 0.4f : 0.6f; + if (!hit) + mult = enrage ? 0.2f : 0.1f; //punishing to miss + int damage = (int)((projectile.damage * 0.2f) * mult); + + float outerAngleVariance = MathHelper.TwoPi / (float)outerSplits; + float outerOffsetAngle = MathHelper.Pi / (2f * outerSplits); + float innerAngleVariance = MathHelper.TwoPi / (float)innerSplits; + float innerOffsetAngle = MathHelper.Pi / (2f * innerSplits); + Vector2 outerPosVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); + Vector2 innerPosVec = new Vector2(5f, 0f).RotatedByRandom(MathHelper.TwoPi); //Two vector variables since they get reassigned during the loop + + for (int i = 0; i < outerSplits; i++) //use outer since it has the higher number regardless + { + outerPosVec = outerPosVec.RotatedBy(outerAngleVariance); + Vector2 velocity = new Vector2(outerPosVec.X, outerPosVec.Y).RotatedBy(outerOffsetAngle); + velocity.Normalize(); + velocity *= 8f; + int proj = Projectile.NewProjectile(projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj != -1) + Main.projectile[proj].Calamity().forceMinion = true; + if (innerSplits > 0) //only runs if there's still inner splits to create + { + innerPosVec = innerPosVec.RotatedBy(innerAngleVariance); + velocity = new Vector2(innerPosVec.X, innerPosVec.Y).RotatedBy(innerOffsetAngle); + velocity.Normalize(); + velocity *= 5f; + proj = Projectile.NewProjectile(projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj != -1) + Main.projectile[proj].Calamity().forceMinion = true; + } + innerSplits--; + } + + } + + public override void SetDefaults() + { + projectile.width = 180; + projectile.height = 180; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 75; + projectile.minion = true; + projectile.scale = 0.6f; + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft == 50) + { + projectile.tileCollide = true; + } + if (projectile.wet && !projectile.lavaWet && projectile.timeLeft < 70) //timeleft check because projectile lavawet isn't set until after the first frame + { + projectile.Kill(); + } + 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); + } + return false; + } + + public override void AI() + { + int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + + 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 Rectangle(0, y6, 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 (Main.myPlayer == projectile.owner) + { + Split(true); + } + projectile.active = false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (Main.myPlayer == projectile.owner) + { + Split(true); + } + projectile.active = false; + } + + public override void Kill(int timeLeft) + { + if (Main.myPlayer == projectile.owner) + { + Split(false); + } + 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, 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, 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, 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } + #endregion + + #region Fireball Split + class ProfanedCrystalMageFireballSplit : ModProjectile + { + private int damage; + private int hits = 0; + private NPC target = null; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bab Fire"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.minion = true; + projectile.gfxOffY = -25f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + return true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 5, 1, 0); + if (projectile.timeLeft == 600) + { + damage = projectile.damage; + projectile.damage = 0; + + } + if (projectile.timeLeft > 550) + projectile.velocity *= 0.95f; + int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + + + if (projectile.timeLeft <= 550) + { + if (projectile.penetrate == -1) + projectile.damage = damage; + projectile.penetrate = 1; + if (projectile.timeLeft > 500) + projectile.velocity *= 1.06f; + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 3000f; + bool flag19 = false; + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + target = ownerMinionAttackTargetNPC2; + } + } + if (!flag19) + { + int num3; + for (int num542 = 0; num542 < Main.npc.Length; 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; + target = Main.npc[num542]; + } + } + num3 = num542; + } + } + if (flag19) + { + 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; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(35); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(35); + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (hits > 0) + { + damage -= (int)(damage * (0.1f * (hits / 10))); //loses 10% damage per 10 hits + } + } + + public override bool? CanHitNPC(NPC target) + { + bool instakill = target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType() + || target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType(); + if (!instakill && this.target != null && target != this.target) + { + if (projectile.getRect().Intersects(target.getRect())) + { + hits++; + if (hits >= 100) + projectile.Kill(); + } + return false; + } + return null; + } + + 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 = projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 4; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + + } + } + } + #endregion + + #endregion + + #region Melee Projectile + public class ProfanedCrystalMeleeSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Friendly Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 50; + projectile.minion = true; + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + projectile.velocity *= 1.06f; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + Lighting.AddLight(projectile.Center, 5, 1, 0); + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + if (projectile.timeLeft == 50 && projectile.ai[1] == 1f) + projectile.penetrate = 3; + return true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.timeLeft > 133 && projectile.ai[0] < 2f) + return false; + return null; + } + + public override bool CanHitPvp(Player target) + { + return projectile.timeLeft <= 133 || projectile.ai[0] == 2f; + } + + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.ai[0] == 1f && projectile.penetrate == 1) + { + handleSpecialHit(target.Center); + } + int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; + Main.player[projectile.owner].Calamity().rollBabSpears(chance); + } + + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) + { + if (projectile.ai[0] == 1f && projectile.penetrate == 1) + { + handleSpecialHit(target.Center); + } + int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; + Main.player[projectile.owner].Calamity().rollBabSpears(chance); + } + + private void handleSpecialHit(Vector2 targCenter) + { + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 10; ++i) + { + float startDist = Main.rand.NextFloat(450f, 500f); + Vector2 startDir = Main.rand.NextVector2Unit(); + Vector2 startPoint = targCenter + (startDir * startDist); + + float speed = Main.rand.NextFloat(15f, 18f); + Vector2 velocity = startDir * (-speed); + Projectile.NewProjectile(startPoint, velocity, ModContent.ProjectileType(), (int)(0.25f * projectile.damage), 0f, projectile.owner, 2f, 0f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 133) + { + projectile.localAI[0] += 5f; + byte b2 = (byte)(((int)projectile.localAI[0]) * 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); + } + } + #endregion + + #region Ranger Projectiles + + #region Meteors + public class ProfanedCrystalRangedHuges : ModProjectile + { + bool boomerSwarm = false; + bool kill = false; + NPC target = null; + + private void swarmAI() + { + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 2000f; + bool flag19 = false; + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + target = ownerMinionAttackTargetNPC2; + } + } + if (!flag19) + { + for (int num542 = 0; num542 < Main.npc.Length; num542++) + { + 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; + target = Main.npc[num542]; + } + } + } + } + if (flag19) + { + projectile.tileCollide = false; + if (projectile.timeLeft < 20) + { + projectile.timeLeft = 50; + kill = true; + } + + float num550 = 40f; + 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 (kill) + projectile.Kill(); + projectile.tileCollide = true; + } + } + + private void swarm(Vector2 targetPos) + { + if (projectile.owner == Main.myPlayer) + { + float swarmAmount = Main.rand.Next(6, 10); //6-9 + for (float i = 0; i < swarmAmount; i++) + { + float x = targetPos.X + Main.rand.Next(-500, 501); + float y = targetPos.Y - 500 + Main.rand.Next(-200, 1); + Vector2 pos = new Vector2(x, y); + Vector2 correctedVelocity = projectile.position - pos; + correctedVelocity.Normalize(); + correctedVelocity *= 25f; + int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType(), (int)((double)projectile.damage * 1.5f), projectile.knockBack, projectile.owner, 2); + Main.projectile[proj].Calamity().forceMinion = true; + ((ProfanedCrystalRangedHuges)Main.projectile[proj].modProjectile).boomerSwarm = true; + } + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bab Boomer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 50; + projectile.friendly = true; + //projectile.minion = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 175; + projectile.localNPCHitCooldown = -1; + projectile.usesLocalNPCImmunity = true; + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + bool begin = projectile.timeLeft == 175; + if (projectile.ai[0] >= 1 && begin) + { + projectile.scale = 1.5f; + projectile.width += 25; + projectile.height += 25; + boomerSwarm = projectile.ai[0] == 2; + if (boomerSwarm && projectile.ai[1] == 0f) + { + projectile.timeLeft = 200; + projectile.ai[1] = 1f; + } + } + return true; + } + + public override void AI() + { + if (projectile.timeLeft == 175 && projectile.scale == 1.5f) + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.timeLeft == 145 && projectile.ai[0] < 2f) + { + projectile.tileCollide = true; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; + + int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + if (boomerSwarm) + swarmAI(); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool? CanHitNPC(NPC target) + { + bool instakill = target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType() + || target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType(); + if (!instakill && this.target != null && target != this.target) + return false; + return null; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 1f ? 1 : 10); + if (projectile.scale == 1.5f && projectile.ai[0] != 2f) + swarm(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.scale == 1.5f ? 1 : 10); + if (projectile.scale == 1.5f && projectile.ai[0] != 2f) + swarm(target.Center); + } + + 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 = projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 4; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + if (projectile.scale != 1.5f) + return; + 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, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[num626]; + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + } + #endregion + + #region Fireballs + + public class ProfanedCrystalRangedSmalls : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bab Boomer 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.penetrate = 1; + projectile.timeLeft = 240; + //projectile.minion = true; + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + return true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 0f) { + } + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.timeLeft == 210) + projectile.tileCollide = true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] == 1f && projectile.timeLeft > 210) + return false; + return null; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (!Main.rand.NextBool(3)) //1 in 3 chance for dust + return; + 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, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(50); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(50); + } + } + + #endregion + + #endregion + + #region Rogue Projectile + + public class ProfanedCrystalRogueShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bab Crystal Shard"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 150; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.scale = 0.8f; + } + + private void ai() + { + if (projectile.timeLeft > 90) + { + projectile.rotation += 1f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 2000f; + bool flag19 = false; + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + if (!flag19) + { + int num3; + for (int num542 = 0; num542 < 200; num542 = num3 + 1) + { + if (Main.npc[num542].CanBeChasedBy(projectile, false)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + if (flag19) //target found + { + if (Main.rand.NextBool()) + projectile.timeLeft++; + projectile.tileCollide = false; + float num550 = 40f; + 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 + { + projectile.tileCollide = true; + } + } + + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override bool PreAI() + { + projectile.Calamity().overridesMinionDamagePrevention = true; + return true; + } + + public override void AI() + { + ai(); + 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.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.NextBool(10)) + { + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + 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.NextBool(10)) + { + Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); + 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.NextBool(10)) + { + 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 bool? CanHitNPC(NPC target) + { + if (projectile.timeLeft > 90) + return false; + return null; + } + + public override bool CanHitPvp(Player target) + { + return projectile.timeLeft <= 90; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10); + } + + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) + { + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10); + } + + + + 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) * 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) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[num74]; + dust.velocity *= Main.rand.NextFloat() * 0.8f; + dust.noGravity = true; + dust.scale = Main.rand.NextFloat() * 1f; + dust.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); + } + } + + #endregion + + #region Bab Spears + + class MiniGuardianSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bab Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 100; + projectile.timeLeft = 300; + projectile.extraUpdates = 1; + projectile.minion = true; + projectile.scale = 0.9f; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + if (projectile.timeLeft == 300) + { + projectile.velocity *= 0.01f; + } + else if (projectile.timeLeft > 250) + { + projectile.velocity *= 1.1f; + } + else if (projectile.timeLeft == 250) + { + projectile.velocity *= 5f; + } + if (projectile.timeLeft <= 250) + { + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 3000f; + bool flag19 = false; + NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + { + float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); + float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + if (!flag19) + { + for (int num542 = 0; num542 < Main.npc.Length; num542++) + { + 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; + } + } + } + } + if (flag19) + { + 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; + } + } + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.timeLeft > 250) + return false; + return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (Main.rand.NextBool(3)) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + 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 num621 = 0; num621 < 4; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + + } + } + } + } + + #endregion +} diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 33da0be8cc..4db43742ba 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon } } float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) + for (int num638 = 0; num638 < Main.maxProjectiles; num638++) { bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) + if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) + if ((nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) && nPC2.active) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs new file mode 100644 index 0000000000..8112d59c9f --- /dev/null +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -0,0 +1,126 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class RadiantResolutionAura : ModProjectile + { + public const float DistanceToCheck = 1600f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Saros Possession"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 66; + projectile.height = 66; + 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, 2f, 2f, 2f); + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + modPlayer.radiantResolution = false; + } + if (modPlayer.radiantResolution) + { + projectile.timeLeft = 2; + } + } + + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + projectile.minionSlots = projectile.ai[0]; + + projectile.Center = player.Center - Vector2.UnitY * 16f; + + float allocatedSlots = projectile.ai[0]; + projectile.rotation += MathHelper.ToRadians(3f) + MathHelper.ToRadians(allocatedSlots * 0.85f); + + int radiantOrbDamage = (int)(139 * Math.Log(allocatedSlots + 1f, 1.414214)) + 655; + int radiantOrbAppearRate = (int)(124 * Math.Pow(0.9, allocatedSlots)); + + if (radiantOrbAppearRate < 7) + radiantOrbAppearRate = 7; + + if (radiantOrbDamage > 10000) + radiantOrbDamage = 10000; + + projectile.ai[1]++; + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + if (potentialTarget != null) + { + if (projectile.ai[1] % 35 == 34) + { + for (int i = 0; i < 3; i++) + { + float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f, + ModContent.ProjectileType(), radiantOrbDamage / 2, 1f, projectile.owner); + } + } + if (projectile.ai[1] % radiantOrbAppearRate == radiantOrbAppearRate - 1) + { + Projectile.NewProjectile(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(100f, 360f), + projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, 4f, projectile.owner); + for (int i = 0; i < 4; i++) + { + float angle = MathHelper.Lerp(-MathHelper.ToRadians(40f), MathHelper.ToRadians(40f), i / 4f); + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f, + ModContent.ProjectileType(), radiantOrbDamage / 2, 1f, projectile.owner); + } + } + } + } + + public override bool CanDamage() => false; + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D currentTexture = ModContent.GetTexture(Texture); + spriteBatch.Draw(currentTexture, + projectile.Center - Main.screenPosition, + null, + lightColor, + projectile.rotation + MathHelper.PiOver2, + currentTexture.Size() / 2f, + 1f, + SpriteEffects.None, + 0f); + } + } +} diff --git a/Projectiles/Summon/RadiantResolutionAura.png b/Projectiles/Summon/RadiantResolutionAura.png new file mode 100644 index 0000000000..9a3de1b6ea Binary files /dev/null and b/Projectiles/Summon/RadiantResolutionAura.png differ diff --git a/Projectiles/Summon/RadiantResolutionFire.cs b/Projectiles/Summon/RadiantResolutionFire.cs new file mode 100644 index 0000000000..cdf928db0a --- /dev/null +++ b/Projectiles/Summon/RadiantResolutionFire.cs @@ -0,0 +1,61 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class RadiantResolutionFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.light = 1f; + projectile.timeLeft = 300; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + dust.noGravity = true; + NPC potentialTarget = projectile.Center.MinionHoming(1750f, player); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(potentialTarget.Center) * 20f) / 20f; + } + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 60; + projectile.position -= projectile.Size / 2f; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); + dust.noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/RadiantResolutionFire.png b/Projectiles/Summon/RadiantResolutionFire.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/Summon/RadiantResolutionFire.png differ diff --git a/Projectiles/Summon/RadiantResolutionOrb.cs b/Projectiles/Summon/RadiantResolutionOrb.cs new file mode 100644 index 0000000000..75964c08f9 --- /dev/null +++ b/Projectiles/Summon/RadiantResolutionOrb.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class RadiantResolutionOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 64; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 9; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + Player player = Main.player[projectile.owner]; + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + if (projectile.ai[0]++ < 30f) + { + projectile.velocity *= 1.01f; + } + else + { + NPC potentialTarget = projectile.Center.MinionHoming(2000f, player); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(potentialTarget.Center) * 19f) / 8f; + } + } + } + } +} diff --git a/Projectiles/Summon/RadiantResolutionOrb.png b/Projectiles/Summon/RadiantResolutionOrb.png new file mode 100644 index 0000000000..68fa0b7372 Binary files /dev/null and b/Projectiles/Summon/RadiantResolutionOrb.png differ diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs new file mode 100644 index 0000000000..49c9b0bd64 --- /dev/null +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -0,0 +1,141 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class SkeletalDragonChild : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Child"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 48; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + projectile.minionSlots = 0f; + projectile.extraUpdates = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + + if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length) + { + projectile.Kill(); + return; + } + + Projectile mother = Main.projectile[(int)projectile.ai[0]]; + + if (!mother.active || mother.type != ModContent.ProjectileType()) + { + projectile.Kill(); + return; + } + + NPC target = projectile.Center.MinionHoming(SkeletalDragonMother.DistanceToCheck * 0.666f, player); + + if (target != null) + { + projectile.ai[1]++; + if (projectile.ai[1] % 55f == 54f && + Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); + } + } + + // If the mother is dive-bombing + if (mother.ai[1] == 1f) + { + if (target != null) + { + if (projectile.Distance(mother.Center) > 620f) + { + projectile.velocity = (mother.Center - projectile.Center) / 45f; + } + else + { + projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(mother.Center) * 16f) / 20f; + } + } + else + { + if (projectile.Distance(mother.Center) > 250f) + { + projectile.velocity = (mother.Center - projectile.Center) / 28f; + } + else + { + projectile.velocity += new Vector2(Math.Sign(mother.Center.X - projectile.Center.X), Math.Sign(mother.Center.Y - projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); + if (projectile.velocity.Length() > 8f) + { + projectile.velocity *= 8f / projectile.velocity.Length(); + } + } + } + } + else + { + if (projectile.Distance(mother.Center) > 250f) + { + projectile.velocity = (mother.Center - projectile.Center) / 28f; + } + else + { + projectile.velocity += new Vector2(Math.Sign(mother.Center.X - projectile.Center.X), Math.Sign(mother.Center.Y - projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); + if (projectile.velocity.Length() > 8f) + { + projectile.velocity *= 8f / projectile.velocity.Length(); + } + } + } + + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Summon/SkeletalDragonChild.png b/Projectiles/Summon/SkeletalDragonChild.png new file mode 100644 index 0000000000..d199e87b60 Binary files /dev/null and b/Projectiles/Summon/SkeletalDragonChild.png differ diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs new file mode 100644 index 0000000000..9c81b9aac4 --- /dev/null +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -0,0 +1,145 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class SkeletalDragonMother : ModProjectile + { + public const float DistanceToCheck = 1100f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mother"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 92; + projectile.height = 78; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + projectile.minionSlots = 6f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(projectile.Center + Utils.RandomVector2(Main.rand, -24f, 24f), + Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, player.whoAmI, projectile.whoAmI); + } + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.dragonFamily = false; + } + if (modPlayer.dragonFamily) + { + projectile.timeLeft = 2; + } + } + + NPC target = projectile.Center.MinionHoming(DistanceToCheck, player); + + if (target != null) + { + projectile.ai[0]++; + + // Arc towards enemy every 60 frames for 30 frames. + float modulo = projectile.ai[0] % 150f; + if ((modulo < 30f) || + (modulo >= 90 && modulo < 120f)) + { + if (projectile.velocity.Length() == 0f) + projectile.velocity = projectile.DirectionTo(target.Center).RotatedByRandom(0.5f) * -7f; + float angleToTarget = projectile.AngleTo(target.Center); + float velocityAngle = projectile.velocity.ToRotation(); + float resultantAngle = velocityAngle.AngleLerp(angleToTarget, 0.08f); + if (projectile.Distance(target.Center) > 70f) + { + projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(resultantAngle); + } + else + { + projectile.velocity = (projectile.velocity * 44f + projectile.DirectionTo(player.Center) * 13f) / 45f; + projectile.ai[0] += 30 - projectile.ai[0] % 30f; + } + projectile.ai[1] = 1f; + } + else + { + projectile.ai[1] = 0f; + } + if ((modulo >= 30f && modulo <= 60f) || (modulo >= 90f && modulo <= 120f)) + { + if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.DirectionTo(target.Center).X > 0).ToDirectionInt()) + { + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + } + } + } + else if (projectile.Distance(player.Center) > 175f) + { + projectile.ai[1] = 0f; + projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(player.Center) * 13f) / 25f; + if (projectile.Distance(player.Center) > 3250f) + { + projectile.Center = player.Center; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && + Main.projectile[i].type == ModContent.ProjectileType()) + { + Main.projectile[i].Center = player.Center; + } + } + } + } + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Summon/SkeletalDragonMother.png b/Projectiles/Summon/SkeletalDragonMother.png new file mode 100644 index 0000000000..cebca6800f Binary files /dev/null and b/Projectiles/Summon/SkeletalDragonMother.png differ diff --git a/Projectiles/Summon/SummonAstralExplosion.cs b/Projectiles/Summon/SummonAstralExplosion.cs new file mode 100644 index 0000000000..2a1bc90fc7 --- /dev/null +++ b/Projectiles/Summon/SummonAstralExplosion.cs @@ -0,0 +1,50 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class SummonAstralExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 150; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 3; + projectile.timeLeft = 60; + } + + public override void AI() + { + // Bluish cyan light + Lighting.AddLight(projectile.Center, 66f / 255f, 189f / 255f, 181f / 255f); + float dustCount = 25f; + dustCount *= 0.7f; + projectile.ai[0] += 4f; + int counter = 0; + while (counter < dustCount) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + Dust dust = Dust.NewDustPerfect(projectile.Center, dustType, Vector2.Zero, 100, default, 1.325f); + dust.noGravity = true; + dust.position += Utils.RandomVector2(Main.rand, -10f, 10f); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1.5f, 5f); + counter++; + } + } + } +} diff --git a/Projectiles/Summon/SummonAstralExplosion.png b/Projectiles/Summon/SummonAstralExplosion.png new file mode 100644 index 0000000000..31ba8e33dc Binary files /dev/null and b/Projectiles/Summon/SummonAstralExplosion.png differ diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs new file mode 100644 index 0000000000..fb2948aa31 --- /dev/null +++ b/Projectiles/Summon/YoungDuke.cs @@ -0,0 +1,124 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class YoungDuke : ModProjectile + { + public const float DistanceBeforeCharge = 420f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Young Old Duke"); + Main.projFrames[projectile.type] = 16; + 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.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + // Adjust damage as needed + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.allDamage + player.minionDamage - 1f; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + (player.allDamage + player.minionDamage - 1f)); + projectile.damage = trueDamage; + } + + bool playerHalfLife = player.statLife <= player.statLifeMax2 * 0.5f; + + // Frames + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + if (playerHalfLife && projectile.frame < Main.projFrames[projectile.type] / 2) + { + projectile.frame += Main.projFrames[projectile.type] / 2; + } + else if (!playerHalfLife && projectile.frame >= Main.projFrames[projectile.type] / 2) + { + projectile.frame -= Main.projFrames[projectile.type] / 2; + } + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) + { + if (player.dead) + { + modPlayer.miniOldDuke = false; + } + if (modPlayer.miniOldDuke) + { + projectile.timeLeft = 2; + } + } + NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + if (potentialTarget != null) + { + if (projectile.Distance(potentialTarget.Center) < DistanceBeforeCharge) + { + projectile.ai[0] += 1f; + int timePerCharge = playerHalfLife ? 33 : 50; + float chargeSpeed = playerHalfLife ? 22f : 17.5f; + if (projectile.ai[0] >= timePerCharge) + { + projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * chargeSpeed; + projectile.ai[0] = 0f; + } + else + projectile.velocity *= 0.9825f; + } + else + { + float intertia = 0.94f; + float homeSpeed = playerHalfLife ? 33f : 25.75f; + projectile.velocity = Vector2.Lerp(projectile.velocity, + projectile.DirectionTo(potentialTarget.Center) * homeSpeed, + 1f - intertia); + } + } + else if (projectile.Distance(player.Center) > 140f) + { + projectile.velocity = (projectile.velocity * 30f + projectile.DirectionTo(player.Center) * 16f) / 31f; + } + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + } + } +} diff --git a/Projectiles/Summon/YoungDuke.png b/Projectiles/Summon/YoungDuke.png new file mode 100644 index 0000000000..eb0047828e Binary files /dev/null and b/Projectiles/Summon/YoungDuke.png differ diff --git a/Projectiles/Summon/YoungDukeEyes.png b/Projectiles/Summon/YoungDukeEyes.png new file mode 100644 index 0000000000..5356cc010b Binary files /dev/null and b/Projectiles/Summon/YoungDukeEyes.png differ diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs new file mode 100644 index 0000000000..f53322750f --- /dev/null +++ b/Tiles/Abyss/SteamGeyser.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SteamGeyser : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Geyser"); + AddMapEntry(new Color(150, 100, 50), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + public override void NearbyEffects(int i, int j, bool closer) + { + if (WorldGen.genRand.NextBool(60)) + { + if (Math.Abs(Main.LocalPlayer.Center.X - i * 16) < 80 && + Main.LocalPlayer.Bottom.Y < j * 16 && + Main.LocalPlayer.Bottom.Y > j * 16 - 300) + { + float yeetSpeed = MathHelper.Clamp(10f - (10f * Math.Abs(Main.LocalPlayer.Bottom.Y - j * 16) / 300f), 0f, 10f); + Main.LocalPlayer.velocity.Y -= yeetSpeed; + Projectile.NewProjectile(i * 16 + 8, j * 16 - 20, 0f, -10f, ModContent.ProjectileType(), 25, 0f); + } + } + } + } +} diff --git a/Tiles/Abyss/SteamGeyser.png b/Tiles/Abyss/SteamGeyser.png new file mode 100644 index 0000000000..ca6860255c Binary files /dev/null and b/Tiles/Abyss/SteamGeyser.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index a6d43e2f95..fb8795d3aa 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.StyleWrapLimit = 111; TileObjectData.addTile(Type); dustType = -1; disableSmartCursor = true; @@ -369,6 +368,24 @@ namespace CalamityMod.Tiles case 110: item = "RadiatorBanner"; break; + case 111: + item = "TrilobiteBanner"; + break; + case 112: + item = "OrthoceraBanner"; + break; + case 113: + item = "SkyfinBanner"; + break; + case 114: + item = "WaterLeechBanner"; + break; + case 115: + item = "AcidEelBanner"; + break; + case 116: + item = "NuclearToadBanner"; + break; default: return; } @@ -720,6 +737,24 @@ namespace CalamityMod.Tiles case 110: type = "Radiator"; break; + case 111: + type = "Trilobite"; + break; + case 112: + type = "Orthocera"; + break; + case 113: + type = "Skyfin"; + break; + case 114: + type = "WaterLeech"; + break; + case 115: + type = "AcidEel"; + break; + case 116: + type = "NuclearToad"; + break; default: return; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 59a49dbb3e..ee7b502b79 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index de1b630a4a..1bc8d2569b 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -143,15 +143,8 @@ namespace CalamityMod #region Astral Alternatives private static void AstralAlternatives() { - // Glass - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 2); - r.AddTile(TileID.Furnaces); - r.SetResult(ItemID.Glass); - r.AddRecipe(); - //Bowl - r = GetNewRecipe(); + ModRecipe r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(TileID.Furnaces); r.SetResult(ItemID.Bowl); @@ -866,6 +859,14 @@ namespace CalamityMod public static void AddRecipeGroups() { + //Modify Vanilla Recipe Groups + RecipeGroup firefly = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Fireflies"]]; + firefly.ValidItems.Add(ModContent.ItemType()); + + RecipeGroup sand = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Sand"]]; + sand.ValidItems.Add(ModContent.ItemType()); + + //New Groups RecipeGroup group = new RecipeGroup(() => "Any Copper Bar", new int[] { ItemID.CopperBar, diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 1caae24bfc..2e997d081f 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -155,7 +155,7 @@ namespace CalamityMod { for (int index = 0; index < Main.npc.Length; index++) { - if (Main.npc[index].CanBeChasedBy(null, false) && Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1)) + if (Main.npc[index].CanBeChasedBy(null, false)) { if (Vector2.Distance(origin, Main.npc[index].Center) < distance) { @@ -2151,6 +2151,13 @@ namespace CalamityMod break; } } + + public static string ColorMessage(string msg, Color color) + { + StringBuilder sb = new StringBuilder(msg.Length + 12); + sb.Append("[c/").Append(color.Hex3()).Append(':').Append(msg).Append(']'); + return sb.ToString(); + } #endregion #region Miscellaneous Utilities diff --git a/Utilities/Downed.cs b/Utilities/Downed.cs new file mode 100644 index 0000000000..64a17c4610 --- /dev/null +++ b/Utilities/Downed.cs @@ -0,0 +1,35 @@ +using CalamityMod.World; +using System; + +namespace CalamityMod +{ + internal class Downed + { + public static readonly Func DownedDesertScourge = () => CalamityWorld.downedDesertScourge; + public static readonly Func DownedGiantClam = () => CalamityWorld.downedCLAM; + public static readonly Func DownedCrabulon = () => CalamityWorld.downedCrabulon; + public static readonly Func DownedHiveMind = () => CalamityWorld.downedHiveMind; + public static readonly Func DownedPerfs = () => CalamityWorld.downedPerforator; + public static readonly Func DownedSlimeGod = () => CalamityWorld.downedSlimeGod; + public static readonly Func DownedCryogen = () => CalamityWorld.downedCryogen; + public static readonly Func DownedBrimstoneElemental = () => CalamityWorld.downedBrimstoneElemental; + public static readonly Func DownedAquaticScourge = () => CalamityWorld.downedAquaticScourge; + public static readonly Func DownedCalamitas = () => CalamityWorld.downedCalamitas; + public static readonly Func DownedGSS = () => CalamityWorld.downedGSS; + public static readonly Func DownedLeviathan = () => CalamityWorld.downedLeviathan; + public static readonly Func DownedAureus = () => CalamityWorld.downedAstrageldon; + public static readonly Func DownedPBG = () => CalamityWorld.downedPlaguebringer; + public static readonly Func DownedRavager = () => CalamityWorld.downedScavenger; + public static readonly Func DownedDeus = () => CalamityWorld.downedStarGod; + public static readonly Func DownedGuardians = () => CalamityWorld.downedGuardians; + public static readonly Func DownedBirb = () => CalamityWorld.downedBumble; + public static readonly Func DownedProvidence = () => CalamityWorld.downedProvidence; + public static readonly Func DownedCeaselessVoid = () => CalamityWorld.downedSentinel1; + public static readonly Func DownedStormWeaver = () => CalamityWorld.downedSentinel2; + public static readonly Func DownedSignus = () => CalamityWorld.downedSentinel3; + public static readonly Func DownedPolterghast = () => CalamityWorld.downedPolterghast; + public static readonly Func DownedDoG = () => CalamityWorld.downedDoG; + public static readonly Func DownedYharon = () => CalamityWorld.downedYharon; + public static readonly Func DownedSCal = () => CalamityWorld.downedSCal; + } +} diff --git a/World/Abyss.cs b/World/Abyss.cs index 6a63a7044e..ec82a14848 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -1,6 +1,9 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +14,331 @@ namespace CalamityMod.World { public static void PlaceSulphurSea() { + CalamityWorld.abyssSide = Main.dungeonX < Main.maxTilesX / 2; + int yStart = DetermineYStart(); + // How wide the biome is. + // Note: Change this to suit all world sizes once the biome layout code is complete. + const int biomeWidth = 270; + // How deep the biome goes. + const int yDescent = 80; + + PlaceShallowSea(biomeWidth, yStart, yDescent); + PlaceCavernBlock(biomeWidth, yStart); + PlaceWaterCaverns(biomeWidth, yStart - 20); + PlaceScenery(yStart, yDescent, biomeWidth); + // Empty cavern pockets were becoming a problem. + ReplaceAirWithWater(yStart, biomeWidth); + RemoveWeirdSlopes(yStart, biomeWidth); + + // A copy of old sulf sea code that replaced all sand with sulph sea/abyss gravel. + // Made by Fabsol. + ReplaceRemainingSand(); + } + public static int DetermineYStart() + { + int xCheck = CalamityWorld.abyssSide ? + WorldGen.genRand.Next(95, 120) : + Main.maxTilesX - WorldGen.genRand.Next(95, 120); + int yStart = 1; + while (Main.tile[xCheck, yStart].liquid == 0) + { + yStart++; + if (yStart > Main.worldSurface) + break; + } + return yStart; + } + public static void PlaceShallowSea(int biomeWidth, int yStart, int yDescent) + { + // Create a block + if (CalamityWorld.abyssSide) + { + for (int x = 0; x < biomeWidth; x++) + { + float xRatio = MathHelper.Clamp(x / (float)biomeWidth, 0f, 0.7f); + for (int y = yStart; y < yStart + yDescent; y++) + { + if (1f - ((y - yStart) / (float)yDescent) < xRatio) + { + Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].slope(0); + Main.tile[x, y].active(true); + } + else + { + Main.tile[x, y] = new Tile() + { + liquid = 255 + }; + } + } + } + } + else + { + int xCounter = 0; + for (int x = Main.maxTilesX - 1; x >= Main.maxTilesX - biomeWidth; x--) + { + float xRatio = MathHelper.Clamp(xCounter / (float)biomeWidth, 0f, 0.7f); + for (int y = yStart; y < yStart + yDescent; y++) + { + if (1f - ((y - yStart) / (float)yDescent) < xRatio) + { + Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].slope(0); + Main.tile[x, y].active(true); + } + else + { + Main.tile[x, y] = new Tile() + { + liquid = 255 + }; + } + } + xCounter++; + } + } + } + public static void PlaceCavernBlock(int biomeWidth, int yStart) + { + if (CalamityWorld.abyssSide) + { + for (int x = 0; x < biomeWidth; x++) + { + for (int y = yStart; y < yStart + 150; y++) + { + if (Main.tile[x, y].liquid == 0) + { + Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].slope(0); + Main.tile[x, y].active(true); + } + } + } + } + else + { + for (int x = Main.maxTilesX - biomeWidth; x < Main.maxTilesX; x++) + { + for (int y = yStart; y < yStart + 150; y++) + { + if (Main.tile[x, y].liquid == 0) + { + Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].slope(0); + Main.tile[x, y].active(true); + } + } + } + } + } + public static void PlaceWaterCaverns(int biomeWidth, int yStart) + { + // This is used in other vanilla worldgen. However, it does not affect any worldgen after this. + // This is basically the point where TileRunner stops spawning water. + WorldGen.waterLine = 1; + int xStart = CalamityWorld.abyssSide ? biomeWidth / 2 : + Main.maxTilesX - biomeWidth / 2; + for (int c = 0; c < 6; c++) + { + Vector2 startingPosition = new Vector2(xStart, yStart); + while (!Main.tile[(int)startingPosition.X, (int)startingPosition.Y].active()) + { + startingPosition.Y++; + } + float xDirection = WorldGen.genRand.NextFloat(); + float yDirection = 1f - xDirection; + if (c == 0) + { + xDirection = WorldGen.genRand.NextFloat(1f, 2f); + yDirection = 2f; + } + if (WorldGen.genRand.NextBool(2)) + { + xDirection *= -1; + } + if (WorldGen.genRand.NextBool(2)) + { + yDirection *= -1; + } + for (int i = 0; i < 11; i++) + { + startingPosition = WorldGen.digTunnel(startingPosition.X, startingPosition.Y, xDirection, yDirection, WorldGen.genRand.Next(6, 20), WorldGen.genRand.Next(4, 9), false); + xDirection += WorldGen.genRand.NextFloat(-0.5f, 0.5f); + yDirection += WorldGen.genRand.NextFloat(-0.2f, 0.2f); + xDirection = MathHelper.Clamp(xDirection, -4f, 4f); + yDirection = MathHelper.Clamp(yDirection, -1f, 3f); + float xdirection2 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); + float ydirection2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); + if (WorldGen.genRand.NextBool(2)) + { + xdirection2 *= -1; + } + if (WorldGen.genRand.NextBool(2)) + { + ydirection2 *= -1; + } + Vector2 tunnelVector = WorldGen.digTunnel(startingPosition.X, startingPosition.Y, xdirection2, ydirection2, WorldGen.genRand.Next(30, 50), WorldGen.genRand.Next(3, 6), false); + + // The -2 parameter causes the tile-runner to generate liquids. Water above the lavaLine and lava below. + WorldGen.TileRunner((int)tunnelVector.X, (int)tunnelVector.Y, WorldGen.genRand.Next(20, 28), WorldGen.genRand.Next(15, 18 + 1), -2, false, 0f, 0f, false, true); + } + } + } + public static void PlaceScenery(int yStart, int yDescent, int biomeWidth) + { + if (CalamityWorld.abyssSide) + { + for (int x = 1; x < biomeWidth; x++) + { + for (int y = yStart; y < yStart + yDescent; y++) + { + if (WorldGen.genRand.NextBool(6)) + { + if (!WorldGen.SolidTile(Framing.GetTileSafely(x, y + 1)) || + !WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y + 1)) || + WorldGen.SolidTile(Framing.GetTileSafely(x, y)) || + WorldGen.SolidTile(Framing.GetTileSafely(x, y - 1)) || + WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y)) || + WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y - 1))) + break; + WorldGen.PlaceTile(x, y, ModContent.TileType()); + } + } + } + } + else + { + for (int x = Main.maxTilesX - biomeWidth; x < Main.maxTilesX; x++) + { + for (int y = yStart; y < yStart + yDescent; y++) + { + if (WorldGen.genRand.NextBool(13)) + { + if (!WorldGen.SolidTile(Framing.GetTileSafely(x, y + 1)) || + !WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y + 1)) || + WorldGen.SolidTile(Framing.GetTileSafely(x, y)) || + WorldGen.SolidTile(Framing.GetTileSafely(x, y - 1)) || + WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y)) || + WorldGen.SolidTile(Framing.GetTileSafely(x + 1, y - 1))) + break; + WorldGen.PlaceTile(x, y, ModContent.TileType()); + } + } + } + } + + // Rock pillars in the water + for (int c = 1; c <= 2; c++) + { + int xStart; + if (CalamityWorld.abyssSide) + xStart = (WorldGen.genRand.Next(-5, 5 + 1) + biomeWidth / 2 + (int)(biomeWidth / 2 / 3f * c * 0.7f) - 20); + else + xStart = Main.maxTilesX - (WorldGen.genRand.Next(-5, 5 + 1) + biomeWidth / 2 + (int)(biomeWidth / 2 / 3f * c * 0.7f) - 20); + int dy = -20; + while (!Main.tile[xStart, yStart + dy].active() || + Main.tile[xStart, yStart + dy].type != (ushort)ModContent.TileType()) + { + dy++; + } + // Adjust to make sure we're a bit above water + int ascent = WorldGen.genRand.Next(18, 25 + 1); + switch (c) + { + case 2: + ascent += 24; + break; + case 1: + ascent += 8; + break; + } + + int widthTop = WorldGen.genRand.Next(3, 6 + 1); + int widthBottomAdditive = WorldGen.genRand.Next(13, 20 + 1); + float root = WorldGen.genRand.NextFloat(1.6f, 3.2f); + for (int y = yStart - ascent; y <= yStart; y++) + { + // The root is used to give a less linear scale + float yRatio = (float)Math.Pow(1f - (-(y - yStart) / (float)ascent), 1f / root); + int width = widthTop + (int)(widthBottomAdditive * yRatio); + for (int x = xStart - width / 2; x <= xStart + width / 2; x++) + { + Main.tile[x, y + dy].type = (ushort)ModContent.TileType(); + Main.tile[x, y + dy].slope(0); + Main.tile[x, y + dy].active(true); + } + } + } + } + public static void ReplaceAirWithWater(int yStart, int biomeWidth) + { + if (CalamityWorld.abyssSide) + { + for (int x = 0; x < biomeWidth; x++) + { + for (int y = yStart + 10; y < yStart + 180; y++) + { + if (!Main.tile[x, y].active()) + { + Main.tile[x, y] = new Tile() + { + liquid = 255 + }; + } + } + } + } + else + { + for (int x = Main.maxTilesX - biomeWidth; x < Main.maxTilesX; x++) + { + for (int y = yStart + 10; y < yStart + 180; y++) + { + if (!Main.tile[x, y].active()) + { + Main.tile[x, y] = new Tile() + { + liquid = 255 + }; + } + } + } + } + } + public static void RemoveWeirdSlopes(int yStart, int biomeWidth) + { + if (CalamityWorld.abyssSide) + { + for (int x = 0; x < biomeWidth; x++) + { + for (int y = yStart - 1; y >= yStart - 60; y--) + { + if (Main.tile[x, y].type == ModContent.TileType()) + { + Main.tile[x, y] = new Tile(); + } + } + } + } + else + { + for (int x = Main.maxTilesX - biomeWidth; x < Main.maxTilesX; x++) + { + for (int y = yStart - 1; y >= yStart - 60; y--) + { + if (Main.tile[x, y].type == ModContent.TileType()) + { + Main.tile[x, y] = new Tile(); + } + } + } + } + } + public static void ReplaceRemainingSand() + { int x = Main.maxTilesX; int y = Main.maxTilesY; int genLimit = x / 2; @@ -127,7 +454,6 @@ namespace CalamityMod.World public static void PlaceAbyss() { - int x = Main.maxTilesX; int y = Main.maxTilesY; int genLimit = x / 2; diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 6bc03d305b..435512ba79 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,6 +1,7 @@ using CalamityMod; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; @@ -101,6 +102,7 @@ namespace CalamityMod.World public static int abyssTiles = 0; public static bool abyssSide = false; public static int abyssChasmBottom = 0; + public static bool rainingAcid; //Astral public static int astralTiles = 0; @@ -227,6 +229,7 @@ namespace CalamityMod.World armageddon = false; ironHeart = false; dragonScalesBought = false; + rainingAcid = false; } #endregion @@ -318,6 +321,8 @@ namespace CalamityMod.World downed.Add("clam"); if (dragonScalesBought) downed.Add("scales"); + if (rainingAcid) + downed.Add("acidRain"); return new TagCompound { @@ -377,6 +382,7 @@ namespace CalamityMod.World bossRushActive = downed.Contains("bossRushActive"); downedCLAM = downed.Contains("clam"); dragonScalesBought = downed.Contains("scales"); + rainingAcid = downed.Contains("acidRain"); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); } @@ -457,6 +463,7 @@ namespace CalamityMod.World downedOldDuke = flags7[1]; downedCLAM = flags7[2]; dragonScalesBought = flags7[3]; + rainingAcid = flags7[4]; } else { @@ -535,6 +542,7 @@ namespace CalamityMod.World flags7[1] = downedOldDuke; flags7[2] = downedCLAM; flags7[3] = dragonScalesBought; + flags7[4] = rainingAcid; writer.Write(flags); writer.Write(flags2); @@ -617,6 +625,7 @@ namespace CalamityMod.World downedOldDuke = flags7[1]; downedCLAM = flags7[2]; dragonScalesBought = flags7[3]; + rainingAcid = flags7[4]; abyssChasmBottom = reader.ReadInt32(); } @@ -701,7 +710,7 @@ namespace CalamityMod.World WorldGenerationMethods.NewJungleTemple(); }); - int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); + int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", delegate (GenerationProgress progress) { progress.Message = "Building the jungle temple (Calamity)"; @@ -718,16 +727,6 @@ namespace CalamityMod.World WorldGenerationMethods.NewJungleTempleLihzahrdAltar(); }); - 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 Sea"; - Abyss.PlaceSulphurSea(); - })); - } - int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { @@ -781,6 +780,17 @@ namespace CalamityMod.World Abyss.PlaceAbyss(); })); + // Moved to prevent the sulf sea caverns from being swallowed by the abyss opening + 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 Sea"; + Abyss.PlaceSulphurSea(); + })); + } + tasks.Insert(FinalIndex + 4, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) { progress.Message = "I Wanna Rock"; @@ -825,6 +835,21 @@ namespace CalamityMod.World CalamityMod.UpdateServerBoolean(); } + if (rainingAcid) + { + // Makes rain pour at its maximum intensity + // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 600; + Main.maxRaining = 0.89f; + Main.invasionProgressNearInvasion = true; + } + // Boss Rush shit if (bossRushActive) { diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 76d5651965..1d3c744f32 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -4047,7 +4047,7 @@ namespace CalamityMod.World 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 + double num3 = (double)(WorldGen.genRand.Next(5, 7) + 20); //start width while (num3 > 0.0) { if (num > 0f) @@ -4074,13 +4074,13 @@ namespace CalamityMod.World { num3 = ocean ? 42.0 : 14.0; //min width } - if (num3 > (ocean ? 60.0 : 40.0)) //max width + if (num3 > (ocean ? 50.0 : 30.0)) //max width { - num3 = ocean ? 60.0 : 40.0; //max width + num3 = ocean ? 50.0 : 30.0; //max width } - if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) + if (num == 1f && num3 < (ocean ? 40.0 : 15.0)) { - num3 = ocean ? 50.0 : 20.0; + num3 = ocean ? 40.0 : 15.0; } } }